diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7bb241e --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ + +logs +*.log diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + 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: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) 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 [yyyy] [name of copyright owner] + + 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. diff --git a/cloud/conf/common.yaml b/cloud/conf/common.yaml new file mode 100644 index 0000000..1a10bf7 --- /dev/null +++ b/cloud/conf/common.yaml @@ -0,0 +1,157 @@ +spring: + servlet: + multipart: + #是否开启文件上传 + enabled: true + #临时文件路径 + location: D:\tmp\tmp-datas + #单个文件最大值 + max-file-size: 10MB + #请求中所有文件的最大值 + max-request-size: 100MB + #将文件写入磁盘的阈值 + #file-size-threshold: 0 + #是否要延迟解析文件 + #resolve-lazily: false + quartz: + jdbc: + initialize-schema: never + job-store-type: jdbc + wait-for-jobs-to-complete-on-shutdown: true + properties: + # ID设置为自动获取 每一个必须不同 + "org.quartz.scheduler.instanceId": AUTO + # 开启集群 + "org.quartz.jobStore.isClustered": true + #时间格式 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + default-property-inclusion: non_null + #使用redis存储SESSION + session: + store-type: redis + +knife4j: + enable: true + setting: + language: zh-CN + # 是否显示界面中SwaggerModel功能 + enableSwaggerModels: false + # 是否显示界面中"文档管理"功能 + enableDocumentManage: true + # 是否默认显示底部Footer + enableFooter: false + # 是否自定义Footer + enableFooterCustom: true + # 自定义Footer内容(支持Markdown语法) + footerCustomContent: Apache License 2.0 | Copyright 2019-[星云ERP](https://gitee.com/lframework/xingyun) + # 是否开启调试 + enableDebug: true + # 是否显示OpenAPI原始结构的Tab框,默认显示 + enableOpenApi: false + # 是否生产环境 + production: false + +# Sa-Token配置 +sa-token: + # token名称 (同时也是cookie名称),此值不要修改 + token-name: X-Auth-Token + # token有效期,单位s 默认30天, -1代表永不过期 + timeout: 25920000 + # token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + activity-timeout: 7200 + # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + is-concurrent: true + # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + is-share: false + # token风格 + token-style: uuid + # 是否输出操作日志 + is-log: false + +jugg: + secret: + # 秘钥,用于敏感信息加密,生产环境一定要更改此项,并且产生数据后不要更改秘钥 + # 提供了EncryptUtil工具类,包含:生成秘钥、加密、解密方法。 + key: eRE2drUFINojkG9ivqtfOA== + upload: + #下载时的baseUrl,与domain的区别:会在url后面拼接/**作为静态资源的url,而domain是后端系统的具体域名,下载时的完整url例如:upload.domain + upload.url/xxx.jpg + url: /oss + #下载时的域名 + domain: http://localhost:8080 + #上传文件的路径 + location: D:\upload\upload-data + #默认配置 + default-setting: + #默认单号生成类型 FLOW:流水号 SNOW_FLAKE:雪花算法,如果不配置,默认是SNOW_FLAKE + generator-type: SNOW_FLAKE + #默认的用户ID,用于写入数据库时的createById和updateById的自动赋值,如果有登录人则取登录人ID,如果没有则取默认用户ID,如果不配置,默认是1 + default-user-id: 1 + #默认的用户姓名,用于写入数据库时的createBy和updateBy的自动赋值,如果有登录人则取登录人姓名,如果没有则取默认用户姓名,如果不配置,默认是系统管理员 + default-user-name: 系统管理员 + #缓存TTL配置 单位:秒 + cache: + #公共缓存过期时间 + ttl: 1800 + #特殊指定缓存过期时间,以下示例为cacheName的过期时间是3600秒、cacheName2的过期是7200秒。cacheName、cacheName2对应的是@Cacheable的Value属性 + #regions: + # cacheName: 3600 + # cacheName2: 7200 + #验证码配置 + kaptcha: + #过期时间(单位:分钟) + expire-time: 5 + session-config-key: KAPTCHA_SESSION_KEY + session-config-date: KAPTCHA_SESSION_DATE + border: true + border-color: black + border-thickness: 1 + noise-color: black + noise-impl: com.google.code.kaptcha.impl.DefaultNoise + obscurificator-impl: com.google.code.kaptcha.impl.WaterRipple + producer-impl: com.google.code.kaptcha.impl.DefaultKaptcha + text-producer-impl: com.google.code.kaptcha.text.impl.DefaultTextCreator + text-producer-char-string: abcde2345678gfynmnpwx + text-producer-char-length: 4 + text-producer-font-names: Arial,Courier + text-producer-font-color: black + text-producer-font-size: 28 + text-producer-char-space: 2 + word-render-impl: com.google.code.kaptcha.text.impl.DefaultWordRenderer + back-ground-impl: com.google.code.kaptcha.impl.DefaultBackground + back-ground-clr-from: lightGray + back-ground-clr-to: white + image-width: 120 + image-height: 40 + +#PageHelper分页器 +pagehelper: + offset-as-page-num: true + row-bounds-with-count: true + page-size-zero: true + reasonable: false + params: pageNum=pageIndex;pageSize=pageSize; + support-methods-arguments: false +mybatis-plus: + mapper-locations: classpath*:/mappers/**/*.xml + typeEnumsPackage: com.lframework.xingyun.**.enums + +op-logs: + #是否开启 + enabled: true + #操作日志保留天数 + retain-days: 7 + +# 是否移除内置权限,针对admin等内置权限,因为内置权限等同于通配符权限,设置为true时会用具体的权限将内置权限替换掉,生产环境建议设置为true +remove-fixed-permissions: false + +feign: + # feign使用HttpClient + httpclient: + enabled: true + client: + config: + default: + connect-timeout: 500 + read-time-out: 60000 + diff --git a/cloud/conf/db.yaml b/cloud/conf/db.yaml new file mode 100644 index 0000000..4fcb4b6 --- /dev/null +++ b/cloud/conf/db.yaml @@ -0,0 +1,27 @@ +spring: + datasource: + dynamic: + # 设置默认数据源 + primary: master + # 是否严格匹配数据源 未匹配到指定数据源时true抛异常,false使用默认数据源 + strict: true + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/xingyun?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 + username: root + password: password + druid: + initial-size: 10 + min-idle: 10 + max-active: 200 + max-wait: 60000 + time-between-eviction-runs-millis: 300000 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat \ No newline at end of file diff --git a/cloud/conf/mq.yaml b/cloud/conf/mq.yaml new file mode 100644 index 0000000..403de83 --- /dev/null +++ b/cloud/conf/mq.yaml @@ -0,0 +1,11 @@ +spring: + activemq: + broker-url: tcp://127.0.0.1:61616 + user: user + password: password + pool: + enabled: true + max-connections: 5 + in-memory: false + packages: + trust-all: true \ No newline at end of file diff --git a/cloud/conf/redis.yaml b/cloud/conf/redis.yaml new file mode 100644 index 0000000..ae4c6ef --- /dev/null +++ b/cloud/conf/redis.yaml @@ -0,0 +1,37 @@ +spring: + #redis配置,这个redis用来缓存业务数据 + redis: + #地址 + host: 127.0.0.1 + #端口,默认为6379 + port: 6379 + #数据库 + database: 0 + #密码 + password: password + #连接超时时间 + timeout: 10s + lettuce: + pool: + #连接池中的最小空闲连接 + min-idle: 0 + #连接池中的最大空闲连接 + max-idle: 8 + #连接池的最大数据库连接数 + max-active: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +sa-token: + # 配置 Sa-Token 单独使用的 Redis 连接,将业务和鉴权独立 + alone-redis: + # Redis数据库索引(默认为0),最好与业务数据的redis隔离 + database: 1 + # Redis服务器地址 + host: ${spring.redis.host} + # Redis服务器连接端口 + port: ${spring.redis.port} + # Redis服务器连接密码(默认为空) + password: ${spring.redis.password} + # 连接超时时间 + timeout: ${spring.redis.timeout} \ No newline at end of file diff --git a/cloud/conf/zipkin.yaml b/cloud/conf/zipkin.yaml new file mode 100644 index 0000000..36532f5 --- /dev/null +++ b/cloud/conf/zipkin.yaml @@ -0,0 +1,9 @@ +spring: + zipkin: + # zipkin-server地址 + base-url: http://127.0.0.1:9411 + discovery-client-enabled: false + sleuth: + sampler: + # 每秒跟踪请求的最大数量 可设置0-2147483647 + rate: 2147483647 \ No newline at end of file diff --git a/cloud/xingyun-cloud-api/Dockerfile b/cloud/xingyun-cloud-api/Dockerfile new file mode 100644 index 0000000..f0b9761 --- /dev/null +++ b/cloud/xingyun-cloud-api/Dockerfile @@ -0,0 +1,12 @@ +FROM openjdk:8-jre-slim + +WORKDIR /opt + +ARG JAR_FILE=@build.finalName@.jar +COPY ${JAR_FILE} /opt/app.jar + +EXPOSE 15020 + +ENV JAVA_OPTS="-Dspring.profiles.active=prod" + +CMD ["sh", "-c", "java $JAVA_OPTS -jar -server app.jar"] diff --git a/cloud/xingyun-cloud-api/pom.xml b/cloud/xingyun-cloud-api/pom.xml new file mode 100644 index 0000000..80b9e24 --- /dev/null +++ b/cloud/xingyun-cloud-api/pom.xml @@ -0,0 +1,114 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + ../../pom.xml + + 4.0.0 + + xingyun-cloud-api + 【${project.artifactId}】SpringCloud架构的Api接口层 + + + + com.lframework + xingyun-common + + + com.lframework + xingyun-basedata + + + + com.lframework + xingyun-sc + + + + com.lframework + xingyun-settle + + + + com.lframework + xingyun-chart + + + + com.lframework + xingyun-template + + + + com.lframework + cloud-starter + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + copy-resources-to-target + package + + copy-resources + + + ${project.build.directory} + + + ${project.basedir} + true + + Dockerfile + + + + ${project.basedir}/src/main/resources + true + + scripts/* + + + + + + + + + + + src/main/resources + true + + bootstrap.yml + + + + src/main/resources + false + + ** + + + scripts/* + project.yaml + + + + + diff --git a/cloud/xingyun-cloud-api/src/main/java/com/lframework/xingyun/api/XingYunCloudApiApplication.java b/cloud/xingyun-cloud-api/src/main/java/com/lframework/xingyun/api/XingYunCloudApiApplication.java new file mode 100644 index 0000000..74d9b95 --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/java/com/lframework/xingyun/api/XingYunCloudApiApplication.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.api; + +import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver; +import com.lframework.starter.web.annotations.locker.EnableLock; +import com.lframework.starter.web.annotations.locker.LockType; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; + +@EnableLock(type = LockType.REDIS) +@EnableDiscoveryClient +@EnableFeignClients(basePackages = "com.lframework.xingyun") +@ServletComponentScan(basePackages = "com.lframework.xingyun") +@SpringBootApplication(scanBasePackages = "com.lframework.xingyun") +@MapperScan("com.lframework.xingyun.**.mappers") +public class XingYunCloudApiApplication { + + public static void main(String[] args) { + + SpringApplication.run(XingYunCloudApiApplication.class, args); + } + + /** + * Swagger 自定义配置信息 请自行修改 + */ + @Configuration + public static class SwaggerApiConfiguration { + + @Bean(value = "defaultApi") + public Docket defaultApi(OpenApiExtensionResolver openApiExtensionResolver) { + + Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).groupName("星云ERP") + .select() + .apis(RequestHandlerSelectors.basePackage("com.lframework.xingyun.api") + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.basedata")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.chart")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.core")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.sc")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.settle"))) + .paths(PathSelectors.any()) + .build().extensions(openApiExtensionResolver.buildSettingExtensions()); + return docket; + } + + // 可以修改内容 但是不要删除这个Bean + @Bean + public ApiInfo apiInfo() { + + return new ApiInfoBuilder().title("星云ERP接口文档").description("# 星云ERP接口文档") + .contact("lframework@163.com") + .build(); + } + } +} diff --git a/cloud/xingyun-cloud-api/src/main/java/lombok.config b/cloud/xingyun-cloud-api/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/cloud/xingyun-cloud-api/src/main/resources/banner.txt b/cloud/xingyun-cloud-api/src/main/resources/banner.txt new file mode 100644 index 0000000..15182bc --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/resources/banner.txt @@ -0,0 +1,7 @@ + ▄ ▄ ▀ + █ █ ▄▄▄ ▄ ▄▄ ▄▄▄▄ ▄ ▄ ▄ ▄ ▄ ▄▄ + ██ █ █▀ █ █▀ ▀█ ▀▄ ▄▀ █ █ █▀ █ + ▄▀▀▄ █ █ █ █ █ █▄█ █ █ █ █ + ▄▀ ▀▄ ▄▄█▄▄ █ █ ▀█▄▀█ ▀█ ▀▄▄▀█ █ █ + ▄ █ ▄▀ + ▀▀ ▀▀ \ No newline at end of file diff --git a/cloud/xingyun-cloud-api/src/main/resources/bootstrap.yml b/cloud/xingyun-cloud-api/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..5cd7c40 --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/resources/bootstrap.yml @@ -0,0 +1,36 @@ +server: + #端口 + port: 15020 + +spring: + application: + name: @project.artifactId@ + profiles: + active: @profiles-active@ + cloud: + nacos: + config: + server-addr: ${nacos-server-addr} + file-extension: yaml + namespace: ${spring.profiles.active} + extension-configs[0]: + data-id: common.yaml + refresh: true + extension-configs[1]: + data-id: db.yaml + refresh: true + extension-configs[2]: + data-id: redis.yaml + refresh: true + extension-configs[3]: + data-id: zipkin.yaml + refresh: true + #extension-configs[4]: + # data-id: mq.yaml + # refresh: true + discovery: + server-addr: ${nacos-server-addr} + namespace: ${spring.profiles.active} + +# nacos-server地址 +nacos-server-addr: @discovery-server@ \ No newline at end of file diff --git a/cloud/xingyun-cloud-api/src/main/resources/magic-editor-config.js b/cloud/xingyun-cloud-api/src/main/resources/magic-editor-config.js new file mode 100644 index 0000000..f582920 --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/resources/magic-editor-config.js @@ -0,0 +1,21 @@ +var MAGIC_EDITOR_CONFIG = { + title: '在线开发平台', + header: { + skin: false, // 屏蔽皮肤按钮 + document: false, // 屏蔽文档按钮 + repo: false, // 屏蔽gitee和github + qqGroup: false // 屏蔽加入QQ群 + }, + getMagicTokenValue: function(){ + return this.getCookie('X-Auth-Token'); + }, + getCookie: function(name) { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = cookies[i].trim().split('='); + if (cookie[0] === name) { + return decodeURIComponent(cookie[1]); + } + } + } +} \ No newline at end of file diff --git a/cloud/xingyun-cloud-api/src/main/resources/project.yaml b/cloud/xingyun-cloud-api/src/main/resources/project.yaml new file mode 100644 index 0000000..57616c2 --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/resources/project.yaml @@ -0,0 +1,71 @@ +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + file: + name: logs/${spring.application.name}.log + max-history: 14 + +jugg: + web: + #不需要认证的Url + filter-url: ${magic-api.push_path} + #终端ID + worker-id: 1 + #数据中心ID + center-id: 1 + #开启多租户 + tenant: + enabled: true + #开启websocket + ws: + enabled: true + #通信topic + #topic: xingyun:ws:topic + #是否支持跨域 + #support-cross-domain: false +magic-api: + # 编辑器配置项 + editor-config: classpath:magic-editor-config.js + # 这里改为项目运行时的域名,菜单中嵌入的页面为base-url + web,这里示例即为http://localhost:8080/dynamic/web + base-url: http://localhost:15000 + # 编辑器页面的访问路径url + web: /dynamic/web + resource: + type: database + tableName: magic_api_file + prefix: /magic-api + readonly: false + # 接口前缀 + prefix: /dynamic-api + # 禁止覆盖应用接口 + allow-override: true + # 是否支持跨域 + support-cross-domain: true + # 推送路径 + push_path: /_magic-api-sync + # 推送秘钥,自行修改 + secret-key: 123456789 + throw-exception: true + response: |- #配置JSON格式,格式为magic-script中的表达式 + { + code: code, + msg: message, + data, + timestamp, + requestTime, + executeTime, + } + response-code: + success: 200 + invalid: 400 + exception: 500 + page: + size: pageSize # 页大小的参数名称 + page: pageIndex # 页码的参数名称 + default-page: 1 # 未传页码时的默认首页 + default-size: 20 # 未传页大小时的默认页大小 + backup: + enable: true + max-history: 14 #备份保留天数,-1为永久保留 + table-name: magic_api_file_backup \ No newline at end of file diff --git a/cloud/xingyun-cloud-api/src/main/resources/scripts/start.sh b/cloud/xingyun-cloud-api/src/main/resources/scripts/start.sh new file mode 100644 index 0000000..b38807f --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/resources/scripts/start.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +export BUILD_ID=dontkillme +if [ -z $JAVA_HOME ] ; +then +echo "JAVA_HOME is not exist, please check" +exit 1 +fi +export APP_HOME_BIN_PATH=$(cd `dirname $0`; pwd) +export APP_HOME=${APP_HOME_BIN_PATH%/bin} + +$JAVA_HOME/bin/java -jar -server -Xmx256m -XX:MaxPermSize=32m -XX:MaxNewSize=32m $APP_HOME/@build.finalName@.jar >/dev/null 2>&1 & \ No newline at end of file diff --git a/cloud/xingyun-cloud-api/src/main/resources/scripts/stop.sh b/cloud/xingyun-cloud-api/src/main/resources/scripts/stop.sh new file mode 100644 index 0000000..260e4e2 --- /dev/null +++ b/cloud/xingyun-cloud-api/src/main/resources/scripts/stop.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +export APP_HOME_BIN_PATH=$(cd `dirname $0`; pwd) +export APP_HOME=${APP_HOME_BIN_PATH%/bin} + +export C_PID=`ps -ef | grep java | grep $APP_HOME | grep -v grep | awk '{print $2}'` + +if [ ! -z "$C_PID" ]; then + kill -15 $C_PID; +fi \ No newline at end of file diff --git a/cloud/xingyun-cloud-gateway/Dockerfile b/cloud/xingyun-cloud-gateway/Dockerfile new file mode 100644 index 0000000..56ea9fc --- /dev/null +++ b/cloud/xingyun-cloud-gateway/Dockerfile @@ -0,0 +1,12 @@ +FROM openjdk:8-jre-slim + +WORKDIR /opt + +ARG JAR_FILE=@build.finalName@.jar +COPY ${JAR_FILE} /opt/app.jar + +EXPOSE 15000 + +ENV JAVA_OPTS="-Dspring.profiles.active=prod" + +CMD ["sh", "-c", "java $JAVA_OPTS -jar -server app.jar"] diff --git a/cloud/xingyun-cloud-gateway/pom.xml b/cloud/xingyun-cloud-gateway/pom.xml new file mode 100644 index 0000000..3ea3954 --- /dev/null +++ b/cloud/xingyun-cloud-gateway/pom.xml @@ -0,0 +1,110 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + ../../pom.xml + + 4.0.0 + + xingyun-cloud-gateway + + 【${project.artifactId}】GateWay网关 + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + spring-cloud-starter-alibaba-nacos-config + com.alibaba.cloud + + + + nacos-client + com.alibaba.nacos + + + + spring-cloud-starter-zipkin + org.springframework.cloud + + + + + true + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + copy-resources-to-target + package + + copy-resources + + + ${project.build.directory} + + + ${project.basedir} + true + + Dockerfile + + + + ${project.basedir}/src/main/resources + true + + scripts/* + + + + + + + + + + + src/main/resources + true + + bootstrap.yml + + + + src/main/resources + false + + ** + + + scripts/* + project.yaml + + + + + \ No newline at end of file diff --git a/cloud/xingyun-cloud-gateway/src/main/java/com/lframework/xingyun/gateway/GateWayApplication.java b/cloud/xingyun-cloud-gateway/src/main/java/com/lframework/xingyun/gateway/GateWayApplication.java new file mode 100644 index 0000000..ca7ffa2 --- /dev/null +++ b/cloud/xingyun-cloud-gateway/src/main/java/com/lframework/xingyun/gateway/GateWayApplication.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.gateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@EnableDiscoveryClient +@SpringBootApplication +public class GateWayApplication { + + public static void main(String[] args) { + SpringApplication.run(GateWayApplication.class, args); + } +} diff --git a/cloud/xingyun-cloud-gateway/src/main/resources/banner.txt b/cloud/xingyun-cloud-gateway/src/main/resources/banner.txt new file mode 100644 index 0000000..15182bc --- /dev/null +++ b/cloud/xingyun-cloud-gateway/src/main/resources/banner.txt @@ -0,0 +1,7 @@ + ▄ ▄ ▀ + █ █ ▄▄▄ ▄ ▄▄ ▄▄▄▄ ▄ ▄ ▄ ▄ ▄ ▄▄ + ██ █ █▀ █ █▀ ▀█ ▀▄ ▄▀ █ █ █▀ █ + ▄▀▀▄ █ █ █ █ █ █▄█ █ █ █ █ + ▄▀ ▀▄ ▄▄█▄▄ █ █ ▀█▄▀█ ▀█ ▀▄▄▀█ █ █ + ▄ █ ▄▀ + ▀▀ ▀▀ \ No newline at end of file diff --git a/cloud/xingyun-cloud-gateway/src/main/resources/bootstrap.yml b/cloud/xingyun-cloud-gateway/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..697abc8 --- /dev/null +++ b/cloud/xingyun-cloud-gateway/src/main/resources/bootstrap.yml @@ -0,0 +1,24 @@ +server: + #端口 + port: 15000 + +spring: + application: + name: @project.artifactId@ + profiles: + active: @profiles-active@ + cloud: + nacos: + config: + server-addr: ${nacos-server-addr} + file-extension: yaml + namespace: ${spring.profiles.active} + extension-configs[0]: + data-id: zipkin.yaml + refresh: true + discovery: + server-addr: ${nacos-server-addr} + namespace: ${spring.profiles.active} + +# nacos-server地址 +nacos-server-addr: @discovery-server@ \ No newline at end of file diff --git a/cloud/xingyun-cloud-gateway/src/main/resources/project.yaml b/cloud/xingyun-cloud-gateway/src/main/resources/project.yaml new file mode 100644 index 0000000..1bb61f7 --- /dev/null +++ b/cloud/xingyun-cloud-gateway/src/main/resources/project.yaml @@ -0,0 +1,29 @@ +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + file: + name: logs/${spring.application.name}.log + max-history: 14 + +spring: + cloud: + gateway: + discovery: + locator: + enabled: true + routes: + - id: xingyun-cloud-api + uri: lb://xingyun-cloud-api + predicates: + - Path=/cloud-api/** + filters: + - StripPrefix=1 + - id: xingyun-dynamic-api + uri: lb://xingyun-cloud-api + predicates: + - Path=/dynamic/web/**,/dynamic-api/** + - id: xingyun-oss + uri: lb://xingyun-cloud-api + predicates: + - Path=/oss/** \ No newline at end of file diff --git a/cloud/xingyun-cloud-gateway/src/main/resources/scripts/start.sh b/cloud/xingyun-cloud-gateway/src/main/resources/scripts/start.sh new file mode 100644 index 0000000..b38807f --- /dev/null +++ b/cloud/xingyun-cloud-gateway/src/main/resources/scripts/start.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +export BUILD_ID=dontkillme +if [ -z $JAVA_HOME ] ; +then +echo "JAVA_HOME is not exist, please check" +exit 1 +fi +export APP_HOME_BIN_PATH=$(cd `dirname $0`; pwd) +export APP_HOME=${APP_HOME_BIN_PATH%/bin} + +$JAVA_HOME/bin/java -jar -server -Xmx256m -XX:MaxPermSize=32m -XX:MaxNewSize=32m $APP_HOME/@build.finalName@.jar >/dev/null 2>&1 & \ No newline at end of file diff --git a/cloud/xingyun-cloud-gateway/src/main/resources/scripts/stop.sh b/cloud/xingyun-cloud-gateway/src/main/resources/scripts/stop.sh new file mode 100644 index 0000000..260e4e2 --- /dev/null +++ b/cloud/xingyun-cloud-gateway/src/main/resources/scripts/stop.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +export APP_HOME_BIN_PATH=$(cd `dirname $0`; pwd) +export APP_HOME=${APP_HOME_BIN_PATH%/bin} + +export C_PID=`ps -ef | grep java | grep $APP_HOME | grep -v grep | awk '{print $2}'` + +if [ ! -z "$C_PID" ]; then + kill -15 $C_PID; +fi \ No newline at end of file diff --git a/codestyles/eclipse-java-google-style.xml b/codestyles/eclipse-java-google-style.xml new file mode 100644 index 0000000..7bb6804 --- /dev/null +++ b/codestyles/eclipse-java-google-style.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codestyles/intellij-java-google-style.xml b/codestyles/intellij-java-google-style.xml new file mode 100644 index 0000000..f3a6743 --- /dev/null +++ b/codestyles/intellij-java-google-style.xml @@ -0,0 +1,598 @@ + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0bab112 --- /dev/null +++ b/pom.xml @@ -0,0 +1,156 @@ + + + + org.springframework.boot + spring-boot-starter-parent + 2.2.2.RELEASE + + + + com.lframework + xingyun + 【${project.artifactId}】星云ERP + 1.0.0-SNAPSHOT + + 4.0.0 + pom + + + xingyun-core + xingyun-api + xingyun-basedata + xingyun-sc + xingyun-chart + xingyun-settle + xingyun-template + xingyun-template-core + cloud/xingyun-cloud-api + xingyun-common + cloud/xingyun-cloud-gateway + + + + 8 + 8 + 1.0.0-SNAPSHOT + 3.1.3 + + + + + + com.lframework + parent + ${jugg.version} + pom + import + + + com.lframework + xingyun-basedata + ${xingyun.version} + + + + com.lframework + xingyun-common + ${xingyun.version} + + + com.lframework + xingyun-sc + ${xingyun.version} + + + + com.lframework + xingyun-chart + ${xingyun.version} + + + + com.lframework + xingyun-template + ${xingyun.version} + + + + com.lframework + xingyun-template-core + ${xingyun.version} + + + + com.lframework + xingyun-settle + ${xingyun.version} + + + + com.lframework + xingyun-core + ${xingyun.version} + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + + ali-public + 阿里云public库 + https://maven.aliyun.com/repository/public + default + + + + ali-central + 阿里云central库 + https://maven.aliyun.com/repository/central + + + + ali-central-old + 阿里云central库old + https://maven.aliyun.com/nexus/content/groups/public + + + + + + dev + + true + + + dev + 127.0.0.1:10000 + + + + test + + test + 127.0.0.1:10000 + + + + prod + + prod + 127.0.0.1:10000 + + + + diff --git a/screenshots/1.jpg b/screenshots/1.jpg new file mode 100644 index 0000000..a31e9a5 Binary files /dev/null and b/screenshots/1.jpg differ diff --git a/screenshots/10.jpg b/screenshots/10.jpg new file mode 100644 index 0000000..196eaf4 Binary files /dev/null and b/screenshots/10.jpg differ diff --git a/screenshots/11.jpg b/screenshots/11.jpg new file mode 100644 index 0000000..bd4b7ed Binary files /dev/null and b/screenshots/11.jpg differ diff --git a/screenshots/12.jpg b/screenshots/12.jpg new file mode 100644 index 0000000..b377a9d Binary files /dev/null and b/screenshots/12.jpg differ diff --git a/screenshots/2.jpg b/screenshots/2.jpg new file mode 100644 index 0000000..828577a Binary files /dev/null and b/screenshots/2.jpg differ diff --git a/screenshots/3.jpg b/screenshots/3.jpg new file mode 100644 index 0000000..07d326c Binary files /dev/null and b/screenshots/3.jpg differ diff --git a/screenshots/4.jpg b/screenshots/4.jpg new file mode 100644 index 0000000..dad54e2 Binary files /dev/null and b/screenshots/4.jpg differ diff --git a/screenshots/5.jpg b/screenshots/5.jpg new file mode 100644 index 0000000..b2c18f5 Binary files /dev/null and b/screenshots/5.jpg differ diff --git a/screenshots/6.jpg b/screenshots/6.jpg new file mode 100644 index 0000000..0192d35 Binary files /dev/null and b/screenshots/6.jpg differ diff --git a/screenshots/7.jpg b/screenshots/7.jpg new file mode 100644 index 0000000..ab1db12 Binary files /dev/null and b/screenshots/7.jpg differ diff --git a/screenshots/8.jpg b/screenshots/8.jpg new file mode 100644 index 0000000..f998210 Binary files /dev/null and b/screenshots/8.jpg differ diff --git a/screenshots/9.jpg b/screenshots/9.jpg new file mode 100644 index 0000000..c535eff Binary files /dev/null and b/screenshots/9.jpg differ diff --git a/xingyun-api/Dockerfile b/xingyun-api/Dockerfile new file mode 100644 index 0000000..996bbbe --- /dev/null +++ b/xingyun-api/Dockerfile @@ -0,0 +1,16 @@ +FROM frolvlad/alpine-java:jdk8-slim + +WORKDIR /opt + +ARG JAR_FILE=@build.finalName@.jar +COPY ${JAR_FILE} /opt/app.jar + +EXPOSE 8080 + +ENV JAVA_OPTS="-Dspring.profiles.active=prod" + +# 在默认情况下 +# /opt/data/tmp是tomcat临时文件目录 +# /opt/data/upload是上传文件的存储目录 +# /opt/logs是日志的存储目录 +CMD ["sh", "-c", "java -Dspring.servlet.multipart.location=/opt/data/tmp -Djugg.upload.location=/opt/data/upload $JAVA_OPTS -jar -server app.jar"] diff --git a/xingyun-api/pom.xml b/xingyun-api/pom.xml new file mode 100644 index 0000000..adbb64f --- /dev/null +++ b/xingyun-api/pom.xml @@ -0,0 +1,108 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-api + 【${project.artifactId}】Api接口层 + + + + com.lframework + xingyun-common + + + com.lframework + xingyun-basedata + + + + com.lframework + xingyun-sc + + + + com.lframework + xingyun-settle + + + + com.lframework + xingyun-chart + + + + com.lframework + xingyun-template + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + copy-resources-to-target + package + + copy-resources + + + ${project.build.directory} + + + ${project.basedir} + true + + Dockerfile + + + + ${project.basedir}/src/main/resources + true + + scripts/* + + + + + + + + + + + src/main/resources + true + + application.yml + + + + src/main/resources + false + + ** + + + db/** + scripts/* + + + + + diff --git a/xingyun-api/src/main/java/com/lframework/xingyun/api/XingYunApiApplication.java b/xingyun-api/src/main/java/com/lframework/xingyun/api/XingYunApiApplication.java new file mode 100644 index 0000000..b59dd6c --- /dev/null +++ b/xingyun-api/src/main/java/com/lframework/xingyun/api/XingYunApiApplication.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.api; + +import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver; +import com.lframework.starter.web.annotations.locker.EnableLock; +import com.lframework.starter.web.annotations.locker.LockType; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; + +@EnableLock(type = LockType.REDIS) +@ServletComponentScan(basePackages = {"com.lframework.xingyun"}) +@SpringBootApplication(scanBasePackages = {"com.lframework.xingyun"}) +@MapperScan({"com.lframework.xingyun.**.mappers"}) +public class XingYunApiApplication { + + public static void main(String[] args) { + + SpringApplication.run(XingYunApiApplication.class, args); + } + + /** + * Swagger 自定义配置信息 请自行修改 + */ + @Configuration + public static class SwaggerApiConfiguration { + + @Bean(value = "defaultApi") + public Docket defaultApi(OpenApiExtensionResolver openApiExtensionResolver) { + + Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).groupName("星云ERP") + .select() + .apis(RequestHandlerSelectors.basePackage("com.lframework.xingyun.api") + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.basedata")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.chart")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.core")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.sc")) + .or(RequestHandlerSelectors.basePackage("com.lframework.xingyun.settle"))) + .paths(PathSelectors.any()) + .build().extensions(openApiExtensionResolver.buildSettingExtensions()); + return docket; + } + + // 可以修改内容 但是不要删除这个Bean + @Bean + public ApiInfo apiInfo() { + + return new ApiInfoBuilder().title("星云ERP接口文档").description("# 星云ERP接口文档") + .contact("lframework@163.com") + .build(); + } + } +} diff --git a/xingyun-api/src/main/java/lombok.config b/xingyun-api/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-api/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-api/src/main/resources/application-dev.yml b/xingyun-api/src/main/resources/application-dev.yml new file mode 100644 index 0000000..cf606a9 --- /dev/null +++ b/xingyun-api/src/main/resources/application-dev.yml @@ -0,0 +1,83 @@ +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + level: + com.lframework: DEBUG + +spring: + servlet: + multipart: + #临时文件路径 + location: D:\tmp\tmp-datas + datasource: + dynamic: + # 设置默认数据源 + primary: master + # 是否严格匹配数据源 未匹配到指定数据源时true抛异常,false使用默认数据源 + strict: true + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:1234/platform?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 + username: platform + password: wnaHZEmN6BPTTR2M + druid: + initial-size: 10 + min-idle: 10 + max-active: 200 + max-wait: 60000 + time-between-eviction-runs-millis: 300000 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat + #redis配置,这个redis用来缓存业务数据 + redis: + #地址 + host: 127.0.0.1 + #端口,默认为6379 + port: 6379 + #数据库 + database: 0 + #密码 + password: + #连接超时时间 + timeout: 10s + lettuce: + pool: + #连接池中的最小空闲连接 + min-idle: 0 + #连接池中的最大空闲连接 + max-idle: 8 + #连接池的最大数据库连接数 + max-active: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +sa-token: + # 配置 Sa-Token 单独使用的 Redis 连接,将业务和鉴权独立 + alone-redis: + # Redis数据库索引(默认为0),最好与业务数据的redis隔离 + database: 1 + # Redis服务器地址 + host: ${spring.redis.host} + # Redis服务器连接端口 + port: ${spring.redis.port} + # Redis服务器连接密码(默认为空) + password: ${spring.redis.password} + # 连接超时时间 + timeout: ${spring.redis.timeout} + +jugg: + upload: + #下载时的baseUrl,与domain的区别:会在url后面拼接/**作为静态资源的url,而domain是后端系统的具体域名,下载时的完整url例如:upload.domain + upload.url/xxx.jpg + url: /oss + #下载时的域名 + domain: http://localhost:8080 + #上传文件的路径 + location: D:\upload\upload-data diff --git a/xingyun-api/src/main/resources/application-prod.yml b/xingyun-api/src/main/resources/application-prod.yml new file mode 100644 index 0000000..ab4431b --- /dev/null +++ b/xingyun-api/src/main/resources/application-prod.yml @@ -0,0 +1,87 @@ +server: + #端口 + port: 10062 +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + file: + name: logs/${spring.application.name}.log + max-history: 14 + +spring: + servlet: + multipart: + #临时文件路径 + location: /mnt/erp.fpvone.cn/tmp-datas + datasource: + dynamic: + # 设置默认数据源 + primary: master + # 是否严格匹配数据源 未匹配到指定数据源时true抛异常,false使用默认数据源 + strict: true + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/platform?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 + username: platform + password: wnaHZEmN6BPTTR2M + druid: + initial-size: 10 + min-idle: 10 + max-active: 200 + max-wait: 60000 + time-between-eviction-runs-millis: 300000 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat + #redis配置,这个redis用来缓存业务数据 + redis: + #地址 + host: 127.0.0.1 + #端口,默认为6379 + port: 6379 + #数据库 + database: 0 + #密码 + password: + #连接超时时间 + timeout: 10s + lettuce: + pool: + #连接池中的最小空闲连接 + min-idle: 0 + #连接池中的最大空闲连接 + max-idle: 8 + #连接池的最大数据库连接数 + max-active: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +sa-token: + # 配置 Sa-Token 单独使用的 Redis 连接,将业务和鉴权独立 + alone-redis: + # Redis数据库索引(默认为0),最好与业务数据的redis隔离 + database: 1 + # Redis服务器地址 + host: ${spring.redis.host} + # Redis服务器连接端口 + port: ${spring.redis.port} + # Redis服务器连接密码(默认为空) + password: ${spring.redis.password} + # 连接超时时间 + timeout: ${spring.redis.timeout} + +jugg: + upload: + #下载时的baseUrl,与domain的区别:会在url后面拼接/**作为静态资源的url,而domain是后端系统的具体域名,下载时的完整url例如:upload.domain + upload.url/xxx.jpg + url: /oss + #下载时的域名 + domain: http://localhost:10662 + #上传文件的路径 + location: /mnt/erp.fpvone.cn/upload \ No newline at end of file diff --git a/xingyun-api/src/main/resources/application-test.yml b/xingyun-api/src/main/resources/application-test.yml new file mode 100644 index 0000000..8733a14 --- /dev/null +++ b/xingyun-api/src/main/resources/application-test.yml @@ -0,0 +1,84 @@ +logging: + pattern: + console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}|%clr(%5p)|%clr(${PID:- }){magenta}|%clr(%15.15t){faint}|%clr(${spring.application.name}){cyan}|%clr(%X{X-B3-TraceId:-N/A}){blue}|%X{X-B3-SpanId:-N/A}|%clr(%-40.40logger{39}){cyan}|%m%n%wEx" + file: ${logging.pattern.console} + file: + name: logs/${spring.application.name}.log + max-history: 14 + +spring: + servlet: + multipart: + #临时文件路径 + location: D:\tmp\tmp-datas + datasource: + dynamic: + # 设置默认数据源 + primary: master + # 是否严格匹配数据源 未匹配到指定数据源时true抛异常,false使用默认数据源 + strict: true + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/platform?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 + username: root + password: password + druid: + initial-size: 10 + min-idle: 10 + max-active: 200 + max-wait: 60000 + time-between-eviction-runs-millis: 300000 + validation-query: SELECT 'x' + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat + #redis配置,这个redis用来缓存业务数据 + redis: + #地址 + host: 127.0.0.1 + #端口,默认为6379 + port: 6379 + #数据库 + database: 0 + #密码 + password: password + #连接超时时间 + timeout: 10s + lettuce: + pool: + #连接池中的最小空闲连接 + min-idle: 0 + #连接池中的最大空闲连接 + max-idle: 8 + #连接池的最大数据库连接数 + max-active: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +sa-token: + # 配置 Sa-Token 单独使用的 Redis 连接,将业务和鉴权独立 + alone-redis: + # Redis数据库索引(默认为0),最好与业务数据的redis隔离 + database: 1 + # Redis服务器地址 + host: ${spring.redis.host} + # Redis服务器连接端口 + port: ${spring.redis.port} + # Redis服务器连接密码(默认为空) + password: ${spring.redis.password} + # 连接超时时间 + timeout: ${spring.redis.timeout} + +jugg: + upload: + #下载时的baseUrl,与domain的区别:会在url后面拼接/**作为静态资源的url,而domain是后端系统的具体域名,下载时的完整url例如:upload.domain + upload.url/xxx.jpg + url: /oss + #下载时的域名 + domain: http://localhost:8080 + #上传文件的路径 + location: D:\upload\upload-data diff --git a/xingyun-api/src/main/resources/application.yml b/xingyun-api/src/main/resources/application.yml new file mode 100644 index 0000000..fb72edb --- /dev/null +++ b/xingyun-api/src/main/resources/application.yml @@ -0,0 +1,207 @@ +server: + #端口 + port: 8080 +spring: + application: + name: @project.artifactId@ + profiles: + active: dev + servlet: + multipart: + #是否开启文件上传 + enabled: true + #单个文件最大值 + max-file-size: 10MB + #请求中所有文件的最大值 + max-request-size: 100MB + #将文件写入磁盘的阈值 + #file-size-threshold: 0 + #是否要延迟解析文件 + #resolve-lazily: false + quartz: + jdbc: + initialize-schema: never + job-store-type: jdbc + wait-for-jobs-to-complete-on-shutdown: true + #时间格式 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + default-property-inclusion: non_null + #使用redis存储SESSION + session: + store-type: redis + +knife4j: + enable: true + setting: + language: zh-CN + # 是否显示界面中SwaggerModel功能 + enableSwaggerModels: false + # 是否显示界面中"文档管理"功能 + enableDocumentManage: true + # 是否默认显示底部Footer + enableFooter: false + # 是否自定义Footer + enableFooterCustom: true + # 自定义Footer内容(支持Markdown语法) + footerCustomContent: Apache License 2.0 | Copyright 2019-[星云ERP](https://gitee.com/lframework/xingyun) + # 是否开启调试 + enableDebug: true + # 是否显示OpenAPI原始结构的Tab框,默认显示 + enableOpenApi: false + # 是否生产环境 + production: false + +# Sa-Token配置 +sa-token: + # token名称 (同时也是cookie名称),此值不要修改 + token-name: X-Auth-Token + # token有效期,单位s 默认30天, -1代表永不过期 + timeout: 25920000 + # token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + activity-timeout: 7200 + # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + is-concurrent: true + # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + is-share: false + # token风格 + token-style: uuid + # 是否输出操作日志 + is-log: false + +jugg: + secret: + # 秘钥,用于敏感信息加密,生产环境一定要更改此项,并且产生数据后不要更改秘钥 + # 提供了EncryptUtil工具类,包含:生成秘钥、加密、解密方法。 + key: eRE2drUFINojkG9ivqtfOA== + #默认配置 + default-setting: + #默认单号生成类型 FLOW:流水号 SNOW_FLAKE:雪花算法,如果不配置,默认是SNOW_FLAKE + generator-type: SNOW_FLAKE + #默认的用户ID,用于写入数据库时的createById和updateById的自动赋值,如果有登录人则取登录人ID,如果没有则取默认用户ID,如果不配置,默认是1 + default-user-id: 1 + #默认的用户姓名,用于写入数据库时的createBy和updateBy的自动赋值,如果有登录人则取登录人姓名,如果没有则取默认用户姓名,如果不配置,默认是系统管理员 + default-user-name: 系统管理员 + web: + #不需要认证的Url + filter-url: ${magic-api.push_path} + #终端ID + worker-id: 1 + #数据中心ID + center-id: 1 + #重复提交拦截暂时不实现 + #repeat-request: + #重复提交拦截间隔(单位:秒) + #filter-interval: 1 + #缓存TTL配置 单位:秒 + cache: + #公共缓存过期时间 + ttl: 1800 + #特殊指定缓存过期时间,以下示例为cacheName的过期时间是3600秒、cacheName2的过期是7200秒。cacheName、cacheName2对应的是@Cacheable的Value属性 + #regions: + # cacheName: 3600 + # cacheName2: 7200 + #开启多租户 + tenant: + enabled: false + #开启websocket + ws: + enabled: true + #通信topic + #topic: xingyun:ws:topic + #是否支持跨域 + #support-cross-domain: false + #验证码配置 + kaptcha: + #过期时间(单位:分钟) + expire-time: 5 + session-config-key: KAPTCHA_SESSION_KEY + session-config-date: KAPTCHA_SESSION_DATE + border: true + border-color: black + border-thickness: 1 + noise-color: black + noise-impl: com.google.code.kaptcha.impl.DefaultNoise + obscurificator-impl: com.google.code.kaptcha.impl.WaterRipple + producer-impl: com.google.code.kaptcha.impl.DefaultKaptcha + text-producer-impl: com.google.code.kaptcha.text.impl.DefaultTextCreator + text-producer-char-string: abcde2345678gfynmnpwx + text-producer-char-length: 4 + text-producer-font-names: Arial,Courier + text-producer-font-color: black + text-producer-font-size: 28 + text-producer-char-space: 2 + word-render-impl: com.google.code.kaptcha.text.impl.DefaultWordRenderer + back-ground-impl: com.google.code.kaptcha.impl.DefaultBackground + back-ground-clr-from: lightGray + back-ground-clr-to: white + image-width: 120 + image-height: 40 + + +#PageHelper分页器 +pagehelper: + offset-as-page-num: true + row-bounds-with-count: true + page-size-zero: true + reasonable: false + params: pageNum=pageIndex;pageSize=pageSize; + support-methods-arguments: false +mybatis-plus: + mapper-locations: classpath*:/mappers/**/*.xml + typeEnumsPackage: com.lframework.starter.**.enums,com.lframework.xingyun.**.enums + +op-logs: + #是否开启 + enabled: true + #操作日志保留天数 + retain-days: 7 + +# 是否移除内置权限,针对admin等内置权限,因为内置权限等同于通配符权限,设置为true时会用具体的权限将内置权限替换掉,生产环境建议设置为true +remove-fixed-permissions: false + +magic-api: + # 编辑器配置项 + editor-config: classpath:magic-editor-config.js + # 这里改为项目运行时的域名,菜单中嵌入的页面为base-url + web,这里示例即为http://localhost:8080/dynamic/web + base-url: http://localhost:8080 + # 编辑器页面的访问路径url + web: /dynamic/web + resource: + type: database + tableName: magic_api_file + prefix: /magic-api + readonly: false + # 接口前缀 + prefix: /dynamic-api + # 禁止覆盖应用接口 + allow-override: true + # 是否支持跨域 + support-cross-domain: false + # 推送路径 + push_path: /_magic-api-sync + # 推送秘钥,自行修改 + secret-key: 123456789 + throw-exception: true + response: |- #配置JSON格式,格式为magic-script中的表达式 + { + code: code, + msg: message, + data, + timestamp, + requestTime, + executeTime, + } + response-code: + success: 200 + invalid: 400 + exception: 500 + page: + size: pageSize # 页大小的参数名称 + page: pageIndex # 页码的参数名称 + default-page: 1 # 未传页码时的默认首页 + default-size: 20 # 未传页大小时的默认页大小 + backup: + enable: true + max-history: 14 #备份保留天数,-1为永久保留 + table-name: magic_api_file_backup \ No newline at end of file diff --git a/xingyun-api/src/main/resources/banner.txt b/xingyun-api/src/main/resources/banner.txt new file mode 100644 index 0000000..15182bc --- /dev/null +++ b/xingyun-api/src/main/resources/banner.txt @@ -0,0 +1,7 @@ + ▄ ▄ ▀ + █ █ ▄▄▄ ▄ ▄▄ ▄▄▄▄ ▄ ▄ ▄ ▄ ▄ ▄▄ + ██ █ █▀ █ █▀ ▀█ ▀▄ ▄▀ █ █ █▀ █ + ▄▀▀▄ █ █ █ █ █ █▄█ █ █ █ █ + ▄▀ ▀▄ ▄▄█▄▄ █ █ ▀█▄▀█ ▀█ ▀▄▄▀█ █ █ + ▄ █ ▄▀ + ▀▀ ▀▀ \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/SQL文件说明,重要!!!!!!.txt b/xingyun-api/src/main/resources/db/SQL文件说明,重要!!!!!!.txt new file mode 100644 index 0000000..7d9df38 --- /dev/null +++ b/xingyun-api/src/main/resources/db/SQL文件说明,重要!!!!!!.txt @@ -0,0 +1,5 @@ +all目录中的是全量SQL,其中platform.sql是平台库SQL;tenant.sql是租户库SQL。 +migration目录中的是增量SQL,其中platform目录中是平台库的增量SQL;tenant目录中是租户库的增量SQL。 +如果不使用多租户,那么平台库和租户库的SQL就在同一个库中执行。 +使用多租户时,租户库是从平台库的tenant表中获取的,不要忘记修改这个表里面的数据 +tenant表中存储的密码不是明文密码,需要将明文密码加密后存储,参见EncryptUtil中的main方法进行转换。 \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/all/platform.sql b/xingyun-api/src/main/resources/db/all/platform.sql new file mode 100644 index 0000000..6d28672 --- /dev/null +++ b/xingyun-api/src/main/resources/db/all/platform.sql @@ -0,0 +1,388 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for magic_api_file +-- ---------------------------- +DROP TABLE IF EXISTS `magic_api_file`; +CREATE TABLE `magic_api_file` ( + `file_path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `file_content` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, + PRIMARY KEY (`file_path`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of magic_api_file +-- ---------------------------- + +-- ---------------------------- +-- Table structure for magic_api_file_backup +-- ---------------------------- +DROP TABLE IF EXISTS `magic_api_file_backup`; +CREATE TABLE `magic_api_file_backup` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '原对象ID', + `create_date` bigint(13) NOT NULL COMMENT '备份时间', + `tag` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签', + `type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型', + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '原名称', + `content` blob NULL COMMENT '备份内容', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作人', + PRIMARY KEY (`id`, `create_date`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of magic_api_file_backup +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_blob_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_blob_triggers`; +CREATE TABLE `qrtz_blob_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `BLOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `SCHED_NAME`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_blob_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_calendars +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_calendars`; +CREATE TABLE `qrtz_calendars` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `CALENDAR` blob NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_calendars +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_cron_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_cron_triggers`; +CREATE TABLE `qrtz_cron_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_cron_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_fired_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_fired_triggers`; +CREATE TABLE `qrtz_fired_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `ENTRY_ID` varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `FIRED_TIME` bigint(13) NOT NULL, + `SCHED_TIME` bigint(13) NOT NULL, + `PRIORITY` int(11) NOT NULL, + `STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `ENTRY_ID`) USING BTREE, + INDEX `IDX_QRTZ_FT_TRIG_INST_NAME`(`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE, + INDEX `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY`(`SCHED_NAME`, `INSTANCE_NAME`, `REQUESTS_RECOVERY`) USING BTREE, + INDEX `IDX_QRTZ_FT_J_G`(`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_FT_JG`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_FT_T_G`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_FT_TG`(`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_fired_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_job_details +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_job_details`; +CREATE TABLE `qrtz_job_details` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `IS_DURABLE` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_J_REQ_RECOVERY`(`SCHED_NAME`, `REQUESTS_RECOVERY`) USING BTREE, + INDEX `IDX_QRTZ_J_GRP`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_job_details +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_locks +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_locks`; +CREATE TABLE `qrtz_locks` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `LOCK_NAME` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `LOCK_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_locks +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_paused_trigger_grps +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`; +CREATE TABLE `qrtz_paused_trigger_grps` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_paused_trigger_grps +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_scheduler_state +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_scheduler_state`; +CREATE TABLE `qrtz_scheduler_state` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `LAST_CHECKIN_TIME` bigint(13) NOT NULL, + `CHECKIN_INTERVAL` bigint(13) NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_scheduler_state +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_simple_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simple_triggers`; +CREATE TABLE `qrtz_simple_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `REPEAT_COUNT` bigint(7) NOT NULL, + `REPEAT_INTERVAL` bigint(12) NOT NULL, + `TIMES_TRIGGERED` bigint(10) NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_simple_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_simprop_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simprop_triggers`; +CREATE TABLE `qrtz_simprop_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `STR_PROP_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `STR_PROP_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `STR_PROP_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `INT_PROP_1` int(11) NULL DEFAULT NULL, + `INT_PROP_2` int(11) NULL DEFAULT NULL, + `LONG_PROP_1` bigint(20) NULL DEFAULT NULL, + `LONG_PROP_2` bigint(20) NULL DEFAULT NULL, + `DEC_PROP_1` decimal(13, 4) NULL DEFAULT NULL, + `DEC_PROP_2` decimal(13, 4) NULL DEFAULT NULL, + `BOOL_PROP_1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `BOOL_PROP_2` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_simprop_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_triggers`; +CREATE TABLE `qrtz_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `NEXT_FIRE_TIME` bigint(13) NULL DEFAULT NULL, + `PREV_FIRE_TIME` bigint(13) NULL DEFAULT NULL, + `PRIORITY` int(11) NULL DEFAULT NULL, + `TRIGGER_STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `START_TIME` bigint(13) NOT NULL, + `END_TIME` bigint(13) NULL DEFAULT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `MISFIRE_INSTR` smallint(2) NULL DEFAULT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_J`(`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_JG`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_C`(`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE, + INDEX `IDX_QRTZ_T_G`(`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_STATE`(`SCHED_NAME`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_N_STATE`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_N_G_STATE`(`SCHED_NAME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_NEXT_FIRE_TIME`(`SCHED_NAME`, `NEXT_FIRE_TIME`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST`(`SCHED_NAME`, `TRIGGER_STATE`, `NEXT_FIRE_TIME`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_MISFIRE`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE, + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_module +-- ---------------------------- +DROP TABLE IF EXISTS `sys_module`; +CREATE TABLE `sys_module` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统模块' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_module +-- ---------------------------- +INSERT INTO `sys_module` VALUES (1, '平台管理', '系统平台的核心模块。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (2, '系统管理', '维护企业、系统基础数据,包括部门、岗位、角色、系统菜单和参数等。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (3, '基础信息管理', '维护基础业务数据,包括仓库、客户、供应商、会员等。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (4, '商品中心', '管理商品核心数据。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (5, '采购业务', '管理供应商与企业的采购业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (6, '销售业务', '管理企业与TOB端大客户的销售业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (7, '零售业务', '管理企业与TOC端会员的零售业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (8, '库存管理及调拨', '查询商品库存和进行商品调拨。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (9, '库存盘点', '库存商品盘点。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (10, '库存调整', '商品库存数量和成本调整。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (11, '结算管理', '企业与供应商、客户进行结算。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (12, '开发管理', '系统快捷开发,如管理定时器、数据实体、数据对象、表单生成等。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (13, '便捷办公', '支持文件收纳和在线Excel。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (14, '开放平台', '系统开放平台管理。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (15, '物流发货', '管理企业物流业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); + +-- ---------------------------- +-- Table structure for sys_module_tenant +-- ---------------------------- +DROP TABLE IF EXISTS `sys_module_tenant`; +CREATE TABLE `sys_module_tenant` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `module_id` int(11) NOT NULL COMMENT '模块ID', + `tenant_id` int(11) NOT NULL COMMENT '租户ID', + `expire_time` datetime NOT NULL COMMENT '过期时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `name`(`tenant_id`, `module_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租户和系统模块关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_module_tenant +-- ---------------------------- +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875135', 1, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875136', 2, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875137', 3, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875138', 4, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875139', 5, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875140', 6, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875141', 7, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875142', 8, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875143', 9, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875144', 10, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875145', 11, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875146', 12, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875147', 13, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875148', 14, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875149', 15, 1000, '2099-01-01 00:00:00'); + +-- ---------------------------- +-- Table structure for sys_open_domain +-- ---------------------------- +DROP TABLE IF EXISTS `sys_open_domain`; +CREATE TABLE `sys_open_domain` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `api_secret` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'API秘钥', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `tenant_id` int(11) NULL DEFAULT NULL COMMENT '租户ID', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `name`(`name`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '开放域' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_open_domain +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tenant +-- ---------------------------- +DROP TABLE IF EXISTS `tenant`; +CREATE TABLE `tenant` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `jdbc_url` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'JDBC连接地址', + `jdbc_username` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'JDBC用户名', + `jdbc_password` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'JDBC密码', + `available` tinyint(1) NOT NULL COMMENT '状态', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1001 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租户' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of tenant +-- ---------------------------- +INSERT INTO `tenant` VALUES (1000, '测试租户', 'jdbc:mysql://127.0.0.1:3306/xingyun', 'root', '24590d72bfb4d71ccbc533570aa9627b', 1, '2022-12-31 22:59:21', '2023-03-13 22:14:07'); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/xingyun-api/src/main/resources/db/all/tenant.sql b/xingyun-api/src/main/resources/db/all/tenant.sql new file mode 100644 index 0000000..a559de5 --- /dev/null +++ b/xingyun-api/src/main/resources/db/all/tenant.sql @@ -0,0 +1,7141 @@ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for base_data_address +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_address`; +CREATE TABLE `base_data_address` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `entity_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '实体ID', + `entity_type` tinyint(3) NOT NULL COMMENT '实体类型', + `address_type` tinyint(3) NOT NULL COMMENT '地址类型', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '姓名', + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号', + `province_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '省', + `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '市', + `district_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '区', + `address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '详细地址', + `is_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否默认地址', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `entity_id`(`entity_id`, `entity_type`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '地址库' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_address +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_customer +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_customer`; +CREATE TABLE `base_data_customer` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `mnemonic_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '助记码', + `contact` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电子邮箱', + `zip_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮编', + `fax` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '传真', + `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址', + `settle_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '结算方式', + `credit_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '统一社会信用代码', + `tax_identify_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '纳税人识别号', + `bank_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '开户银行', + `account_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '户名', + `account_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '银行账号', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_customer +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_logistics_company +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_logistics_company`; +CREATE TABLE `base_data_logistics_company` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `contact` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物流公司' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of base_data_logistics_company +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_member +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_member`; +CREATE TABLE `base_data_member` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `gender` tinyint(3) NOT NULL DEFAULT 0 COMMENT '性别', + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电子邮箱', + `birthday` date NULL DEFAULT NULL COMMENT '出生日期', + `join_day` date NOT NULL COMMENT '入会日期', + `shop_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属门店', + `guider_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属导购', + `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区ID', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + UNIQUE INDEX `telephone`(`telephone`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_member +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_pay_type +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_pay_type`; +CREATE TABLE `base_data_pay_type` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `rec_text` tinyint(1) NOT NULL COMMENT '是否记录内容', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付方式' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_pay_type +-- ---------------------------- +INSERT INTO `base_data_pay_type` VALUES ('1', '001', '现金', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('2', '002', '微信支付', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('3', '003', '支付宝支付', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('4', '004', '移动支付', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('5', '005', '优惠券', 1, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('6', '006', '积分', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); + +-- ---------------------------- +-- Table structure for base_data_product +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product`; +CREATE TABLE `base_data_product` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `short_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '简称', + `sku_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'SKU', + `external_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外部编号', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类目ID', + `brand_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '品牌ID', + `product_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '商品类型', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '进项税率(%)', + `sale_tax_rate` decimal(16, 2) NOT NULL COMMENT '销项税率', + `spec` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格', + `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位', + `weight` decimal(16, 2) NULL DEFAULT NULL COMMENT '重量(kg)', + `volume` decimal(16, 2) NULL DEFAULT NULL COMMENT '体积(cm3)', + `available` tinyint(1) NOT NULL COMMENT '状态', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + UNIQUE INDEX `sku_code`(`sku_code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_brand +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_brand`; +CREATE TABLE `base_data_product_brand` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `short_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '简称', + `logo` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'logo', + `introduction` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '简介', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品品牌' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_brand +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_bundle +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_bundle`; +CREATE TABLE `base_data_product_bundle` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `main_product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主商品ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单品ID', + `bundle_num` int(11) NOT NULL COMMENT '包含数量', + `sale_price` decimal(24, 2) NOT NULL COMMENT '销售价', + `retail_price` decimal(24, 2) NOT NULL COMMENT '零售价', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `main_product_id`(`main_product_id`, `product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '组合商品' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_bundle +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_category +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_category`; +CREATE TABLE `base_data_product_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `parent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级ID', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品类目' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_category_property +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_category_property`; +CREATE TABLE `base_data_product_category_property` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `property_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品属性ID', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品类目ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `property_id`(`property_id`, `category_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品类目和商品属性关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_category_property +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_property +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_property`; +CREATE TABLE `base_data_product_property` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `is_required` tinyint(1) NOT NULL COMMENT '是否必填', + `column_type` tinyint(3) NOT NULL COMMENT '录入类型', + `column_data_type` tinyint(3) NULL DEFAULT NULL COMMENT '数据类型', + `property_type` tinyint(3) NOT NULL COMMENT '属性类别', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品属性' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_property +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_property_item +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_property_item`; +CREATE TABLE `base_data_product_property_item` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `property_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '属性ID', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `property_id`(`property_id`, `code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品属性值' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_property_item +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_property_relation +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_property_relation`; +CREATE TABLE `base_data_product_property_relation` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `property_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品属性ID', + `property_item_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值ID', + `property_text` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品属性值', + PRIMARY KEY (`id`) USING BTREE, + INDEX `product_id`(`product_id`, `property_id`, `property_item_id`) USING BTREE, + INDEX `property_id`(`property_id`, `property_item_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品和商品属性关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_property_relation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_purchase +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_purchase`; +CREATE TABLE `base_data_product_purchase` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `price` decimal(24, 2) NOT NULL COMMENT '采购价', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品采购价' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_purchase +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_retail +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_retail`; +CREATE TABLE `base_data_product_retail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `price` decimal(24, 2) NOT NULL COMMENT '零售价', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品零售价' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_retail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_product_sale +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_sale`; +CREATE TABLE `base_data_product_sale` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `price` decimal(24, 2) NOT NULL COMMENT '销售价', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品销售价' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_product_sale +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_store_center +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_store_center`; +CREATE TABLE `base_data_store_center` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `contact` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人手机号码', + `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址', + `people_num` int(11) NULL DEFAULT NULL COMMENT '仓库人数', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '仓库' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_store_center +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_data_supplier +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_supplier`; +CREATE TABLE `base_data_supplier` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `mnemonic_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '助记码', + `contact` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电子邮箱', + `zip_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮编', + `fax` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '传真', + `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址', + `delivery_cycle` int(11) NULL DEFAULT NULL COMMENT '发货周期(天)', + `manage_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '经营方式', + `settle_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '结算方式', + `credit_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '统一社会信用代码', + `tax_identify_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '纳税人识别号', + `bank_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '开户银行', + `account_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '户名', + `account_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '银行账号', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_data_supplier +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_check_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_check_sheet`; +CREATE TABLE `customer_settle_check_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `customer_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `total_pay_amount` decimal(24, 2) NOT NULL COMMENT '应付金额', + `total_payed_amount` decimal(24, 2) NOT NULL COMMENT '已付金额', + `total_discount_amount` decimal(24, 2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `customer_id`(`customer_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户对账单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_check_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_check_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_check_sheet_detail`; +CREATE TABLE `customer_settle_check_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '对账单ID', + `biz_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单据ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `calc_type` tinyint(3) NOT NULL COMMENT '计算类型', + `pay_amount` decimal(24, 2) NOT NULL COMMENT '应付金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `biz_id`) USING BTREE, + INDEX `biz_id`(`biz_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户对账单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_check_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_fee_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_fee_sheet`; +CREATE TABLE `customer_settle_fee_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `customer_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `sheet_type` tinyint(3) NOT NULL COMMENT '单据类型', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `customer_id`(`customer_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户费用单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_fee_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_fee_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_fee_sheet_detail`; +CREATE TABLE `customer_settle_fee_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '费用单ID', + `item_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目ID', + `amount` decimal(24, 2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `item_id`) USING BTREE, + INDEX `item_id`(`item_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户费用单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_fee_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_pre_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_pre_sheet`; +CREATE TABLE `customer_settle_pre_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `customer_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `customer_id`(`customer_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户预付款单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_pre_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_pre_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_pre_sheet_detail`; +CREATE TABLE `customer_settle_pre_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '预付款单ID', + `item_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目ID', + `amount` decimal(24, 2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `item_id`) USING BTREE, + INDEX `item_id`(`item_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户预付款单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_pre_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_sheet`; +CREATE TABLE `customer_settle_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `customer_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `total_discount_amount` decimal(24, 2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `customer_id`(`customer_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户结算单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for customer_settle_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_sheet_detail`; +CREATE TABLE `customer_settle_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '结算单ID', + `biz_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单据ID', + `pay_amount` decimal(24, 2) NOT NULL COMMENT '实付金额', + `discount_amount` decimal(24, 2) NOT NULL COMMENT '优惠金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `biz_id`) USING BTREE, + INDEX `biz_id`(`biz_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户结算单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of customer_settle_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for dic_city +-- ---------------------------- +DROP TABLE IF EXISTS `dic_city`; +CREATE TABLE `dic_city` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `parent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级ID', + `level` int(11) NOT NULL COMMENT '层级', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `parent_id`(`parent_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '地区字典表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of dic_city +-- ---------------------------- +INSERT INTO `dic_city` VALUES ('11', '11', '北京市', NULL, 1); +INSERT INTO `dic_city` VALUES ('1101', '1101', '市辖区', '11', 2); +INSERT INTO `dic_city` VALUES ('110101', '110101', '东城区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110102', '110102', '西城区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110105', '110105', '朝阳区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110106', '110106', '丰台区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110107', '110107', '石景山区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110108', '110108', '海淀区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110109', '110109', '门头沟区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110111', '110111', '房山区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110112', '110112', '通州区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110113', '110113', '顺义区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110114', '110114', '昌平区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110115', '110115', '大兴区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110116', '110116', '怀柔区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110117', '110117', '平谷区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110118', '110118', '密云区', '1101', 3); +INSERT INTO `dic_city` VALUES ('110119', '110119', '延庆区', '1101', 3); +INSERT INTO `dic_city` VALUES ('12', '12', '天津市', NULL, 1); +INSERT INTO `dic_city` VALUES ('1201', '1201', '市辖区', '12', 2); +INSERT INTO `dic_city` VALUES ('120101', '120101', '和平区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120102', '120102', '河东区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120103', '120103', '河西区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120104', '120104', '南开区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120105', '120105', '河北区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120106', '120106', '红桥区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120110', '120110', '东丽区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120111', '120111', '西青区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120112', '120112', '津南区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120113', '120113', '北辰区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120114', '120114', '武清区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120115', '120115', '宝坻区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120116', '120116', '滨海新区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120117', '120117', '宁河区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120118', '120118', '静海区', '1201', 3); +INSERT INTO `dic_city` VALUES ('120119', '120119', '蓟州区', '1201', 3); +INSERT INTO `dic_city` VALUES ('13', '13', '河北省', NULL, 1); +INSERT INTO `dic_city` VALUES ('1301', '1301', '石家庄市', '13', 2); +INSERT INTO `dic_city` VALUES ('130102', '130102', '长安区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130104', '130104', '桥西区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130105', '130105', '新华区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130107', '130107', '井陉矿区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130108', '130108', '裕华区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130109', '130109', '藁城区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130110', '130110', '鹿泉区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130111', '130111', '栾城区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130121', '130121', '井陉县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130123', '130123', '正定县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130125', '130125', '行唐县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130126', '130126', '灵寿县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130127', '130127', '高邑县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130128', '130128', '深泽县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130129', '130129', '赞皇县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130130', '130130', '无极县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130131', '130131', '平山县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130132', '130132', '元氏县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130133', '130133', '赵县', '1301', 3); +INSERT INTO `dic_city` VALUES ('130171', '130171', '石家庄高新技术产业开发区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130172', '130172', '石家庄循环化工园区', '1301', 3); +INSERT INTO `dic_city` VALUES ('130181', '130181', '辛集市', '1301', 3); +INSERT INTO `dic_city` VALUES ('130183', '130183', '晋州市', '1301', 3); +INSERT INTO `dic_city` VALUES ('130184', '130184', '新乐市', '1301', 3); +INSERT INTO `dic_city` VALUES ('1302', '1302', '唐山市', '13', 2); +INSERT INTO `dic_city` VALUES ('130202', '130202', '路南区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130203', '130203', '路北区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130204', '130204', '古冶区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130205', '130205', '开平区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130207', '130207', '丰南区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130208', '130208', '丰润区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130209', '130209', '曹妃甸区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130224', '130224', '滦南县', '1302', 3); +INSERT INTO `dic_city` VALUES ('130225', '130225', '乐亭县', '1302', 3); +INSERT INTO `dic_city` VALUES ('130227', '130227', '迁西县', '1302', 3); +INSERT INTO `dic_city` VALUES ('130229', '130229', '玉田县', '1302', 3); +INSERT INTO `dic_city` VALUES ('130271', '130271', '河北唐山芦台经济开发区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130272', '130272', '唐山市汉沽管理区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130273', '130273', '唐山高新技术产业开发区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130274', '130274', '河北唐山海港经济开发区', '1302', 3); +INSERT INTO `dic_city` VALUES ('130281', '130281', '遵化市', '1302', 3); +INSERT INTO `dic_city` VALUES ('130283', '130283', '迁安市', '1302', 3); +INSERT INTO `dic_city` VALUES ('130284', '130284', '滦州市', '1302', 3); +INSERT INTO `dic_city` VALUES ('1303', '1303', '秦皇岛市', '13', 2); +INSERT INTO `dic_city` VALUES ('130302', '130302', '海港区', '1303', 3); +INSERT INTO `dic_city` VALUES ('130303', '130303', '山海关区', '1303', 3); +INSERT INTO `dic_city` VALUES ('130304', '130304', '北戴河区', '1303', 3); +INSERT INTO `dic_city` VALUES ('130306', '130306', '抚宁区', '1303', 3); +INSERT INTO `dic_city` VALUES ('130321', '130321', '青龙满族自治县', '1303', 3); +INSERT INTO `dic_city` VALUES ('130322', '130322', '昌黎县', '1303', 3); +INSERT INTO `dic_city` VALUES ('130324', '130324', '卢龙县', '1303', 3); +INSERT INTO `dic_city` VALUES ('130371', '130371', '秦皇岛市经济技术开发区', '1303', 3); +INSERT INTO `dic_city` VALUES ('130372', '130372', '北戴河新区', '1303', 3); +INSERT INTO `dic_city` VALUES ('1304', '1304', '邯郸市', '13', 2); +INSERT INTO `dic_city` VALUES ('130402', '130402', '邯山区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130403', '130403', '丛台区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130404', '130404', '复兴区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130406', '130406', '峰峰矿区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130407', '130407', '肥乡区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130408', '130408', '永年区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130423', '130423', '临漳县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130424', '130424', '成安县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130425', '130425', '大名县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130426', '130426', '涉县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130427', '130427', '磁县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130430', '130430', '邱县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130431', '130431', '鸡泽县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130432', '130432', '广平县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130433', '130433', '馆陶县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130434', '130434', '魏县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130435', '130435', '曲周县', '1304', 3); +INSERT INTO `dic_city` VALUES ('130471', '130471', '邯郸经济技术开发区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130473', '130473', '邯郸冀南新区', '1304', 3); +INSERT INTO `dic_city` VALUES ('130481', '130481', '武安市', '1304', 3); +INSERT INTO `dic_city` VALUES ('1305', '1305', '邢台市', '13', 2); +INSERT INTO `dic_city` VALUES ('130502', '130502', '襄都区', '1305', 3); +INSERT INTO `dic_city` VALUES ('130503', '130503', '信都区', '1305', 3); +INSERT INTO `dic_city` VALUES ('130505', '130505', '任泽区', '1305', 3); +INSERT INTO `dic_city` VALUES ('130506', '130506', '南和区', '1305', 3); +INSERT INTO `dic_city` VALUES ('130522', '130522', '临城县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130523', '130523', '内丘县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130524', '130524', '柏乡县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130525', '130525', '隆尧县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130528', '130528', '宁晋县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130529', '130529', '巨鹿县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130530', '130530', '新河县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130531', '130531', '广宗县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130532', '130532', '平乡县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130533', '130533', '威县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130534', '130534', '清河县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130535', '130535', '临西县', '1305', 3); +INSERT INTO `dic_city` VALUES ('130571', '130571', '河北邢台经济开发区', '1305', 3); +INSERT INTO `dic_city` VALUES ('130581', '130581', '南宫市', '1305', 3); +INSERT INTO `dic_city` VALUES ('130582', '130582', '沙河市', '1305', 3); +INSERT INTO `dic_city` VALUES ('1306', '1306', '保定市', '13', 2); +INSERT INTO `dic_city` VALUES ('130602', '130602', '竞秀区', '1306', 3); +INSERT INTO `dic_city` VALUES ('130606', '130606', '莲池区', '1306', 3); +INSERT INTO `dic_city` VALUES ('130607', '130607', '满城区', '1306', 3); +INSERT INTO `dic_city` VALUES ('130608', '130608', '清苑区', '1306', 3); +INSERT INTO `dic_city` VALUES ('130609', '130609', '徐水区', '1306', 3); +INSERT INTO `dic_city` VALUES ('130623', '130623', '涞水县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130624', '130624', '阜平县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130626', '130626', '定兴县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130627', '130627', '唐县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130628', '130628', '高阳县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130629', '130629', '容城县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130630', '130630', '涞源县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130631', '130631', '望都县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130632', '130632', '安新县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130633', '130633', '易县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130634', '130634', '曲阳县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130635', '130635', '蠡县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130636', '130636', '顺平县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130637', '130637', '博野县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130638', '130638', '雄县', '1306', 3); +INSERT INTO `dic_city` VALUES ('130671', '130671', '保定高新技术产业开发区', '1306', 3); +INSERT INTO `dic_city` VALUES ('130672', '130672', '保定白沟新城', '1306', 3); +INSERT INTO `dic_city` VALUES ('130681', '130681', '涿州市', '1306', 3); +INSERT INTO `dic_city` VALUES ('130682', '130682', '定州市', '1306', 3); +INSERT INTO `dic_city` VALUES ('130683', '130683', '安国市', '1306', 3); +INSERT INTO `dic_city` VALUES ('130684', '130684', '高碑店市', '1306', 3); +INSERT INTO `dic_city` VALUES ('1307', '1307', '张家口市', '13', 2); +INSERT INTO `dic_city` VALUES ('130702', '130702', '桥东区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130703', '130703', '桥西区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130705', '130705', '宣化区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130706', '130706', '下花园区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130708', '130708', '万全区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130709', '130709', '崇礼区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130722', '130722', '张北县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130723', '130723', '康保县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130724', '130724', '沽源县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130725', '130725', '尚义县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130726', '130726', '蔚县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130727', '130727', '阳原县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130728', '130728', '怀安县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130730', '130730', '怀来县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130731', '130731', '涿鹿县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130732', '130732', '赤城县', '1307', 3); +INSERT INTO `dic_city` VALUES ('130771', '130771', '张家口经济开发区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130772', '130772', '张家口市察北管理区', '1307', 3); +INSERT INTO `dic_city` VALUES ('130773', '130773', '张家口市塞北管理区', '1307', 3); +INSERT INTO `dic_city` VALUES ('1308', '1308', '承德市', '13', 2); +INSERT INTO `dic_city` VALUES ('130802', '130802', '双桥区', '1308', 3); +INSERT INTO `dic_city` VALUES ('130803', '130803', '双滦区', '1308', 3); +INSERT INTO `dic_city` VALUES ('130804', '130804', '鹰手营子矿区', '1308', 3); +INSERT INTO `dic_city` VALUES ('130821', '130821', '承德县', '1308', 3); +INSERT INTO `dic_city` VALUES ('130822', '130822', '兴隆县', '1308', 3); +INSERT INTO `dic_city` VALUES ('130824', '130824', '滦平县', '1308', 3); +INSERT INTO `dic_city` VALUES ('130825', '130825', '隆化县', '1308', 3); +INSERT INTO `dic_city` VALUES ('130826', '130826', '丰宁满族自治县', '1308', 3); +INSERT INTO `dic_city` VALUES ('130827', '130827', '宽城满族自治县', '1308', 3); +INSERT INTO `dic_city` VALUES ('130828', '130828', '围场满族蒙古族自治县', '1308', 3); +INSERT INTO `dic_city` VALUES ('130871', '130871', '承德高新技术产业开发区', '1308', 3); +INSERT INTO `dic_city` VALUES ('130881', '130881', '平泉市', '1308', 3); +INSERT INTO `dic_city` VALUES ('1309', '1309', '沧州市', '13', 2); +INSERT INTO `dic_city` VALUES ('130902', '130902', '新华区', '1309', 3); +INSERT INTO `dic_city` VALUES ('130903', '130903', '运河区', '1309', 3); +INSERT INTO `dic_city` VALUES ('130921', '130921', '沧县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130922', '130922', '青县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130923', '130923', '东光县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130924', '130924', '海兴县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130925', '130925', '盐山县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130926', '130926', '肃宁县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130927', '130927', '南皮县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130928', '130928', '吴桥县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130929', '130929', '献县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130930', '130930', '孟村回族自治县', '1309', 3); +INSERT INTO `dic_city` VALUES ('130971', '130971', '河北沧州经济开发区', '1309', 3); +INSERT INTO `dic_city` VALUES ('130972', '130972', '沧州高新技术产业开发区', '1309', 3); +INSERT INTO `dic_city` VALUES ('130973', '130973', '沧州渤海新区', '1309', 3); +INSERT INTO `dic_city` VALUES ('130981', '130981', '泊头市', '1309', 3); +INSERT INTO `dic_city` VALUES ('130982', '130982', '任丘市', '1309', 3); +INSERT INTO `dic_city` VALUES ('130983', '130983', '黄骅市', '1309', 3); +INSERT INTO `dic_city` VALUES ('130984', '130984', '河间市', '1309', 3); +INSERT INTO `dic_city` VALUES ('1310', '1310', '廊坊市', '13', 2); +INSERT INTO `dic_city` VALUES ('131002', '131002', '安次区', '1310', 3); +INSERT INTO `dic_city` VALUES ('131003', '131003', '广阳区', '1310', 3); +INSERT INTO `dic_city` VALUES ('131022', '131022', '固安县', '1310', 3); +INSERT INTO `dic_city` VALUES ('131023', '131023', '永清县', '1310', 3); +INSERT INTO `dic_city` VALUES ('131024', '131024', '香河县', '1310', 3); +INSERT INTO `dic_city` VALUES ('131025', '131025', '大城县', '1310', 3); +INSERT INTO `dic_city` VALUES ('131026', '131026', '文安县', '1310', 3); +INSERT INTO `dic_city` VALUES ('131028', '131028', '大厂回族自治县', '1310', 3); +INSERT INTO `dic_city` VALUES ('131071', '131071', '廊坊经济技术开发区', '1310', 3); +INSERT INTO `dic_city` VALUES ('131081', '131081', '霸州市', '1310', 3); +INSERT INTO `dic_city` VALUES ('131082', '131082', '三河市', '1310', 3); +INSERT INTO `dic_city` VALUES ('1311', '1311', '衡水市', '13', 2); +INSERT INTO `dic_city` VALUES ('131102', '131102', '桃城区', '1311', 3); +INSERT INTO `dic_city` VALUES ('131103', '131103', '冀州区', '1311', 3); +INSERT INTO `dic_city` VALUES ('131121', '131121', '枣强县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131122', '131122', '武邑县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131123', '131123', '武强县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131124', '131124', '饶阳县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131125', '131125', '安平县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131126', '131126', '故城县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131127', '131127', '景县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131128', '131128', '阜城县', '1311', 3); +INSERT INTO `dic_city` VALUES ('131171', '131171', '河北衡水高新技术产业开发区', '1311', 3); +INSERT INTO `dic_city` VALUES ('131172', '131172', '衡水滨湖新区', '1311', 3); +INSERT INTO `dic_city` VALUES ('131182', '131182', '深州市', '1311', 3); +INSERT INTO `dic_city` VALUES ('14', '14', '山西省', NULL, 1); +INSERT INTO `dic_city` VALUES ('1401', '1401', '太原市', '14', 2); +INSERT INTO `dic_city` VALUES ('140105', '140105', '小店区', '1401', 3); +INSERT INTO `dic_city` VALUES ('140106', '140106', '迎泽区', '1401', 3); +INSERT INTO `dic_city` VALUES ('140107', '140107', '杏花岭区', '1401', 3); +INSERT INTO `dic_city` VALUES ('140108', '140108', '尖草坪区', '1401', 3); +INSERT INTO `dic_city` VALUES ('140109', '140109', '万柏林区', '1401', 3); +INSERT INTO `dic_city` VALUES ('140110', '140110', '晋源区', '1401', 3); +INSERT INTO `dic_city` VALUES ('140121', '140121', '清徐县', '1401', 3); +INSERT INTO `dic_city` VALUES ('140122', '140122', '阳曲县', '1401', 3); +INSERT INTO `dic_city` VALUES ('140123', '140123', '娄烦县', '1401', 3); +INSERT INTO `dic_city` VALUES ('140171', '140171', '山西转型综合改革示范区', '1401', 3); +INSERT INTO `dic_city` VALUES ('140181', '140181', '古交市', '1401', 3); +INSERT INTO `dic_city` VALUES ('1402', '1402', '大同市', '14', 2); +INSERT INTO `dic_city` VALUES ('140212', '140212', '新荣区', '1402', 3); +INSERT INTO `dic_city` VALUES ('140213', '140213', '平城区', '1402', 3); +INSERT INTO `dic_city` VALUES ('140214', '140214', '云冈区', '1402', 3); +INSERT INTO `dic_city` VALUES ('140215', '140215', '云州区', '1402', 3); +INSERT INTO `dic_city` VALUES ('140221', '140221', '阳高县', '1402', 3); +INSERT INTO `dic_city` VALUES ('140222', '140222', '天镇县', '1402', 3); +INSERT INTO `dic_city` VALUES ('140223', '140223', '广灵县', '1402', 3); +INSERT INTO `dic_city` VALUES ('140224', '140224', '灵丘县', '1402', 3); +INSERT INTO `dic_city` VALUES ('140225', '140225', '浑源县', '1402', 3); +INSERT INTO `dic_city` VALUES ('140226', '140226', '左云县', '1402', 3); +INSERT INTO `dic_city` VALUES ('140271', '140271', '山西大同经济开发区', '1402', 3); +INSERT INTO `dic_city` VALUES ('1403', '1403', '阳泉市', '14', 2); +INSERT INTO `dic_city` VALUES ('140302', '140302', '城区', '1403', 3); +INSERT INTO `dic_city` VALUES ('140303', '140303', '矿区', '1403', 3); +INSERT INTO `dic_city` VALUES ('140311', '140311', '郊区', '1403', 3); +INSERT INTO `dic_city` VALUES ('140321', '140321', '平定县', '1403', 3); +INSERT INTO `dic_city` VALUES ('140322', '140322', '盂县', '1403', 3); +INSERT INTO `dic_city` VALUES ('1404', '1404', '长治市', '14', 2); +INSERT INTO `dic_city` VALUES ('140403', '140403', '潞州区', '1404', 3); +INSERT INTO `dic_city` VALUES ('140404', '140404', '上党区', '1404', 3); +INSERT INTO `dic_city` VALUES ('140405', '140405', '屯留区', '1404', 3); +INSERT INTO `dic_city` VALUES ('140406', '140406', '潞城区', '1404', 3); +INSERT INTO `dic_city` VALUES ('140423', '140423', '襄垣县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140425', '140425', '平顺县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140426', '140426', '黎城县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140427', '140427', '壶关县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140428', '140428', '长子县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140429', '140429', '武乡县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140430', '140430', '沁县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140431', '140431', '沁源县', '1404', 3); +INSERT INTO `dic_city` VALUES ('140471', '140471', '山西长治高新技术产业园区', '1404', 3); +INSERT INTO `dic_city` VALUES ('1405', '1405', '晋城市', '14', 2); +INSERT INTO `dic_city` VALUES ('140502', '140502', '城区', '1405', 3); +INSERT INTO `dic_city` VALUES ('140521', '140521', '沁水县', '1405', 3); +INSERT INTO `dic_city` VALUES ('140522', '140522', '阳城县', '1405', 3); +INSERT INTO `dic_city` VALUES ('140524', '140524', '陵川县', '1405', 3); +INSERT INTO `dic_city` VALUES ('140525', '140525', '泽州县', '1405', 3); +INSERT INTO `dic_city` VALUES ('140581', '140581', '高平市', '1405', 3); +INSERT INTO `dic_city` VALUES ('1406', '1406', '朔州市', '14', 2); +INSERT INTO `dic_city` VALUES ('140602', '140602', '朔城区', '1406', 3); +INSERT INTO `dic_city` VALUES ('140603', '140603', '平鲁区', '1406', 3); +INSERT INTO `dic_city` VALUES ('140621', '140621', '山阴县', '1406', 3); +INSERT INTO `dic_city` VALUES ('140622', '140622', '应县', '1406', 3); +INSERT INTO `dic_city` VALUES ('140623', '140623', '右玉县', '1406', 3); +INSERT INTO `dic_city` VALUES ('140671', '140671', '山西朔州经济开发区', '1406', 3); +INSERT INTO `dic_city` VALUES ('140681', '140681', '怀仁市', '1406', 3); +INSERT INTO `dic_city` VALUES ('1407', '1407', '晋中市', '14', 2); +INSERT INTO `dic_city` VALUES ('140702', '140702', '榆次区', '1407', 3); +INSERT INTO `dic_city` VALUES ('140703', '140703', '太谷区', '1407', 3); +INSERT INTO `dic_city` VALUES ('140721', '140721', '榆社县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140722', '140722', '左权县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140723', '140723', '和顺县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140724', '140724', '昔阳县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140725', '140725', '寿阳县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140727', '140727', '祁县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140728', '140728', '平遥县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140729', '140729', '灵石县', '1407', 3); +INSERT INTO `dic_city` VALUES ('140781', '140781', '介休市', '1407', 3); +INSERT INTO `dic_city` VALUES ('1408', '1408', '运城市', '14', 2); +INSERT INTO `dic_city` VALUES ('140802', '140802', '盐湖区', '1408', 3); +INSERT INTO `dic_city` VALUES ('140821', '140821', '临猗县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140822', '140822', '万荣县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140823', '140823', '闻喜县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140824', '140824', '稷山县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140825', '140825', '新绛县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140826', '140826', '绛县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140827', '140827', '垣曲县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140828', '140828', '夏县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140829', '140829', '平陆县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140830', '140830', '芮城县', '1408', 3); +INSERT INTO `dic_city` VALUES ('140881', '140881', '永济市', '1408', 3); +INSERT INTO `dic_city` VALUES ('140882', '140882', '河津市', '1408', 3); +INSERT INTO `dic_city` VALUES ('1409', '1409', '忻州市', '14', 2); +INSERT INTO `dic_city` VALUES ('140902', '140902', '忻府区', '1409', 3); +INSERT INTO `dic_city` VALUES ('140921', '140921', '定襄县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140922', '140922', '五台县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140923', '140923', '代县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140924', '140924', '繁峙县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140925', '140925', '宁武县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140926', '140926', '静乐县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140927', '140927', '神池县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140928', '140928', '五寨县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140929', '140929', '岢岚县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140930', '140930', '河曲县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140931', '140931', '保德县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140932', '140932', '偏关县', '1409', 3); +INSERT INTO `dic_city` VALUES ('140971', '140971', '五台山风景名胜区', '1409', 3); +INSERT INTO `dic_city` VALUES ('140981', '140981', '原平市', '1409', 3); +INSERT INTO `dic_city` VALUES ('1410', '1410', '临汾市', '14', 2); +INSERT INTO `dic_city` VALUES ('141002', '141002', '尧都区', '1410', 3); +INSERT INTO `dic_city` VALUES ('141021', '141021', '曲沃县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141022', '141022', '翼城县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141023', '141023', '襄汾县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141024', '141024', '洪洞县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141025', '141025', '古县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141026', '141026', '安泽县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141027', '141027', '浮山县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141028', '141028', '吉县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141029', '141029', '乡宁县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141030', '141030', '大宁县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141031', '141031', '隰县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141032', '141032', '永和县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141033', '141033', '蒲县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141034', '141034', '汾西县', '1410', 3); +INSERT INTO `dic_city` VALUES ('141081', '141081', '侯马市', '1410', 3); +INSERT INTO `dic_city` VALUES ('141082', '141082', '霍州市', '1410', 3); +INSERT INTO `dic_city` VALUES ('1411', '1411', '吕梁市', '14', 2); +INSERT INTO `dic_city` VALUES ('141102', '141102', '离石区', '1411', 3); +INSERT INTO `dic_city` VALUES ('141121', '141121', '文水县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141122', '141122', '交城县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141123', '141123', '兴县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141124', '141124', '临县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141125', '141125', '柳林县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141126', '141126', '石楼县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141127', '141127', '岚县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141128', '141128', '方山县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141129', '141129', '中阳县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141130', '141130', '交口县', '1411', 3); +INSERT INTO `dic_city` VALUES ('141181', '141181', '孝义市', '1411', 3); +INSERT INTO `dic_city` VALUES ('141182', '141182', '汾阳市', '1411', 3); +INSERT INTO `dic_city` VALUES ('15', '15', '内蒙古自治区', NULL, 1); +INSERT INTO `dic_city` VALUES ('1501', '1501', '呼和浩特市', '15', 2); +INSERT INTO `dic_city` VALUES ('150102', '150102', '新城区', '1501', 3); +INSERT INTO `dic_city` VALUES ('150103', '150103', '回民区', '1501', 3); +INSERT INTO `dic_city` VALUES ('150104', '150104', '玉泉区', '1501', 3); +INSERT INTO `dic_city` VALUES ('150105', '150105', '赛罕区', '1501', 3); +INSERT INTO `dic_city` VALUES ('150121', '150121', '土默特左旗', '1501', 3); +INSERT INTO `dic_city` VALUES ('150122', '150122', '托克托县', '1501', 3); +INSERT INTO `dic_city` VALUES ('150123', '150123', '和林格尔县', '1501', 3); +INSERT INTO `dic_city` VALUES ('150124', '150124', '清水河县', '1501', 3); +INSERT INTO `dic_city` VALUES ('150125', '150125', '武川县', '1501', 3); +INSERT INTO `dic_city` VALUES ('150172', '150172', '呼和浩特经济技术开发区', '1501', 3); +INSERT INTO `dic_city` VALUES ('1502', '1502', '包头市', '15', 2); +INSERT INTO `dic_city` VALUES ('150202', '150202', '东河区', '1502', 3); +INSERT INTO `dic_city` VALUES ('150203', '150203', '昆都仑区', '1502', 3); +INSERT INTO `dic_city` VALUES ('150204', '150204', '青山区', '1502', 3); +INSERT INTO `dic_city` VALUES ('150205', '150205', '石拐区', '1502', 3); +INSERT INTO `dic_city` VALUES ('150206', '150206', '白云鄂博矿区', '1502', 3); +INSERT INTO `dic_city` VALUES ('150207', '150207', '九原区', '1502', 3); +INSERT INTO `dic_city` VALUES ('150221', '150221', '土默特右旗', '1502', 3); +INSERT INTO `dic_city` VALUES ('150222', '150222', '固阳县', '1502', 3); +INSERT INTO `dic_city` VALUES ('150223', '150223', '达尔罕茂明安联合旗', '1502', 3); +INSERT INTO `dic_city` VALUES ('150271', '150271', '包头稀土高新技术产业开发区', '1502', 3); +INSERT INTO `dic_city` VALUES ('1503', '1503', '乌海市', '15', 2); +INSERT INTO `dic_city` VALUES ('150302', '150302', '海勃湾区', '1503', 3); +INSERT INTO `dic_city` VALUES ('150303', '150303', '海南区', '1503', 3); +INSERT INTO `dic_city` VALUES ('150304', '150304', '乌达区', '1503', 3); +INSERT INTO `dic_city` VALUES ('1504', '1504', '赤峰市', '15', 2); +INSERT INTO `dic_city` VALUES ('150402', '150402', '红山区', '1504', 3); +INSERT INTO `dic_city` VALUES ('150403', '150403', '元宝山区', '1504', 3); +INSERT INTO `dic_city` VALUES ('150404', '150404', '松山区', '1504', 3); +INSERT INTO `dic_city` VALUES ('150421', '150421', '阿鲁科尔沁旗', '1504', 3); +INSERT INTO `dic_city` VALUES ('150422', '150422', '巴林左旗', '1504', 3); +INSERT INTO `dic_city` VALUES ('150423', '150423', '巴林右旗', '1504', 3); +INSERT INTO `dic_city` VALUES ('150424', '150424', '林西县', '1504', 3); +INSERT INTO `dic_city` VALUES ('150425', '150425', '克什克腾旗', '1504', 3); +INSERT INTO `dic_city` VALUES ('150426', '150426', '翁牛特旗', '1504', 3); +INSERT INTO `dic_city` VALUES ('150428', '150428', '喀喇沁旗', '1504', 3); +INSERT INTO `dic_city` VALUES ('150429', '150429', '宁城县', '1504', 3); +INSERT INTO `dic_city` VALUES ('150430', '150430', '敖汉旗', '1504', 3); +INSERT INTO `dic_city` VALUES ('1505', '1505', '通辽市', '15', 2); +INSERT INTO `dic_city` VALUES ('150502', '150502', '科尔沁区', '1505', 3); +INSERT INTO `dic_city` VALUES ('150521', '150521', '科尔沁左翼中旗', '1505', 3); +INSERT INTO `dic_city` VALUES ('150522', '150522', '科尔沁左翼后旗', '1505', 3); +INSERT INTO `dic_city` VALUES ('150523', '150523', '开鲁县', '1505', 3); +INSERT INTO `dic_city` VALUES ('150524', '150524', '库伦旗', '1505', 3); +INSERT INTO `dic_city` VALUES ('150525', '150525', '奈曼旗', '1505', 3); +INSERT INTO `dic_city` VALUES ('150526', '150526', '扎鲁特旗', '1505', 3); +INSERT INTO `dic_city` VALUES ('150571', '150571', '通辽经济技术开发区', '1505', 3); +INSERT INTO `dic_city` VALUES ('150581', '150581', '霍林郭勒市', '1505', 3); +INSERT INTO `dic_city` VALUES ('1506', '1506', '鄂尔多斯市', '15', 2); +INSERT INTO `dic_city` VALUES ('150602', '150602', '东胜区', '1506', 3); +INSERT INTO `dic_city` VALUES ('150603', '150603', '康巴什区', '1506', 3); +INSERT INTO `dic_city` VALUES ('150621', '150621', '达拉特旗', '1506', 3); +INSERT INTO `dic_city` VALUES ('150622', '150622', '准格尔旗', '1506', 3); +INSERT INTO `dic_city` VALUES ('150623', '150623', '鄂托克前旗', '1506', 3); +INSERT INTO `dic_city` VALUES ('150624', '150624', '鄂托克旗', '1506', 3); +INSERT INTO `dic_city` VALUES ('150625', '150625', '杭锦旗', '1506', 3); +INSERT INTO `dic_city` VALUES ('150626', '150626', '乌审旗', '1506', 3); +INSERT INTO `dic_city` VALUES ('150627', '150627', '伊金霍洛旗', '1506', 3); +INSERT INTO `dic_city` VALUES ('1507', '1507', '呼伦贝尔市', '15', 2); +INSERT INTO `dic_city` VALUES ('150702', '150702', '海拉尔区', '1507', 3); +INSERT INTO `dic_city` VALUES ('150703', '150703', '扎赉诺尔区', '1507', 3); +INSERT INTO `dic_city` VALUES ('150721', '150721', '阿荣旗', '1507', 3); +INSERT INTO `dic_city` VALUES ('150722', '150722', '莫力达瓦达斡尔族自治旗', '1507', 3); +INSERT INTO `dic_city` VALUES ('150723', '150723', '鄂伦春自治旗', '1507', 3); +INSERT INTO `dic_city` VALUES ('150724', '150724', '鄂温克族自治旗', '1507', 3); +INSERT INTO `dic_city` VALUES ('150725', '150725', '陈巴尔虎旗', '1507', 3); +INSERT INTO `dic_city` VALUES ('150726', '150726', '新巴尔虎左旗', '1507', 3); +INSERT INTO `dic_city` VALUES ('150727', '150727', '新巴尔虎右旗', '1507', 3); +INSERT INTO `dic_city` VALUES ('150781', '150781', '满洲里市', '1507', 3); +INSERT INTO `dic_city` VALUES ('150782', '150782', '牙克石市', '1507', 3); +INSERT INTO `dic_city` VALUES ('150783', '150783', '扎兰屯市', '1507', 3); +INSERT INTO `dic_city` VALUES ('150784', '150784', '额尔古纳市', '1507', 3); +INSERT INTO `dic_city` VALUES ('150785', '150785', '根河市', '1507', 3); +INSERT INTO `dic_city` VALUES ('1508', '1508', '巴彦淖尔市', '15', 2); +INSERT INTO `dic_city` VALUES ('150802', '150802', '临河区', '1508', 3); +INSERT INTO `dic_city` VALUES ('150821', '150821', '五原县', '1508', 3); +INSERT INTO `dic_city` VALUES ('150822', '150822', '磴口县', '1508', 3); +INSERT INTO `dic_city` VALUES ('150823', '150823', '乌拉特前旗', '1508', 3); +INSERT INTO `dic_city` VALUES ('150824', '150824', '乌拉特中旗', '1508', 3); +INSERT INTO `dic_city` VALUES ('150825', '150825', '乌拉特后旗', '1508', 3); +INSERT INTO `dic_city` VALUES ('150826', '150826', '杭锦后旗', '1508', 3); +INSERT INTO `dic_city` VALUES ('1509', '1509', '乌兰察布市', '15', 2); +INSERT INTO `dic_city` VALUES ('150902', '150902', '集宁区', '1509', 3); +INSERT INTO `dic_city` VALUES ('150921', '150921', '卓资县', '1509', 3); +INSERT INTO `dic_city` VALUES ('150922', '150922', '化德县', '1509', 3); +INSERT INTO `dic_city` VALUES ('150923', '150923', '商都县', '1509', 3); +INSERT INTO `dic_city` VALUES ('150924', '150924', '兴和县', '1509', 3); +INSERT INTO `dic_city` VALUES ('150925', '150925', '凉城县', '1509', 3); +INSERT INTO `dic_city` VALUES ('150926', '150926', '察哈尔右翼前旗', '1509', 3); +INSERT INTO `dic_city` VALUES ('150927', '150927', '察哈尔右翼中旗', '1509', 3); +INSERT INTO `dic_city` VALUES ('150928', '150928', '察哈尔右翼后旗', '1509', 3); +INSERT INTO `dic_city` VALUES ('150929', '150929', '四子王旗', '1509', 3); +INSERT INTO `dic_city` VALUES ('150981', '150981', '丰镇市', '1509', 3); +INSERT INTO `dic_city` VALUES ('1522', '1522', '兴安盟', '15', 2); +INSERT INTO `dic_city` VALUES ('152201', '152201', '乌兰浩特市', '1522', 3); +INSERT INTO `dic_city` VALUES ('152202', '152202', '阿尔山市', '1522', 3); +INSERT INTO `dic_city` VALUES ('152221', '152221', '科尔沁右翼前旗', '1522', 3); +INSERT INTO `dic_city` VALUES ('152222', '152222', '科尔沁右翼中旗', '1522', 3); +INSERT INTO `dic_city` VALUES ('152223', '152223', '扎赉特旗', '1522', 3); +INSERT INTO `dic_city` VALUES ('152224', '152224', '突泉县', '1522', 3); +INSERT INTO `dic_city` VALUES ('1525', '1525', '锡林郭勒盟', '15', 2); +INSERT INTO `dic_city` VALUES ('152501', '152501', '二连浩特市', '1525', 3); +INSERT INTO `dic_city` VALUES ('152502', '152502', '锡林浩特市', '1525', 3); +INSERT INTO `dic_city` VALUES ('152522', '152522', '阿巴嘎旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152523', '152523', '苏尼特左旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152524', '152524', '苏尼特右旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152525', '152525', '东乌珠穆沁旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152526', '152526', '西乌珠穆沁旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152527', '152527', '太仆寺旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152528', '152528', '镶黄旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152529', '152529', '正镶白旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152530', '152530', '正蓝旗', '1525', 3); +INSERT INTO `dic_city` VALUES ('152531', '152531', '多伦县', '1525', 3); +INSERT INTO `dic_city` VALUES ('152571', '152571', '乌拉盖管委会', '1525', 3); +INSERT INTO `dic_city` VALUES ('1529', '1529', '阿拉善盟', '15', 2); +INSERT INTO `dic_city` VALUES ('152921', '152921', '阿拉善左旗', '1529', 3); +INSERT INTO `dic_city` VALUES ('152922', '152922', '阿拉善右旗', '1529', 3); +INSERT INTO `dic_city` VALUES ('152923', '152923', '额济纳旗', '1529', 3); +INSERT INTO `dic_city` VALUES ('152971', '152971', '内蒙古阿拉善经济开发区', '1529', 3); +INSERT INTO `dic_city` VALUES ('21', '21', '辽宁省', NULL, 1); +INSERT INTO `dic_city` VALUES ('2101', '2101', '沈阳市', '21', 2); +INSERT INTO `dic_city` VALUES ('210102', '210102', '和平区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210103', '210103', '沈河区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210104', '210104', '大东区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210105', '210105', '皇姑区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210106', '210106', '铁西区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210111', '210111', '苏家屯区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210112', '210112', '浑南区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210113', '210113', '沈北新区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210114', '210114', '于洪区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210115', '210115', '辽中区', '2101', 3); +INSERT INTO `dic_city` VALUES ('210123', '210123', '康平县', '2101', 3); +INSERT INTO `dic_city` VALUES ('210124', '210124', '法库县', '2101', 3); +INSERT INTO `dic_city` VALUES ('210181', '210181', '新民市', '2101', 3); +INSERT INTO `dic_city` VALUES ('2102', '2102', '大连市', '21', 2); +INSERT INTO `dic_city` VALUES ('210202', '210202', '中山区', '2102', 3); +INSERT INTO `dic_city` VALUES ('210203', '210203', '西岗区', '2102', 3); +INSERT INTO `dic_city` VALUES ('210204', '210204', '沙河口区', '2102', 3); +INSERT INTO `dic_city` VALUES ('210211', '210211', '甘井子区', '2102', 3); +INSERT INTO `dic_city` VALUES ('210212', '210212', '旅顺口区', '2102', 3); +INSERT INTO `dic_city` VALUES ('210213', '210213', '金州区', '2102', 3); +INSERT INTO `dic_city` VALUES ('210214', '210214', '普兰店区', '2102', 3); +INSERT INTO `dic_city` VALUES ('210224', '210224', '长海县', '2102', 3); +INSERT INTO `dic_city` VALUES ('210281', '210281', '瓦房店市', '2102', 3); +INSERT INTO `dic_city` VALUES ('210283', '210283', '庄河市', '2102', 3); +INSERT INTO `dic_city` VALUES ('2103', '2103', '鞍山市', '21', 2); +INSERT INTO `dic_city` VALUES ('210302', '210302', '铁东区', '2103', 3); +INSERT INTO `dic_city` VALUES ('210303', '210303', '铁西区', '2103', 3); +INSERT INTO `dic_city` VALUES ('210304', '210304', '立山区', '2103', 3); +INSERT INTO `dic_city` VALUES ('210311', '210311', '千山区', '2103', 3); +INSERT INTO `dic_city` VALUES ('210321', '210321', '台安县', '2103', 3); +INSERT INTO `dic_city` VALUES ('210323', '210323', '岫岩满族自治县', '2103', 3); +INSERT INTO `dic_city` VALUES ('210381', '210381', '海城市', '2103', 3); +INSERT INTO `dic_city` VALUES ('2104', '2104', '抚顺市', '21', 2); +INSERT INTO `dic_city` VALUES ('210402', '210402', '新抚区', '2104', 3); +INSERT INTO `dic_city` VALUES ('210403', '210403', '东洲区', '2104', 3); +INSERT INTO `dic_city` VALUES ('210404', '210404', '望花区', '2104', 3); +INSERT INTO `dic_city` VALUES ('210411', '210411', '顺城区', '2104', 3); +INSERT INTO `dic_city` VALUES ('210421', '210421', '抚顺县', '2104', 3); +INSERT INTO `dic_city` VALUES ('210422', '210422', '新宾满族自治县', '2104', 3); +INSERT INTO `dic_city` VALUES ('210423', '210423', '清原满族自治县', '2104', 3); +INSERT INTO `dic_city` VALUES ('2105', '2105', '本溪市', '21', 2); +INSERT INTO `dic_city` VALUES ('210502', '210502', '平山区', '2105', 3); +INSERT INTO `dic_city` VALUES ('210503', '210503', '溪湖区', '2105', 3); +INSERT INTO `dic_city` VALUES ('210504', '210504', '明山区', '2105', 3); +INSERT INTO `dic_city` VALUES ('210505', '210505', '南芬区', '2105', 3); +INSERT INTO `dic_city` VALUES ('210521', '210521', '本溪满族自治县', '2105', 3); +INSERT INTO `dic_city` VALUES ('210522', '210522', '桓仁满族自治县', '2105', 3); +INSERT INTO `dic_city` VALUES ('2106', '2106', '丹东市', '21', 2); +INSERT INTO `dic_city` VALUES ('210602', '210602', '元宝区', '2106', 3); +INSERT INTO `dic_city` VALUES ('210603', '210603', '振兴区', '2106', 3); +INSERT INTO `dic_city` VALUES ('210604', '210604', '振安区', '2106', 3); +INSERT INTO `dic_city` VALUES ('210624', '210624', '宽甸满族自治县', '2106', 3); +INSERT INTO `dic_city` VALUES ('210681', '210681', '东港市', '2106', 3); +INSERT INTO `dic_city` VALUES ('210682', '210682', '凤城市', '2106', 3); +INSERT INTO `dic_city` VALUES ('2107', '2107', '锦州市', '21', 2); +INSERT INTO `dic_city` VALUES ('210702', '210702', '古塔区', '2107', 3); +INSERT INTO `dic_city` VALUES ('210703', '210703', '凌河区', '2107', 3); +INSERT INTO `dic_city` VALUES ('210711', '210711', '太和区', '2107', 3); +INSERT INTO `dic_city` VALUES ('210726', '210726', '黑山县', '2107', 3); +INSERT INTO `dic_city` VALUES ('210727', '210727', '义县', '2107', 3); +INSERT INTO `dic_city` VALUES ('210781', '210781', '凌海市', '2107', 3); +INSERT INTO `dic_city` VALUES ('210782', '210782', '北镇市', '2107', 3); +INSERT INTO `dic_city` VALUES ('2108', '2108', '营口市', '21', 2); +INSERT INTO `dic_city` VALUES ('210802', '210802', '站前区', '2108', 3); +INSERT INTO `dic_city` VALUES ('210803', '210803', '西市区', '2108', 3); +INSERT INTO `dic_city` VALUES ('210804', '210804', '鲅鱼圈区', '2108', 3); +INSERT INTO `dic_city` VALUES ('210811', '210811', '老边区', '2108', 3); +INSERT INTO `dic_city` VALUES ('210881', '210881', '盖州市', '2108', 3); +INSERT INTO `dic_city` VALUES ('210882', '210882', '大石桥市', '2108', 3); +INSERT INTO `dic_city` VALUES ('2109', '2109', '阜新市', '21', 2); +INSERT INTO `dic_city` VALUES ('210902', '210902', '海州区', '2109', 3); +INSERT INTO `dic_city` VALUES ('210903', '210903', '新邱区', '2109', 3); +INSERT INTO `dic_city` VALUES ('210904', '210904', '太平区', '2109', 3); +INSERT INTO `dic_city` VALUES ('210905', '210905', '清河门区', '2109', 3); +INSERT INTO `dic_city` VALUES ('210911', '210911', '细河区', '2109', 3); +INSERT INTO `dic_city` VALUES ('210921', '210921', '阜新蒙古族自治县', '2109', 3); +INSERT INTO `dic_city` VALUES ('210922', '210922', '彰武县', '2109', 3); +INSERT INTO `dic_city` VALUES ('2110', '2110', '辽阳市', '21', 2); +INSERT INTO `dic_city` VALUES ('211002', '211002', '白塔区', '2110', 3); +INSERT INTO `dic_city` VALUES ('211003', '211003', '文圣区', '2110', 3); +INSERT INTO `dic_city` VALUES ('211004', '211004', '宏伟区', '2110', 3); +INSERT INTO `dic_city` VALUES ('211005', '211005', '弓长岭区', '2110', 3); +INSERT INTO `dic_city` VALUES ('211011', '211011', '太子河区', '2110', 3); +INSERT INTO `dic_city` VALUES ('211021', '211021', '辽阳县', '2110', 3); +INSERT INTO `dic_city` VALUES ('211081', '211081', '灯塔市', '2110', 3); +INSERT INTO `dic_city` VALUES ('2111', '2111', '盘锦市', '21', 2); +INSERT INTO `dic_city` VALUES ('211102', '211102', '双台子区', '2111', 3); +INSERT INTO `dic_city` VALUES ('211103', '211103', '兴隆台区', '2111', 3); +INSERT INTO `dic_city` VALUES ('211104', '211104', '大洼区', '2111', 3); +INSERT INTO `dic_city` VALUES ('211122', '211122', '盘山县', '2111', 3); +INSERT INTO `dic_city` VALUES ('2112', '2112', '铁岭市', '21', 2); +INSERT INTO `dic_city` VALUES ('211202', '211202', '银州区', '2112', 3); +INSERT INTO `dic_city` VALUES ('211204', '211204', '清河区', '2112', 3); +INSERT INTO `dic_city` VALUES ('211221', '211221', '铁岭县', '2112', 3); +INSERT INTO `dic_city` VALUES ('211223', '211223', '西丰县', '2112', 3); +INSERT INTO `dic_city` VALUES ('211224', '211224', '昌图县', '2112', 3); +INSERT INTO `dic_city` VALUES ('211281', '211281', '调兵山市', '2112', 3); +INSERT INTO `dic_city` VALUES ('211282', '211282', '开原市', '2112', 3); +INSERT INTO `dic_city` VALUES ('2113', '2113', '朝阳市', '21', 2); +INSERT INTO `dic_city` VALUES ('211302', '211302', '双塔区', '2113', 3); +INSERT INTO `dic_city` VALUES ('211303', '211303', '龙城区', '2113', 3); +INSERT INTO `dic_city` VALUES ('211321', '211321', '朝阳县', '2113', 3); +INSERT INTO `dic_city` VALUES ('211322', '211322', '建平县', '2113', 3); +INSERT INTO `dic_city` VALUES ('211324', '211324', '喀喇沁左翼蒙古族自治县', '2113', 3); +INSERT INTO `dic_city` VALUES ('211381', '211381', '北票市', '2113', 3); +INSERT INTO `dic_city` VALUES ('211382', '211382', '凌源市', '2113', 3); +INSERT INTO `dic_city` VALUES ('2114', '2114', '葫芦岛市', '21', 2); +INSERT INTO `dic_city` VALUES ('211402', '211402', '连山区', '2114', 3); +INSERT INTO `dic_city` VALUES ('211403', '211403', '龙港区', '2114', 3); +INSERT INTO `dic_city` VALUES ('211404', '211404', '南票区', '2114', 3); +INSERT INTO `dic_city` VALUES ('211421', '211421', '绥中县', '2114', 3); +INSERT INTO `dic_city` VALUES ('211422', '211422', '建昌县', '2114', 3); +INSERT INTO `dic_city` VALUES ('211481', '211481', '兴城市', '2114', 3); +INSERT INTO `dic_city` VALUES ('22', '22', '吉林省', NULL, 1); +INSERT INTO `dic_city` VALUES ('2201', '2201', '长春市', '22', 2); +INSERT INTO `dic_city` VALUES ('220102', '220102', '南关区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220103', '220103', '宽城区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220104', '220104', '朝阳区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220105', '220105', '二道区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220106', '220106', '绿园区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220112', '220112', '双阳区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220113', '220113', '九台区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220122', '220122', '农安县', '2201', 3); +INSERT INTO `dic_city` VALUES ('220171', '220171', '长春经济技术开发区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220172', '220172', '长春净月高新技术产业开发区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220173', '220173', '长春高新技术产业开发区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220174', '220174', '长春汽车经济技术开发区', '2201', 3); +INSERT INTO `dic_city` VALUES ('220182', '220182', '榆树市', '2201', 3); +INSERT INTO `dic_city` VALUES ('220183', '220183', '德惠市', '2201', 3); +INSERT INTO `dic_city` VALUES ('220184', '220184', '公主岭市', '2201', 3); +INSERT INTO `dic_city` VALUES ('2202', '2202', '吉林市', '22', 2); +INSERT INTO `dic_city` VALUES ('220202', '220202', '昌邑区', '2202', 3); +INSERT INTO `dic_city` VALUES ('220203', '220203', '龙潭区', '2202', 3); +INSERT INTO `dic_city` VALUES ('220204', '220204', '船营区', '2202', 3); +INSERT INTO `dic_city` VALUES ('220211', '220211', '丰满区', '2202', 3); +INSERT INTO `dic_city` VALUES ('220221', '220221', '永吉县', '2202', 3); +INSERT INTO `dic_city` VALUES ('220271', '220271', '吉林经济开发区', '2202', 3); +INSERT INTO `dic_city` VALUES ('220272', '220272', '吉林高新技术产业开发区', '2202', 3); +INSERT INTO `dic_city` VALUES ('220273', '220273', '吉林中国新加坡食品区', '2202', 3); +INSERT INTO `dic_city` VALUES ('220281', '220281', '蛟河市', '2202', 3); +INSERT INTO `dic_city` VALUES ('220282', '220282', '桦甸市', '2202', 3); +INSERT INTO `dic_city` VALUES ('220283', '220283', '舒兰市', '2202', 3); +INSERT INTO `dic_city` VALUES ('220284', '220284', '磐石市', '2202', 3); +INSERT INTO `dic_city` VALUES ('2203', '2203', '四平市', '22', 2); +INSERT INTO `dic_city` VALUES ('220302', '220302', '铁西区', '2203', 3); +INSERT INTO `dic_city` VALUES ('220303', '220303', '铁东区', '2203', 3); +INSERT INTO `dic_city` VALUES ('220322', '220322', '梨树县', '2203', 3); +INSERT INTO `dic_city` VALUES ('220323', '220323', '伊通满族自治县', '2203', 3); +INSERT INTO `dic_city` VALUES ('220382', '220382', '双辽市', '2203', 3); +INSERT INTO `dic_city` VALUES ('2204', '2204', '辽源市', '22', 2); +INSERT INTO `dic_city` VALUES ('220402', '220402', '龙山区', '2204', 3); +INSERT INTO `dic_city` VALUES ('220403', '220403', '西安区', '2204', 3); +INSERT INTO `dic_city` VALUES ('220421', '220421', '东丰县', '2204', 3); +INSERT INTO `dic_city` VALUES ('220422', '220422', '东辽县', '2204', 3); +INSERT INTO `dic_city` VALUES ('2205', '2205', '通化市', '22', 2); +INSERT INTO `dic_city` VALUES ('220502', '220502', '东昌区', '2205', 3); +INSERT INTO `dic_city` VALUES ('220503', '220503', '二道江区', '2205', 3); +INSERT INTO `dic_city` VALUES ('220521', '220521', '通化县', '2205', 3); +INSERT INTO `dic_city` VALUES ('220523', '220523', '辉南县', '2205', 3); +INSERT INTO `dic_city` VALUES ('220524', '220524', '柳河县', '2205', 3); +INSERT INTO `dic_city` VALUES ('220581', '220581', '梅河口市', '2205', 3); +INSERT INTO `dic_city` VALUES ('220582', '220582', '集安市', '2205', 3); +INSERT INTO `dic_city` VALUES ('2206', '2206', '白山市', '22', 2); +INSERT INTO `dic_city` VALUES ('220602', '220602', '浑江区', '2206', 3); +INSERT INTO `dic_city` VALUES ('220605', '220605', '江源区', '2206', 3); +INSERT INTO `dic_city` VALUES ('220621', '220621', '抚松县', '2206', 3); +INSERT INTO `dic_city` VALUES ('220622', '220622', '靖宇县', '2206', 3); +INSERT INTO `dic_city` VALUES ('220623', '220623', '长白朝鲜族自治县', '2206', 3); +INSERT INTO `dic_city` VALUES ('220681', '220681', '临江市', '2206', 3); +INSERT INTO `dic_city` VALUES ('2207', '2207', '松原市', '22', 2); +INSERT INTO `dic_city` VALUES ('220702', '220702', '宁江区', '2207', 3); +INSERT INTO `dic_city` VALUES ('220721', '220721', '前郭尔罗斯蒙古族自治县', '2207', 3); +INSERT INTO `dic_city` VALUES ('220722', '220722', '长岭县', '2207', 3); +INSERT INTO `dic_city` VALUES ('220723', '220723', '乾安县', '2207', 3); +INSERT INTO `dic_city` VALUES ('220771', '220771', '吉林松原经济开发区', '2207', 3); +INSERT INTO `dic_city` VALUES ('220781', '220781', '扶余市', '2207', 3); +INSERT INTO `dic_city` VALUES ('2208', '2208', '白城市', '22', 2); +INSERT INTO `dic_city` VALUES ('220802', '220802', '洮北区', '2208', 3); +INSERT INTO `dic_city` VALUES ('220821', '220821', '镇赉县', '2208', 3); +INSERT INTO `dic_city` VALUES ('220822', '220822', '通榆县', '2208', 3); +INSERT INTO `dic_city` VALUES ('220871', '220871', '吉林白城经济开发区', '2208', 3); +INSERT INTO `dic_city` VALUES ('220881', '220881', '洮南市', '2208', 3); +INSERT INTO `dic_city` VALUES ('220882', '220882', '大安市', '2208', 3); +INSERT INTO `dic_city` VALUES ('2224', '2224', '延边朝鲜族自治州', '22', 2); +INSERT INTO `dic_city` VALUES ('222401', '222401', '延吉市', '2224', 3); +INSERT INTO `dic_city` VALUES ('222402', '222402', '图们市', '2224', 3); +INSERT INTO `dic_city` VALUES ('222403', '222403', '敦化市', '2224', 3); +INSERT INTO `dic_city` VALUES ('222404', '222404', '珲春市', '2224', 3); +INSERT INTO `dic_city` VALUES ('222405', '222405', '龙井市', '2224', 3); +INSERT INTO `dic_city` VALUES ('222406', '222406', '和龙市', '2224', 3); +INSERT INTO `dic_city` VALUES ('222424', '222424', '汪清县', '2224', 3); +INSERT INTO `dic_city` VALUES ('222426', '222426', '安图县', '2224', 3); +INSERT INTO `dic_city` VALUES ('23', '23', '黑龙江省', NULL, 1); +INSERT INTO `dic_city` VALUES ('2301', '2301', '哈尔滨市', '23', 2); +INSERT INTO `dic_city` VALUES ('230102', '230102', '道里区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230103', '230103', '南岗区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230104', '230104', '道外区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230108', '230108', '平房区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230109', '230109', '松北区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230110', '230110', '香坊区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230111', '230111', '呼兰区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230112', '230112', '阿城区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230113', '230113', '双城区', '2301', 3); +INSERT INTO `dic_city` VALUES ('230123', '230123', '依兰县', '2301', 3); +INSERT INTO `dic_city` VALUES ('230124', '230124', '方正县', '2301', 3); +INSERT INTO `dic_city` VALUES ('230125', '230125', '宾县', '2301', 3); +INSERT INTO `dic_city` VALUES ('230126', '230126', '巴彦县', '2301', 3); +INSERT INTO `dic_city` VALUES ('230127', '230127', '木兰县', '2301', 3); +INSERT INTO `dic_city` VALUES ('230128', '230128', '通河县', '2301', 3); +INSERT INTO `dic_city` VALUES ('230129', '230129', '延寿县', '2301', 3); +INSERT INTO `dic_city` VALUES ('230183', '230183', '尚志市', '2301', 3); +INSERT INTO `dic_city` VALUES ('230184', '230184', '五常市', '2301', 3); +INSERT INTO `dic_city` VALUES ('2302', '2302', '齐齐哈尔市', '23', 2); +INSERT INTO `dic_city` VALUES ('230202', '230202', '龙沙区', '2302', 3); +INSERT INTO `dic_city` VALUES ('230203', '230203', '建华区', '2302', 3); +INSERT INTO `dic_city` VALUES ('230204', '230204', '铁锋区', '2302', 3); +INSERT INTO `dic_city` VALUES ('230205', '230205', '昂昂溪区', '2302', 3); +INSERT INTO `dic_city` VALUES ('230206', '230206', '富拉尔基区', '2302', 3); +INSERT INTO `dic_city` VALUES ('230207', '230207', '碾子山区', '2302', 3); +INSERT INTO `dic_city` VALUES ('230208', '230208', '梅里斯达斡尔族区', '2302', 3); +INSERT INTO `dic_city` VALUES ('230221', '230221', '龙江县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230223', '230223', '依安县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230224', '230224', '泰来县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230225', '230225', '甘南县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230227', '230227', '富裕县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230229', '230229', '克山县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230230', '230230', '克东县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230231', '230231', '拜泉县', '2302', 3); +INSERT INTO `dic_city` VALUES ('230281', '230281', '讷河市', '2302', 3); +INSERT INTO `dic_city` VALUES ('2303', '2303', '鸡西市', '23', 2); +INSERT INTO `dic_city` VALUES ('230302', '230302', '鸡冠区', '2303', 3); +INSERT INTO `dic_city` VALUES ('230303', '230303', '恒山区', '2303', 3); +INSERT INTO `dic_city` VALUES ('230304', '230304', '滴道区', '2303', 3); +INSERT INTO `dic_city` VALUES ('230305', '230305', '梨树区', '2303', 3); +INSERT INTO `dic_city` VALUES ('230306', '230306', '城子河区', '2303', 3); +INSERT INTO `dic_city` VALUES ('230307', '230307', '麻山区', '2303', 3); +INSERT INTO `dic_city` VALUES ('230321', '230321', '鸡东县', '2303', 3); +INSERT INTO `dic_city` VALUES ('230381', '230381', '虎林市', '2303', 3); +INSERT INTO `dic_city` VALUES ('230382', '230382', '密山市', '2303', 3); +INSERT INTO `dic_city` VALUES ('2304', '2304', '鹤岗市', '23', 2); +INSERT INTO `dic_city` VALUES ('230402', '230402', '向阳区', '2304', 3); +INSERT INTO `dic_city` VALUES ('230403', '230403', '工农区', '2304', 3); +INSERT INTO `dic_city` VALUES ('230404', '230404', '南山区', '2304', 3); +INSERT INTO `dic_city` VALUES ('230405', '230405', '兴安区', '2304', 3); +INSERT INTO `dic_city` VALUES ('230406', '230406', '东山区', '2304', 3); +INSERT INTO `dic_city` VALUES ('230407', '230407', '兴山区', '2304', 3); +INSERT INTO `dic_city` VALUES ('230421', '230421', '萝北县', '2304', 3); +INSERT INTO `dic_city` VALUES ('230422', '230422', '绥滨县', '2304', 3); +INSERT INTO `dic_city` VALUES ('2305', '2305', '双鸭山市', '23', 2); +INSERT INTO `dic_city` VALUES ('230502', '230502', '尖山区', '2305', 3); +INSERT INTO `dic_city` VALUES ('230503', '230503', '岭东区', '2305', 3); +INSERT INTO `dic_city` VALUES ('230505', '230505', '四方台区', '2305', 3); +INSERT INTO `dic_city` VALUES ('230506', '230506', '宝山区', '2305', 3); +INSERT INTO `dic_city` VALUES ('230521', '230521', '集贤县', '2305', 3); +INSERT INTO `dic_city` VALUES ('230522', '230522', '友谊县', '2305', 3); +INSERT INTO `dic_city` VALUES ('230523', '230523', '宝清县', '2305', 3); +INSERT INTO `dic_city` VALUES ('230524', '230524', '饶河县', '2305', 3); +INSERT INTO `dic_city` VALUES ('2306', '2306', '大庆市', '23', 2); +INSERT INTO `dic_city` VALUES ('230602', '230602', '萨尔图区', '2306', 3); +INSERT INTO `dic_city` VALUES ('230603', '230603', '龙凤区', '2306', 3); +INSERT INTO `dic_city` VALUES ('230604', '230604', '让胡路区', '2306', 3); +INSERT INTO `dic_city` VALUES ('230605', '230605', '红岗区', '2306', 3); +INSERT INTO `dic_city` VALUES ('230606', '230606', '大同区', '2306', 3); +INSERT INTO `dic_city` VALUES ('230621', '230621', '肇州县', '2306', 3); +INSERT INTO `dic_city` VALUES ('230622', '230622', '肇源县', '2306', 3); +INSERT INTO `dic_city` VALUES ('230623', '230623', '林甸县', '2306', 3); +INSERT INTO `dic_city` VALUES ('230624', '230624', '杜尔伯特蒙古族自治县', '2306', 3); +INSERT INTO `dic_city` VALUES ('230671', '230671', '大庆高新技术产业开发区', '2306', 3); +INSERT INTO `dic_city` VALUES ('2307', '2307', '伊春市', '23', 2); +INSERT INTO `dic_city` VALUES ('230717', '230717', '伊美区', '2307', 3); +INSERT INTO `dic_city` VALUES ('230718', '230718', '乌翠区', '2307', 3); +INSERT INTO `dic_city` VALUES ('230719', '230719', '友好区', '2307', 3); +INSERT INTO `dic_city` VALUES ('230722', '230722', '嘉荫县', '2307', 3); +INSERT INTO `dic_city` VALUES ('230723', '230723', '汤旺县', '2307', 3); +INSERT INTO `dic_city` VALUES ('230724', '230724', '丰林县', '2307', 3); +INSERT INTO `dic_city` VALUES ('230725', '230725', '大箐山县', '2307', 3); +INSERT INTO `dic_city` VALUES ('230726', '230726', '南岔县', '2307', 3); +INSERT INTO `dic_city` VALUES ('230751', '230751', '金林区', '2307', 3); +INSERT INTO `dic_city` VALUES ('230781', '230781', '铁力市', '2307', 3); +INSERT INTO `dic_city` VALUES ('2308', '2308', '佳木斯市', '23', 2); +INSERT INTO `dic_city` VALUES ('230803', '230803', '向阳区', '2308', 3); +INSERT INTO `dic_city` VALUES ('230804', '230804', '前进区', '2308', 3); +INSERT INTO `dic_city` VALUES ('230805', '230805', '东风区', '2308', 3); +INSERT INTO `dic_city` VALUES ('230811', '230811', '郊区', '2308', 3); +INSERT INTO `dic_city` VALUES ('230822', '230822', '桦南县', '2308', 3); +INSERT INTO `dic_city` VALUES ('230826', '230826', '桦川县', '2308', 3); +INSERT INTO `dic_city` VALUES ('230828', '230828', '汤原县', '2308', 3); +INSERT INTO `dic_city` VALUES ('230881', '230881', '同江市', '2308', 3); +INSERT INTO `dic_city` VALUES ('230882', '230882', '富锦市', '2308', 3); +INSERT INTO `dic_city` VALUES ('230883', '230883', '抚远市', '2308', 3); +INSERT INTO `dic_city` VALUES ('2309', '2309', '七台河市', '23', 2); +INSERT INTO `dic_city` VALUES ('230902', '230902', '新兴区', '2309', 3); +INSERT INTO `dic_city` VALUES ('230903', '230903', '桃山区', '2309', 3); +INSERT INTO `dic_city` VALUES ('230904', '230904', '茄子河区', '2309', 3); +INSERT INTO `dic_city` VALUES ('230921', '230921', '勃利县', '2309', 3); +INSERT INTO `dic_city` VALUES ('2310', '2310', '牡丹江市', '23', 2); +INSERT INTO `dic_city` VALUES ('231002', '231002', '东安区', '2310', 3); +INSERT INTO `dic_city` VALUES ('231003', '231003', '阳明区', '2310', 3); +INSERT INTO `dic_city` VALUES ('231004', '231004', '爱民区', '2310', 3); +INSERT INTO `dic_city` VALUES ('231005', '231005', '西安区', '2310', 3); +INSERT INTO `dic_city` VALUES ('231025', '231025', '林口县', '2310', 3); +INSERT INTO `dic_city` VALUES ('231071', '231071', '牡丹江经济技术开发区', '2310', 3); +INSERT INTO `dic_city` VALUES ('231081', '231081', '绥芬河市', '2310', 3); +INSERT INTO `dic_city` VALUES ('231083', '231083', '海林市', '2310', 3); +INSERT INTO `dic_city` VALUES ('231084', '231084', '宁安市', '2310', 3); +INSERT INTO `dic_city` VALUES ('231085', '231085', '穆棱市', '2310', 3); +INSERT INTO `dic_city` VALUES ('231086', '231086', '东宁市', '2310', 3); +INSERT INTO `dic_city` VALUES ('2311', '2311', '黑河市', '23', 2); +INSERT INTO `dic_city` VALUES ('231102', '231102', '爱辉区', '2311', 3); +INSERT INTO `dic_city` VALUES ('231123', '231123', '逊克县', '2311', 3); +INSERT INTO `dic_city` VALUES ('231124', '231124', '孙吴县', '2311', 3); +INSERT INTO `dic_city` VALUES ('231181', '231181', '北安市', '2311', 3); +INSERT INTO `dic_city` VALUES ('231182', '231182', '五大连池市', '2311', 3); +INSERT INTO `dic_city` VALUES ('231183', '231183', '嫩江市', '2311', 3); +INSERT INTO `dic_city` VALUES ('2312', '2312', '绥化市', '23', 2); +INSERT INTO `dic_city` VALUES ('231202', '231202', '北林区', '2312', 3); +INSERT INTO `dic_city` VALUES ('231221', '231221', '望奎县', '2312', 3); +INSERT INTO `dic_city` VALUES ('231222', '231222', '兰西县', '2312', 3); +INSERT INTO `dic_city` VALUES ('231223', '231223', '青冈县', '2312', 3); +INSERT INTO `dic_city` VALUES ('231224', '231224', '庆安县', '2312', 3); +INSERT INTO `dic_city` VALUES ('231225', '231225', '明水县', '2312', 3); +INSERT INTO `dic_city` VALUES ('231226', '231226', '绥棱县', '2312', 3); +INSERT INTO `dic_city` VALUES ('231281', '231281', '安达市', '2312', 3); +INSERT INTO `dic_city` VALUES ('231282', '231282', '肇东市', '2312', 3); +INSERT INTO `dic_city` VALUES ('231283', '231283', '海伦市', '2312', 3); +INSERT INTO `dic_city` VALUES ('2327', '2327', '大兴安岭地区', '23', 2); +INSERT INTO `dic_city` VALUES ('232701', '232701', '漠河市', '2327', 3); +INSERT INTO `dic_city` VALUES ('232721', '232721', '呼玛县', '2327', 3); +INSERT INTO `dic_city` VALUES ('232722', '232722', '塔河县', '2327', 3); +INSERT INTO `dic_city` VALUES ('232761', '232761', '加格达奇区', '2327', 3); +INSERT INTO `dic_city` VALUES ('232762', '232762', '松岭区', '2327', 3); +INSERT INTO `dic_city` VALUES ('232763', '232763', '新林区', '2327', 3); +INSERT INTO `dic_city` VALUES ('232764', '232764', '呼中区', '2327', 3); +INSERT INTO `dic_city` VALUES ('31', '31', '上海市', NULL, 1); +INSERT INTO `dic_city` VALUES ('3101', '3101', '市辖区', '31', 2); +INSERT INTO `dic_city` VALUES ('310101', '310101', '黄浦区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310104', '310104', '徐汇区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310105', '310105', '长宁区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310106', '310106', '静安区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310107', '310107', '普陀区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310109', '310109', '虹口区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310110', '310110', '杨浦区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310112', '310112', '闵行区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310113', '310113', '宝山区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310114', '310114', '嘉定区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310115', '310115', '浦东新区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310116', '310116', '金山区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310117', '310117', '松江区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310118', '310118', '青浦区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310120', '310120', '奉贤区', '3101', 3); +INSERT INTO `dic_city` VALUES ('310151', '310151', '崇明区', '3101', 3); +INSERT INTO `dic_city` VALUES ('32', '32', '江苏省', NULL, 1); +INSERT INTO `dic_city` VALUES ('3201', '3201', '南京市', '32', 2); +INSERT INTO `dic_city` VALUES ('320102', '320102', '玄武区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320104', '320104', '秦淮区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320105', '320105', '建邺区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320106', '320106', '鼓楼区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320111', '320111', '浦口区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320113', '320113', '栖霞区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320114', '320114', '雨花台区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320115', '320115', '江宁区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320116', '320116', '六合区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320117', '320117', '溧水区', '3201', 3); +INSERT INTO `dic_city` VALUES ('320118', '320118', '高淳区', '3201', 3); +INSERT INTO `dic_city` VALUES ('3202', '3202', '无锡市', '32', 2); +INSERT INTO `dic_city` VALUES ('320205', '320205', '锡山区', '3202', 3); +INSERT INTO `dic_city` VALUES ('320206', '320206', '惠山区', '3202', 3); +INSERT INTO `dic_city` VALUES ('320211', '320211', '滨湖区', '3202', 3); +INSERT INTO `dic_city` VALUES ('320213', '320213', '梁溪区', '3202', 3); +INSERT INTO `dic_city` VALUES ('320214', '320214', '新吴区', '3202', 3); +INSERT INTO `dic_city` VALUES ('320281', '320281', '江阴市', '3202', 3); +INSERT INTO `dic_city` VALUES ('320282', '320282', '宜兴市', '3202', 3); +INSERT INTO `dic_city` VALUES ('3203', '3203', '徐州市', '32', 2); +INSERT INTO `dic_city` VALUES ('320302', '320302', '鼓楼区', '3203', 3); +INSERT INTO `dic_city` VALUES ('320303', '320303', '云龙区', '3203', 3); +INSERT INTO `dic_city` VALUES ('320305', '320305', '贾汪区', '3203', 3); +INSERT INTO `dic_city` VALUES ('320311', '320311', '泉山区', '3203', 3); +INSERT INTO `dic_city` VALUES ('320312', '320312', '铜山区', '3203', 3); +INSERT INTO `dic_city` VALUES ('320321', '320321', '丰县', '3203', 3); +INSERT INTO `dic_city` VALUES ('320322', '320322', '沛县', '3203', 3); +INSERT INTO `dic_city` VALUES ('320324', '320324', '睢宁县', '3203', 3); +INSERT INTO `dic_city` VALUES ('320371', '320371', '徐州经济技术开发区', '3203', 3); +INSERT INTO `dic_city` VALUES ('320381', '320381', '新沂市', '3203', 3); +INSERT INTO `dic_city` VALUES ('320382', '320382', '邳州市', '3203', 3); +INSERT INTO `dic_city` VALUES ('3204', '3204', '常州市', '32', 2); +INSERT INTO `dic_city` VALUES ('320402', '320402', '天宁区', '3204', 3); +INSERT INTO `dic_city` VALUES ('320404', '320404', '钟楼区', '3204', 3); +INSERT INTO `dic_city` VALUES ('320411', '320411', '新北区', '3204', 3); +INSERT INTO `dic_city` VALUES ('320412', '320412', '武进区', '3204', 3); +INSERT INTO `dic_city` VALUES ('320413', '320413', '金坛区', '3204', 3); +INSERT INTO `dic_city` VALUES ('320481', '320481', '溧阳市', '3204', 3); +INSERT INTO `dic_city` VALUES ('3205', '3205', '苏州市', '32', 2); +INSERT INTO `dic_city` VALUES ('320505', '320505', '虎丘区', '3205', 3); +INSERT INTO `dic_city` VALUES ('320506', '320506', '吴中区', '3205', 3); +INSERT INTO `dic_city` VALUES ('320507', '320507', '相城区', '3205', 3); +INSERT INTO `dic_city` VALUES ('320508', '320508', '姑苏区', '3205', 3); +INSERT INTO `dic_city` VALUES ('320509', '320509', '吴江区', '3205', 3); +INSERT INTO `dic_city` VALUES ('320571', '320571', '苏州工业园区', '3205', 3); +INSERT INTO `dic_city` VALUES ('320581', '320581', '常熟市', '3205', 3); +INSERT INTO `dic_city` VALUES ('320582', '320582', '张家港市', '3205', 3); +INSERT INTO `dic_city` VALUES ('320583', '320583', '昆山市', '3205', 3); +INSERT INTO `dic_city` VALUES ('320585', '320585', '太仓市', '3205', 3); +INSERT INTO `dic_city` VALUES ('3206', '3206', '南通市', '32', 2); +INSERT INTO `dic_city` VALUES ('320602', '320602', '崇川区', '3206', 3); +INSERT INTO `dic_city` VALUES ('320611', '320611', '港闸区', '3206', 3); +INSERT INTO `dic_city` VALUES ('320612', '320612', '通州区', '3206', 3); +INSERT INTO `dic_city` VALUES ('320623', '320623', '如东县', '3206', 3); +INSERT INTO `dic_city` VALUES ('320671', '320671', '南通经济技术开发区', '3206', 3); +INSERT INTO `dic_city` VALUES ('320681', '320681', '启东市', '3206', 3); +INSERT INTO `dic_city` VALUES ('320682', '320682', '如皋市', '3206', 3); +INSERT INTO `dic_city` VALUES ('320684', '320684', '海门市', '3206', 3); +INSERT INTO `dic_city` VALUES ('320685', '320685', '海安市', '3206', 3); +INSERT INTO `dic_city` VALUES ('3207', '3207', '连云港市', '32', 2); +INSERT INTO `dic_city` VALUES ('320703', '320703', '连云区', '3207', 3); +INSERT INTO `dic_city` VALUES ('320706', '320706', '海州区', '3207', 3); +INSERT INTO `dic_city` VALUES ('320707', '320707', '赣榆区', '3207', 3); +INSERT INTO `dic_city` VALUES ('320722', '320722', '东海县', '3207', 3); +INSERT INTO `dic_city` VALUES ('320723', '320723', '灌云县', '3207', 3); +INSERT INTO `dic_city` VALUES ('320724', '320724', '灌南县', '3207', 3); +INSERT INTO `dic_city` VALUES ('320771', '320771', '连云港经济技术开发区', '3207', 3); +INSERT INTO `dic_city` VALUES ('320772', '320772', '连云港高新技术产业开发区', '3207', 3); +INSERT INTO `dic_city` VALUES ('3208', '3208', '淮安市', '32', 2); +INSERT INTO `dic_city` VALUES ('320803', '320803', '淮安区', '3208', 3); +INSERT INTO `dic_city` VALUES ('320804', '320804', '淮阴区', '3208', 3); +INSERT INTO `dic_city` VALUES ('320812', '320812', '清江浦区', '3208', 3); +INSERT INTO `dic_city` VALUES ('320813', '320813', '洪泽区', '3208', 3); +INSERT INTO `dic_city` VALUES ('320826', '320826', '涟水县', '3208', 3); +INSERT INTO `dic_city` VALUES ('320830', '320830', '盱眙县', '3208', 3); +INSERT INTO `dic_city` VALUES ('320831', '320831', '金湖县', '3208', 3); +INSERT INTO `dic_city` VALUES ('320871', '320871', '淮安经济技术开发区', '3208', 3); +INSERT INTO `dic_city` VALUES ('3209', '3209', '盐城市', '32', 2); +INSERT INTO `dic_city` VALUES ('320902', '320902', '亭湖区', '3209', 3); +INSERT INTO `dic_city` VALUES ('320903', '320903', '盐都区', '3209', 3); +INSERT INTO `dic_city` VALUES ('320904', '320904', '大丰区', '3209', 3); +INSERT INTO `dic_city` VALUES ('320921', '320921', '响水县', '3209', 3); +INSERT INTO `dic_city` VALUES ('320922', '320922', '滨海县', '3209', 3); +INSERT INTO `dic_city` VALUES ('320923', '320923', '阜宁县', '3209', 3); +INSERT INTO `dic_city` VALUES ('320924', '320924', '射阳县', '3209', 3); +INSERT INTO `dic_city` VALUES ('320925', '320925', '建湖县', '3209', 3); +INSERT INTO `dic_city` VALUES ('320971', '320971', '盐城经济技术开发区', '3209', 3); +INSERT INTO `dic_city` VALUES ('320981', '320981', '东台市', '3209', 3); +INSERT INTO `dic_city` VALUES ('3210', '3210', '扬州市', '32', 2); +INSERT INTO `dic_city` VALUES ('321002', '321002', '广陵区', '3210', 3); +INSERT INTO `dic_city` VALUES ('321003', '321003', '邗江区', '3210', 3); +INSERT INTO `dic_city` VALUES ('321012', '321012', '江都区', '3210', 3); +INSERT INTO `dic_city` VALUES ('321023', '321023', '宝应县', '3210', 3); +INSERT INTO `dic_city` VALUES ('321071', '321071', '扬州经济技术开发区', '3210', 3); +INSERT INTO `dic_city` VALUES ('321081', '321081', '仪征市', '3210', 3); +INSERT INTO `dic_city` VALUES ('321084', '321084', '高邮市', '3210', 3); +INSERT INTO `dic_city` VALUES ('3211', '3211', '镇江市', '32', 2); +INSERT INTO `dic_city` VALUES ('321102', '321102', '京口区', '3211', 3); +INSERT INTO `dic_city` VALUES ('321111', '321111', '润州区', '3211', 3); +INSERT INTO `dic_city` VALUES ('321112', '321112', '丹徒区', '3211', 3); +INSERT INTO `dic_city` VALUES ('321171', '321171', '镇江新区', '3211', 3); +INSERT INTO `dic_city` VALUES ('321181', '321181', '丹阳市', '3211', 3); +INSERT INTO `dic_city` VALUES ('321182', '321182', '扬中市', '3211', 3); +INSERT INTO `dic_city` VALUES ('321183', '321183', '句容市', '3211', 3); +INSERT INTO `dic_city` VALUES ('3212', '3212', '泰州市', '32', 2); +INSERT INTO `dic_city` VALUES ('321202', '321202', '海陵区', '3212', 3); +INSERT INTO `dic_city` VALUES ('321203', '321203', '高港区', '3212', 3); +INSERT INTO `dic_city` VALUES ('321204', '321204', '姜堰区', '3212', 3); +INSERT INTO `dic_city` VALUES ('321271', '321271', '泰州医药高新技术产业开发区', '3212', 3); +INSERT INTO `dic_city` VALUES ('321281', '321281', '兴化市', '3212', 3); +INSERT INTO `dic_city` VALUES ('321282', '321282', '靖江市', '3212', 3); +INSERT INTO `dic_city` VALUES ('321283', '321283', '泰兴市', '3212', 3); +INSERT INTO `dic_city` VALUES ('3213', '3213', '宿迁市', '32', 2); +INSERT INTO `dic_city` VALUES ('321302', '321302', '宿城区', '3213', 3); +INSERT INTO `dic_city` VALUES ('321311', '321311', '宿豫区', '3213', 3); +INSERT INTO `dic_city` VALUES ('321322', '321322', '沭阳县', '3213', 3); +INSERT INTO `dic_city` VALUES ('321323', '321323', '泗阳县', '3213', 3); +INSERT INTO `dic_city` VALUES ('321324', '321324', '泗洪县', '3213', 3); +INSERT INTO `dic_city` VALUES ('321371', '321371', '宿迁经济技术开发区', '3213', 3); +INSERT INTO `dic_city` VALUES ('33', '33', '浙江省', NULL, 1); +INSERT INTO `dic_city` VALUES ('3301', '3301', '杭州市', '33', 2); +INSERT INTO `dic_city` VALUES ('330102', '330102', '上城区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330103', '330103', '下城区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330104', '330104', '江干区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330105', '330105', '拱墅区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330106', '330106', '西湖区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330108', '330108', '滨江区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330109', '330109', '萧山区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330110', '330110', '余杭区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330111', '330111', '富阳区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330112', '330112', '临安区', '3301', 3); +INSERT INTO `dic_city` VALUES ('330122', '330122', '桐庐县', '3301', 3); +INSERT INTO `dic_city` VALUES ('330127', '330127', '淳安县', '3301', 3); +INSERT INTO `dic_city` VALUES ('330182', '330182', '建德市', '3301', 3); +INSERT INTO `dic_city` VALUES ('3302', '3302', '宁波市', '33', 2); +INSERT INTO `dic_city` VALUES ('330203', '330203', '海曙区', '3302', 3); +INSERT INTO `dic_city` VALUES ('330205', '330205', '江北区', '3302', 3); +INSERT INTO `dic_city` VALUES ('330206', '330206', '北仑区', '3302', 3); +INSERT INTO `dic_city` VALUES ('330211', '330211', '镇海区', '3302', 3); +INSERT INTO `dic_city` VALUES ('330212', '330212', '鄞州区', '3302', 3); +INSERT INTO `dic_city` VALUES ('330213', '330213', '奉化区', '3302', 3); +INSERT INTO `dic_city` VALUES ('330225', '330225', '象山县', '3302', 3); +INSERT INTO `dic_city` VALUES ('330226', '330226', '宁海县', '3302', 3); +INSERT INTO `dic_city` VALUES ('330281', '330281', '余姚市', '3302', 3); +INSERT INTO `dic_city` VALUES ('330282', '330282', '慈溪市', '3302', 3); +INSERT INTO `dic_city` VALUES ('3303', '3303', '温州市', '33', 2); +INSERT INTO `dic_city` VALUES ('330302', '330302', '鹿城区', '3303', 3); +INSERT INTO `dic_city` VALUES ('330303', '330303', '龙湾区', '3303', 3); +INSERT INTO `dic_city` VALUES ('330304', '330304', '瓯海区', '3303', 3); +INSERT INTO `dic_city` VALUES ('330305', '330305', '洞头区', '3303', 3); +INSERT INTO `dic_city` VALUES ('330324', '330324', '永嘉县', '3303', 3); +INSERT INTO `dic_city` VALUES ('330326', '330326', '平阳县', '3303', 3); +INSERT INTO `dic_city` VALUES ('330327', '330327', '苍南县', '3303', 3); +INSERT INTO `dic_city` VALUES ('330328', '330328', '文成县', '3303', 3); +INSERT INTO `dic_city` VALUES ('330329', '330329', '泰顺县', '3303', 3); +INSERT INTO `dic_city` VALUES ('330371', '330371', '温州经济技术开发区', '3303', 3); +INSERT INTO `dic_city` VALUES ('330381', '330381', '瑞安市', '3303', 3); +INSERT INTO `dic_city` VALUES ('330382', '330382', '乐清市', '3303', 3); +INSERT INTO `dic_city` VALUES ('330383', '330383', '龙港市', '3303', 3); +INSERT INTO `dic_city` VALUES ('3304', '3304', '嘉兴市', '33', 2); +INSERT INTO `dic_city` VALUES ('330402', '330402', '南湖区', '3304', 3); +INSERT INTO `dic_city` VALUES ('330411', '330411', '秀洲区', '3304', 3); +INSERT INTO `dic_city` VALUES ('330421', '330421', '嘉善县', '3304', 3); +INSERT INTO `dic_city` VALUES ('330424', '330424', '海盐县', '3304', 3); +INSERT INTO `dic_city` VALUES ('330481', '330481', '海宁市', '3304', 3); +INSERT INTO `dic_city` VALUES ('330482', '330482', '平湖市', '3304', 3); +INSERT INTO `dic_city` VALUES ('330483', '330483', '桐乡市', '3304', 3); +INSERT INTO `dic_city` VALUES ('3305', '3305', '湖州市', '33', 2); +INSERT INTO `dic_city` VALUES ('330502', '330502', '吴兴区', '3305', 3); +INSERT INTO `dic_city` VALUES ('330503', '330503', '南浔区', '3305', 3); +INSERT INTO `dic_city` VALUES ('330521', '330521', '德清县', '3305', 3); +INSERT INTO `dic_city` VALUES ('330522', '330522', '长兴县', '3305', 3); +INSERT INTO `dic_city` VALUES ('330523', '330523', '安吉县', '3305', 3); +INSERT INTO `dic_city` VALUES ('3306', '3306', '绍兴市', '33', 2); +INSERT INTO `dic_city` VALUES ('330602', '330602', '越城区', '3306', 3); +INSERT INTO `dic_city` VALUES ('330603', '330603', '柯桥区', '3306', 3); +INSERT INTO `dic_city` VALUES ('330604', '330604', '上虞区', '3306', 3); +INSERT INTO `dic_city` VALUES ('330624', '330624', '新昌县', '3306', 3); +INSERT INTO `dic_city` VALUES ('330681', '330681', '诸暨市', '3306', 3); +INSERT INTO `dic_city` VALUES ('330683', '330683', '嵊州市', '3306', 3); +INSERT INTO `dic_city` VALUES ('3307', '3307', '金华市', '33', 2); +INSERT INTO `dic_city` VALUES ('330702', '330702', '婺城区', '3307', 3); +INSERT INTO `dic_city` VALUES ('330703', '330703', '金东区', '3307', 3); +INSERT INTO `dic_city` VALUES ('330723', '330723', '武义县', '3307', 3); +INSERT INTO `dic_city` VALUES ('330726', '330726', '浦江县', '3307', 3); +INSERT INTO `dic_city` VALUES ('330727', '330727', '磐安县', '3307', 3); +INSERT INTO `dic_city` VALUES ('330781', '330781', '兰溪市', '3307', 3); +INSERT INTO `dic_city` VALUES ('330782', '330782', '义乌市', '3307', 3); +INSERT INTO `dic_city` VALUES ('330783', '330783', '东阳市', '3307', 3); +INSERT INTO `dic_city` VALUES ('330784', '330784', '永康市', '3307', 3); +INSERT INTO `dic_city` VALUES ('3308', '3308', '衢州市', '33', 2); +INSERT INTO `dic_city` VALUES ('330802', '330802', '柯城区', '3308', 3); +INSERT INTO `dic_city` VALUES ('330803', '330803', '衢江区', '3308', 3); +INSERT INTO `dic_city` VALUES ('330822', '330822', '常山县', '3308', 3); +INSERT INTO `dic_city` VALUES ('330824', '330824', '开化县', '3308', 3); +INSERT INTO `dic_city` VALUES ('330825', '330825', '龙游县', '3308', 3); +INSERT INTO `dic_city` VALUES ('330881', '330881', '江山市', '3308', 3); +INSERT INTO `dic_city` VALUES ('3309', '3309', '舟山市', '33', 2); +INSERT INTO `dic_city` VALUES ('330902', '330902', '定海区', '3309', 3); +INSERT INTO `dic_city` VALUES ('330903', '330903', '普陀区', '3309', 3); +INSERT INTO `dic_city` VALUES ('330921', '330921', '岱山县', '3309', 3); +INSERT INTO `dic_city` VALUES ('330922', '330922', '嵊泗县', '3309', 3); +INSERT INTO `dic_city` VALUES ('3310', '3310', '台州市', '33', 2); +INSERT INTO `dic_city` VALUES ('331002', '331002', '椒江区', '3310', 3); +INSERT INTO `dic_city` VALUES ('331003', '331003', '黄岩区', '3310', 3); +INSERT INTO `dic_city` VALUES ('331004', '331004', '路桥区', '3310', 3); +INSERT INTO `dic_city` VALUES ('331022', '331022', '三门县', '3310', 3); +INSERT INTO `dic_city` VALUES ('331023', '331023', '天台县', '3310', 3); +INSERT INTO `dic_city` VALUES ('331024', '331024', '仙居县', '3310', 3); +INSERT INTO `dic_city` VALUES ('331081', '331081', '温岭市', '3310', 3); +INSERT INTO `dic_city` VALUES ('331082', '331082', '临海市', '3310', 3); +INSERT INTO `dic_city` VALUES ('331083', '331083', '玉环市', '3310', 3); +INSERT INTO `dic_city` VALUES ('3311', '3311', '丽水市', '33', 2); +INSERT INTO `dic_city` VALUES ('331102', '331102', '莲都区', '3311', 3); +INSERT INTO `dic_city` VALUES ('331121', '331121', '青田县', '3311', 3); +INSERT INTO `dic_city` VALUES ('331122', '331122', '缙云县', '3311', 3); +INSERT INTO `dic_city` VALUES ('331123', '331123', '遂昌县', '3311', 3); +INSERT INTO `dic_city` VALUES ('331124', '331124', '松阳县', '3311', 3); +INSERT INTO `dic_city` VALUES ('331125', '331125', '云和县', '3311', 3); +INSERT INTO `dic_city` VALUES ('331126', '331126', '庆元县', '3311', 3); +INSERT INTO `dic_city` VALUES ('331127', '331127', '景宁畲族自治县', '3311', 3); +INSERT INTO `dic_city` VALUES ('331181', '331181', '龙泉市', '3311', 3); +INSERT INTO `dic_city` VALUES ('34', '34', '安徽省', NULL, 1); +INSERT INTO `dic_city` VALUES ('3401', '3401', '合肥市', '34', 2); +INSERT INTO `dic_city` VALUES ('340102', '340102', '瑶海区', '3401', 3); +INSERT INTO `dic_city` VALUES ('340103', '340103', '庐阳区', '3401', 3); +INSERT INTO `dic_city` VALUES ('340104', '340104', '蜀山区', '3401', 3); +INSERT INTO `dic_city` VALUES ('340111', '340111', '包河区', '3401', 3); +INSERT INTO `dic_city` VALUES ('340121', '340121', '长丰县', '3401', 3); +INSERT INTO `dic_city` VALUES ('340122', '340122', '肥东县', '3401', 3); +INSERT INTO `dic_city` VALUES ('340123', '340123', '肥西县', '3401', 3); +INSERT INTO `dic_city` VALUES ('340124', '340124', '庐江县', '3401', 3); +INSERT INTO `dic_city` VALUES ('340171', '340171', '合肥高新技术产业开发区', '3401', 3); +INSERT INTO `dic_city` VALUES ('340172', '340172', '合肥经济技术开发区', '3401', 3); +INSERT INTO `dic_city` VALUES ('340173', '340173', '合肥新站高新技术产业开发区', '3401', 3); +INSERT INTO `dic_city` VALUES ('340181', '340181', '巢湖市', '3401', 3); +INSERT INTO `dic_city` VALUES ('3402', '3402', '芜湖市', '34', 2); +INSERT INTO `dic_city` VALUES ('340202', '340202', '镜湖区', '3402', 3); +INSERT INTO `dic_city` VALUES ('340203', '340203', '弋江区', '3402', 3); +INSERT INTO `dic_city` VALUES ('340207', '340207', '鸠江区', '3402', 3); +INSERT INTO `dic_city` VALUES ('340208', '340208', '三山区', '3402', 3); +INSERT INTO `dic_city` VALUES ('340221', '340221', '芜湖县', '3402', 3); +INSERT INTO `dic_city` VALUES ('340222', '340222', '繁昌县', '3402', 3); +INSERT INTO `dic_city` VALUES ('340223', '340223', '南陵县', '3402', 3); +INSERT INTO `dic_city` VALUES ('340271', '340271', '芜湖经济技术开发区', '3402', 3); +INSERT INTO `dic_city` VALUES ('340272', '340272', '安徽芜湖长江大桥经济开发区', '3402', 3); +INSERT INTO `dic_city` VALUES ('340281', '340281', '无为市', '3402', 3); +INSERT INTO `dic_city` VALUES ('3403', '3403', '蚌埠市', '34', 2); +INSERT INTO `dic_city` VALUES ('340302', '340302', '龙子湖区', '3403', 3); +INSERT INTO `dic_city` VALUES ('340303', '340303', '蚌山区', '3403', 3); +INSERT INTO `dic_city` VALUES ('340304', '340304', '禹会区', '3403', 3); +INSERT INTO `dic_city` VALUES ('340311', '340311', '淮上区', '3403', 3); +INSERT INTO `dic_city` VALUES ('340321', '340321', '怀远县', '3403', 3); +INSERT INTO `dic_city` VALUES ('340322', '340322', '五河县', '3403', 3); +INSERT INTO `dic_city` VALUES ('340323', '340323', '固镇县', '3403', 3); +INSERT INTO `dic_city` VALUES ('340371', '340371', '蚌埠市高新技术开发区', '3403', 3); +INSERT INTO `dic_city` VALUES ('340372', '340372', '蚌埠市经济开发区', '3403', 3); +INSERT INTO `dic_city` VALUES ('3404', '3404', '淮南市', '34', 2); +INSERT INTO `dic_city` VALUES ('340402', '340402', '大通区', '3404', 3); +INSERT INTO `dic_city` VALUES ('340403', '340403', '田家庵区', '3404', 3); +INSERT INTO `dic_city` VALUES ('340404', '340404', '谢家集区', '3404', 3); +INSERT INTO `dic_city` VALUES ('340405', '340405', '八公山区', '3404', 3); +INSERT INTO `dic_city` VALUES ('340406', '340406', '潘集区', '3404', 3); +INSERT INTO `dic_city` VALUES ('340421', '340421', '凤台县', '3404', 3); +INSERT INTO `dic_city` VALUES ('340422', '340422', '寿县', '3404', 3); +INSERT INTO `dic_city` VALUES ('3405', '3405', '马鞍山市', '34', 2); +INSERT INTO `dic_city` VALUES ('340503', '340503', '花山区', '3405', 3); +INSERT INTO `dic_city` VALUES ('340504', '340504', '雨山区', '3405', 3); +INSERT INTO `dic_city` VALUES ('340506', '340506', '博望区', '3405', 3); +INSERT INTO `dic_city` VALUES ('340521', '340521', '当涂县', '3405', 3); +INSERT INTO `dic_city` VALUES ('340522', '340522', '含山县', '3405', 3); +INSERT INTO `dic_city` VALUES ('340523', '340523', '和县', '3405', 3); +INSERT INTO `dic_city` VALUES ('3406', '3406', '淮北市', '34', 2); +INSERT INTO `dic_city` VALUES ('340602', '340602', '杜集区', '3406', 3); +INSERT INTO `dic_city` VALUES ('340603', '340603', '相山区', '3406', 3); +INSERT INTO `dic_city` VALUES ('340604', '340604', '烈山区', '3406', 3); +INSERT INTO `dic_city` VALUES ('340621', '340621', '濉溪县', '3406', 3); +INSERT INTO `dic_city` VALUES ('3407', '3407', '铜陵市', '34', 2); +INSERT INTO `dic_city` VALUES ('340705', '340705', '铜官区', '3407', 3); +INSERT INTO `dic_city` VALUES ('340706', '340706', '义安区', '3407', 3); +INSERT INTO `dic_city` VALUES ('340711', '340711', '郊区', '3407', 3); +INSERT INTO `dic_city` VALUES ('340722', '340722', '枞阳县', '3407', 3); +INSERT INTO `dic_city` VALUES ('3408', '3408', '安庆市', '34', 2); +INSERT INTO `dic_city` VALUES ('340802', '340802', '迎江区', '3408', 3); +INSERT INTO `dic_city` VALUES ('340803', '340803', '大观区', '3408', 3); +INSERT INTO `dic_city` VALUES ('340811', '340811', '宜秀区', '3408', 3); +INSERT INTO `dic_city` VALUES ('340822', '340822', '怀宁县', '3408', 3); +INSERT INTO `dic_city` VALUES ('340825', '340825', '太湖县', '3408', 3); +INSERT INTO `dic_city` VALUES ('340826', '340826', '宿松县', '3408', 3); +INSERT INTO `dic_city` VALUES ('340827', '340827', '望江县', '3408', 3); +INSERT INTO `dic_city` VALUES ('340828', '340828', '岳西县', '3408', 3); +INSERT INTO `dic_city` VALUES ('340871', '340871', '安徽安庆经济开发区', '3408', 3); +INSERT INTO `dic_city` VALUES ('340881', '340881', '桐城市', '3408', 3); +INSERT INTO `dic_city` VALUES ('340882', '340882', '潜山市', '3408', 3); +INSERT INTO `dic_city` VALUES ('3410', '3410', '黄山市', '34', 2); +INSERT INTO `dic_city` VALUES ('341002', '341002', '屯溪区', '3410', 3); +INSERT INTO `dic_city` VALUES ('341003', '341003', '黄山区', '3410', 3); +INSERT INTO `dic_city` VALUES ('341004', '341004', '徽州区', '3410', 3); +INSERT INTO `dic_city` VALUES ('341021', '341021', '歙县', '3410', 3); +INSERT INTO `dic_city` VALUES ('341022', '341022', '休宁县', '3410', 3); +INSERT INTO `dic_city` VALUES ('341023', '341023', '黟县', '3410', 3); +INSERT INTO `dic_city` VALUES ('341024', '341024', '祁门县', '3410', 3); +INSERT INTO `dic_city` VALUES ('3411', '3411', '滁州市', '34', 2); +INSERT INTO `dic_city` VALUES ('341102', '341102', '琅琊区', '3411', 3); +INSERT INTO `dic_city` VALUES ('341103', '341103', '南谯区', '3411', 3); +INSERT INTO `dic_city` VALUES ('341122', '341122', '来安县', '3411', 3); +INSERT INTO `dic_city` VALUES ('341124', '341124', '全椒县', '3411', 3); +INSERT INTO `dic_city` VALUES ('341125', '341125', '定远县', '3411', 3); +INSERT INTO `dic_city` VALUES ('341126', '341126', '凤阳县', '3411', 3); +INSERT INTO `dic_city` VALUES ('341171', '341171', '苏滁现代产业园', '3411', 3); +INSERT INTO `dic_city` VALUES ('341172', '341172', '滁州经济技术开发区', '3411', 3); +INSERT INTO `dic_city` VALUES ('341181', '341181', '天长市', '3411', 3); +INSERT INTO `dic_city` VALUES ('341182', '341182', '明光市', '3411', 3); +INSERT INTO `dic_city` VALUES ('3412', '3412', '阜阳市', '34', 2); +INSERT INTO `dic_city` VALUES ('341202', '341202', '颍州区', '3412', 3); +INSERT INTO `dic_city` VALUES ('341203', '341203', '颍东区', '3412', 3); +INSERT INTO `dic_city` VALUES ('341204', '341204', '颍泉区', '3412', 3); +INSERT INTO `dic_city` VALUES ('341221', '341221', '临泉县', '3412', 3); +INSERT INTO `dic_city` VALUES ('341222', '341222', '太和县', '3412', 3); +INSERT INTO `dic_city` VALUES ('341225', '341225', '阜南县', '3412', 3); +INSERT INTO `dic_city` VALUES ('341226', '341226', '颍上县', '3412', 3); +INSERT INTO `dic_city` VALUES ('341271', '341271', '阜阳合肥现代产业园区', '3412', 3); +INSERT INTO `dic_city` VALUES ('341272', '341272', '阜阳经济技术开发区', '3412', 3); +INSERT INTO `dic_city` VALUES ('341282', '341282', '界首市', '3412', 3); +INSERT INTO `dic_city` VALUES ('3413', '3413', '宿州市', '34', 2); +INSERT INTO `dic_city` VALUES ('341302', '341302', '埇桥区', '3413', 3); +INSERT INTO `dic_city` VALUES ('341321', '341321', '砀山县', '3413', 3); +INSERT INTO `dic_city` VALUES ('341322', '341322', '萧县', '3413', 3); +INSERT INTO `dic_city` VALUES ('341323', '341323', '灵璧县', '3413', 3); +INSERT INTO `dic_city` VALUES ('341324', '341324', '泗县', '3413', 3); +INSERT INTO `dic_city` VALUES ('341371', '341371', '宿州马鞍山现代产业园区', '3413', 3); +INSERT INTO `dic_city` VALUES ('341372', '341372', '宿州经济技术开发区', '3413', 3); +INSERT INTO `dic_city` VALUES ('3415', '3415', '六安市', '34', 2); +INSERT INTO `dic_city` VALUES ('341502', '341502', '金安区', '3415', 3); +INSERT INTO `dic_city` VALUES ('341503', '341503', '裕安区', '3415', 3); +INSERT INTO `dic_city` VALUES ('341504', '341504', '叶集区', '3415', 3); +INSERT INTO `dic_city` VALUES ('341522', '341522', '霍邱县', '3415', 3); +INSERT INTO `dic_city` VALUES ('341523', '341523', '舒城县', '3415', 3); +INSERT INTO `dic_city` VALUES ('341524', '341524', '金寨县', '3415', 3); +INSERT INTO `dic_city` VALUES ('341525', '341525', '霍山县', '3415', 3); +INSERT INTO `dic_city` VALUES ('3416', '3416', '亳州市', '34', 2); +INSERT INTO `dic_city` VALUES ('341602', '341602', '谯城区', '3416', 3); +INSERT INTO `dic_city` VALUES ('341621', '341621', '涡阳县', '3416', 3); +INSERT INTO `dic_city` VALUES ('341622', '341622', '蒙城县', '3416', 3); +INSERT INTO `dic_city` VALUES ('341623', '341623', '利辛县', '3416', 3); +INSERT INTO `dic_city` VALUES ('3417', '3417', '池州市', '34', 2); +INSERT INTO `dic_city` VALUES ('341702', '341702', '贵池区', '3417', 3); +INSERT INTO `dic_city` VALUES ('341721', '341721', '东至县', '3417', 3); +INSERT INTO `dic_city` VALUES ('341722', '341722', '石台县', '3417', 3); +INSERT INTO `dic_city` VALUES ('341723', '341723', '青阳县', '3417', 3); +INSERT INTO `dic_city` VALUES ('3418', '3418', '宣城市', '34', 2); +INSERT INTO `dic_city` VALUES ('341802', '341802', '宣州区', '3418', 3); +INSERT INTO `dic_city` VALUES ('341821', '341821', '郎溪县', '3418', 3); +INSERT INTO `dic_city` VALUES ('341823', '341823', '泾县', '3418', 3); +INSERT INTO `dic_city` VALUES ('341824', '341824', '绩溪县', '3418', 3); +INSERT INTO `dic_city` VALUES ('341825', '341825', '旌德县', '3418', 3); +INSERT INTO `dic_city` VALUES ('341871', '341871', '宣城市经济开发区', '3418', 3); +INSERT INTO `dic_city` VALUES ('341881', '341881', '宁国市', '3418', 3); +INSERT INTO `dic_city` VALUES ('341882', '341882', '广德市', '3418', 3); +INSERT INTO `dic_city` VALUES ('35', '35', '福建省', NULL, 1); +INSERT INTO `dic_city` VALUES ('3501', '3501', '福州市', '35', 2); +INSERT INTO `dic_city` VALUES ('350102', '350102', '鼓楼区', '3501', 3); +INSERT INTO `dic_city` VALUES ('350103', '350103', '台江区', '3501', 3); +INSERT INTO `dic_city` VALUES ('350104', '350104', '仓山区', '3501', 3); +INSERT INTO `dic_city` VALUES ('350105', '350105', '马尾区', '3501', 3); +INSERT INTO `dic_city` VALUES ('350111', '350111', '晋安区', '3501', 3); +INSERT INTO `dic_city` VALUES ('350112', '350112', '长乐区', '3501', 3); +INSERT INTO `dic_city` VALUES ('350121', '350121', '闽侯县', '3501', 3); +INSERT INTO `dic_city` VALUES ('350122', '350122', '连江县', '3501', 3); +INSERT INTO `dic_city` VALUES ('350123', '350123', '罗源县', '3501', 3); +INSERT INTO `dic_city` VALUES ('350124', '350124', '闽清县', '3501', 3); +INSERT INTO `dic_city` VALUES ('350125', '350125', '永泰县', '3501', 3); +INSERT INTO `dic_city` VALUES ('350128', '350128', '平潭县', '3501', 3); +INSERT INTO `dic_city` VALUES ('350181', '350181', '福清市', '3501', 3); +INSERT INTO `dic_city` VALUES ('3502', '3502', '厦门市', '35', 2); +INSERT INTO `dic_city` VALUES ('350203', '350203', '思明区', '3502', 3); +INSERT INTO `dic_city` VALUES ('350205', '350205', '海沧区', '3502', 3); +INSERT INTO `dic_city` VALUES ('350206', '350206', '湖里区', '3502', 3); +INSERT INTO `dic_city` VALUES ('350211', '350211', '集美区', '3502', 3); +INSERT INTO `dic_city` VALUES ('350212', '350212', '同安区', '3502', 3); +INSERT INTO `dic_city` VALUES ('350213', '350213', '翔安区', '3502', 3); +INSERT INTO `dic_city` VALUES ('3503', '3503', '莆田市', '35', 2); +INSERT INTO `dic_city` VALUES ('350302', '350302', '城厢区', '3503', 3); +INSERT INTO `dic_city` VALUES ('350303', '350303', '涵江区', '3503', 3); +INSERT INTO `dic_city` VALUES ('350304', '350304', '荔城区', '3503', 3); +INSERT INTO `dic_city` VALUES ('350305', '350305', '秀屿区', '3503', 3); +INSERT INTO `dic_city` VALUES ('350322', '350322', '仙游县', '3503', 3); +INSERT INTO `dic_city` VALUES ('3504', '3504', '三明市', '35', 2); +INSERT INTO `dic_city` VALUES ('350402', '350402', '梅列区', '3504', 3); +INSERT INTO `dic_city` VALUES ('350403', '350403', '三元区', '3504', 3); +INSERT INTO `dic_city` VALUES ('350421', '350421', '明溪县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350423', '350423', '清流县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350424', '350424', '宁化县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350425', '350425', '大田县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350426', '350426', '尤溪县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350427', '350427', '沙县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350428', '350428', '将乐县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350429', '350429', '泰宁县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350430', '350430', '建宁县', '3504', 3); +INSERT INTO `dic_city` VALUES ('350481', '350481', '永安市', '3504', 3); +INSERT INTO `dic_city` VALUES ('3505', '3505', '泉州市', '35', 2); +INSERT INTO `dic_city` VALUES ('350502', '350502', '鲤城区', '3505', 3); +INSERT INTO `dic_city` VALUES ('350503', '350503', '丰泽区', '3505', 3); +INSERT INTO `dic_city` VALUES ('350504', '350504', '洛江区', '3505', 3); +INSERT INTO `dic_city` VALUES ('350505', '350505', '泉港区', '3505', 3); +INSERT INTO `dic_city` VALUES ('350521', '350521', '惠安县', '3505', 3); +INSERT INTO `dic_city` VALUES ('350524', '350524', '安溪县', '3505', 3); +INSERT INTO `dic_city` VALUES ('350525', '350525', '永春县', '3505', 3); +INSERT INTO `dic_city` VALUES ('350526', '350526', '德化县', '3505', 3); +INSERT INTO `dic_city` VALUES ('350527', '350527', '金门县', '3505', 3); +INSERT INTO `dic_city` VALUES ('350581', '350581', '石狮市', '3505', 3); +INSERT INTO `dic_city` VALUES ('350582', '350582', '晋江市', '3505', 3); +INSERT INTO `dic_city` VALUES ('350583', '350583', '南安市', '3505', 3); +INSERT INTO `dic_city` VALUES ('3506', '3506', '漳州市', '35', 2); +INSERT INTO `dic_city` VALUES ('350602', '350602', '芗城区', '3506', 3); +INSERT INTO `dic_city` VALUES ('350603', '350603', '龙文区', '3506', 3); +INSERT INTO `dic_city` VALUES ('350622', '350622', '云霄县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350623', '350623', '漳浦县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350624', '350624', '诏安县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350625', '350625', '长泰县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350626', '350626', '东山县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350627', '350627', '南靖县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350628', '350628', '平和县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350629', '350629', '华安县', '3506', 3); +INSERT INTO `dic_city` VALUES ('350681', '350681', '龙海市', '3506', 3); +INSERT INTO `dic_city` VALUES ('3507', '3507', '南平市', '35', 2); +INSERT INTO `dic_city` VALUES ('350702', '350702', '延平区', '3507', 3); +INSERT INTO `dic_city` VALUES ('350703', '350703', '建阳区', '3507', 3); +INSERT INTO `dic_city` VALUES ('350721', '350721', '顺昌县', '3507', 3); +INSERT INTO `dic_city` VALUES ('350722', '350722', '浦城县', '3507', 3); +INSERT INTO `dic_city` VALUES ('350723', '350723', '光泽县', '3507', 3); +INSERT INTO `dic_city` VALUES ('350724', '350724', '松溪县', '3507', 3); +INSERT INTO `dic_city` VALUES ('350725', '350725', '政和县', '3507', 3); +INSERT INTO `dic_city` VALUES ('350781', '350781', '邵武市', '3507', 3); +INSERT INTO `dic_city` VALUES ('350782', '350782', '武夷山市', '3507', 3); +INSERT INTO `dic_city` VALUES ('350783', '350783', '建瓯市', '3507', 3); +INSERT INTO `dic_city` VALUES ('3508', '3508', '龙岩市', '35', 2); +INSERT INTO `dic_city` VALUES ('350802', '350802', '新罗区', '3508', 3); +INSERT INTO `dic_city` VALUES ('350803', '350803', '永定区', '3508', 3); +INSERT INTO `dic_city` VALUES ('350821', '350821', '长汀县', '3508', 3); +INSERT INTO `dic_city` VALUES ('350823', '350823', '上杭县', '3508', 3); +INSERT INTO `dic_city` VALUES ('350824', '350824', '武平县', '3508', 3); +INSERT INTO `dic_city` VALUES ('350825', '350825', '连城县', '3508', 3); +INSERT INTO `dic_city` VALUES ('350881', '350881', '漳平市', '3508', 3); +INSERT INTO `dic_city` VALUES ('3509', '3509', '宁德市', '35', 2); +INSERT INTO `dic_city` VALUES ('350902', '350902', '蕉城区', '3509', 3); +INSERT INTO `dic_city` VALUES ('350921', '350921', '霞浦县', '3509', 3); +INSERT INTO `dic_city` VALUES ('350922', '350922', '古田县', '3509', 3); +INSERT INTO `dic_city` VALUES ('350923', '350923', '屏南县', '3509', 3); +INSERT INTO `dic_city` VALUES ('350924', '350924', '寿宁县', '3509', 3); +INSERT INTO `dic_city` VALUES ('350925', '350925', '周宁县', '3509', 3); +INSERT INTO `dic_city` VALUES ('350926', '350926', '柘荣县', '3509', 3); +INSERT INTO `dic_city` VALUES ('350981', '350981', '福安市', '3509', 3); +INSERT INTO `dic_city` VALUES ('350982', '350982', '福鼎市', '3509', 3); +INSERT INTO `dic_city` VALUES ('36', '36', '江西省', NULL, 1); +INSERT INTO `dic_city` VALUES ('3601', '3601', '南昌市', '36', 2); +INSERT INTO `dic_city` VALUES ('360102', '360102', '东湖区', '3601', 3); +INSERT INTO `dic_city` VALUES ('360103', '360103', '西湖区', '3601', 3); +INSERT INTO `dic_city` VALUES ('360104', '360104', '青云谱区', '3601', 3); +INSERT INTO `dic_city` VALUES ('360111', '360111', '青山湖区', '3601', 3); +INSERT INTO `dic_city` VALUES ('360112', '360112', '新建区', '3601', 3); +INSERT INTO `dic_city` VALUES ('360113', '360113', '红谷滩区', '3601', 3); +INSERT INTO `dic_city` VALUES ('360121', '360121', '南昌县', '3601', 3); +INSERT INTO `dic_city` VALUES ('360123', '360123', '安义县', '3601', 3); +INSERT INTO `dic_city` VALUES ('360124', '360124', '进贤县', '3601', 3); +INSERT INTO `dic_city` VALUES ('3602', '3602', '景德镇市', '36', 2); +INSERT INTO `dic_city` VALUES ('360202', '360202', '昌江区', '3602', 3); +INSERT INTO `dic_city` VALUES ('360203', '360203', '珠山区', '3602', 3); +INSERT INTO `dic_city` VALUES ('360222', '360222', '浮梁县', '3602', 3); +INSERT INTO `dic_city` VALUES ('360281', '360281', '乐平市', '3602', 3); +INSERT INTO `dic_city` VALUES ('3603', '3603', '萍乡市', '36', 2); +INSERT INTO `dic_city` VALUES ('360302', '360302', '安源区', '3603', 3); +INSERT INTO `dic_city` VALUES ('360313', '360313', '湘东区', '3603', 3); +INSERT INTO `dic_city` VALUES ('360321', '360321', '莲花县', '3603', 3); +INSERT INTO `dic_city` VALUES ('360322', '360322', '上栗县', '3603', 3); +INSERT INTO `dic_city` VALUES ('360323', '360323', '芦溪县', '3603', 3); +INSERT INTO `dic_city` VALUES ('3604', '3604', '九江市', '36', 2); +INSERT INTO `dic_city` VALUES ('360402', '360402', '濂溪区', '3604', 3); +INSERT INTO `dic_city` VALUES ('360403', '360403', '浔阳区', '3604', 3); +INSERT INTO `dic_city` VALUES ('360404', '360404', '柴桑区', '3604', 3); +INSERT INTO `dic_city` VALUES ('360423', '360423', '武宁县', '3604', 3); +INSERT INTO `dic_city` VALUES ('360424', '360424', '修水县', '3604', 3); +INSERT INTO `dic_city` VALUES ('360425', '360425', '永修县', '3604', 3); +INSERT INTO `dic_city` VALUES ('360426', '360426', '德安县', '3604', 3); +INSERT INTO `dic_city` VALUES ('360428', '360428', '都昌县', '3604', 3); +INSERT INTO `dic_city` VALUES ('360429', '360429', '湖口县', '3604', 3); +INSERT INTO `dic_city` VALUES ('360430', '360430', '彭泽县', '3604', 3); +INSERT INTO `dic_city` VALUES ('360481', '360481', '瑞昌市', '3604', 3); +INSERT INTO `dic_city` VALUES ('360482', '360482', '共青城市', '3604', 3); +INSERT INTO `dic_city` VALUES ('360483', '360483', '庐山市', '3604', 3); +INSERT INTO `dic_city` VALUES ('3605', '3605', '新余市', '36', 2); +INSERT INTO `dic_city` VALUES ('360502', '360502', '渝水区', '3605', 3); +INSERT INTO `dic_city` VALUES ('360521', '360521', '分宜县', '3605', 3); +INSERT INTO `dic_city` VALUES ('3606', '3606', '鹰潭市', '36', 2); +INSERT INTO `dic_city` VALUES ('360602', '360602', '月湖区', '3606', 3); +INSERT INTO `dic_city` VALUES ('360603', '360603', '余江区', '3606', 3); +INSERT INTO `dic_city` VALUES ('360681', '360681', '贵溪市', '3606', 3); +INSERT INTO `dic_city` VALUES ('3607', '3607', '赣州市', '36', 2); +INSERT INTO `dic_city` VALUES ('360702', '360702', '章贡区', '3607', 3); +INSERT INTO `dic_city` VALUES ('360703', '360703', '南康区', '3607', 3); +INSERT INTO `dic_city` VALUES ('360704', '360704', '赣县区', '3607', 3); +INSERT INTO `dic_city` VALUES ('360722', '360722', '信丰县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360723', '360723', '大余县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360724', '360724', '上犹县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360725', '360725', '崇义县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360726', '360726', '安远县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360728', '360728', '定南县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360729', '360729', '全南县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360730', '360730', '宁都县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360731', '360731', '于都县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360732', '360732', '兴国县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360733', '360733', '会昌县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360734', '360734', '寻乌县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360735', '360735', '石城县', '3607', 3); +INSERT INTO `dic_city` VALUES ('360781', '360781', '瑞金市', '3607', 3); +INSERT INTO `dic_city` VALUES ('360783', '360783', '龙南市', '3607', 3); +INSERT INTO `dic_city` VALUES ('3608', '3608', '吉安市', '36', 2); +INSERT INTO `dic_city` VALUES ('360802', '360802', '吉州区', '3608', 3); +INSERT INTO `dic_city` VALUES ('360803', '360803', '青原区', '3608', 3); +INSERT INTO `dic_city` VALUES ('360821', '360821', '吉安县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360822', '360822', '吉水县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360823', '360823', '峡江县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360824', '360824', '新干县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360825', '360825', '永丰县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360826', '360826', '泰和县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360827', '360827', '遂川县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360828', '360828', '万安县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360829', '360829', '安福县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360830', '360830', '永新县', '3608', 3); +INSERT INTO `dic_city` VALUES ('360881', '360881', '井冈山市', '3608', 3); +INSERT INTO `dic_city` VALUES ('3609', '3609', '宜春市', '36', 2); +INSERT INTO `dic_city` VALUES ('360902', '360902', '袁州区', '3609', 3); +INSERT INTO `dic_city` VALUES ('360921', '360921', '奉新县', '3609', 3); +INSERT INTO `dic_city` VALUES ('360922', '360922', '万载县', '3609', 3); +INSERT INTO `dic_city` VALUES ('360923', '360923', '上高县', '3609', 3); +INSERT INTO `dic_city` VALUES ('360924', '360924', '宜丰县', '3609', 3); +INSERT INTO `dic_city` VALUES ('360925', '360925', '靖安县', '3609', 3); +INSERT INTO `dic_city` VALUES ('360926', '360926', '铜鼓县', '3609', 3); +INSERT INTO `dic_city` VALUES ('360981', '360981', '丰城市', '3609', 3); +INSERT INTO `dic_city` VALUES ('360982', '360982', '樟树市', '3609', 3); +INSERT INTO `dic_city` VALUES ('360983', '360983', '高安市', '3609', 3); +INSERT INTO `dic_city` VALUES ('3610', '3610', '抚州市', '36', 2); +INSERT INTO `dic_city` VALUES ('361002', '361002', '临川区', '3610', 3); +INSERT INTO `dic_city` VALUES ('361003', '361003', '东乡区', '3610', 3); +INSERT INTO `dic_city` VALUES ('361021', '361021', '南城县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361022', '361022', '黎川县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361023', '361023', '南丰县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361024', '361024', '崇仁县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361025', '361025', '乐安县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361026', '361026', '宜黄县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361027', '361027', '金溪县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361028', '361028', '资溪县', '3610', 3); +INSERT INTO `dic_city` VALUES ('361030', '361030', '广昌县', '3610', 3); +INSERT INTO `dic_city` VALUES ('3611', '3611', '上饶市', '36', 2); +INSERT INTO `dic_city` VALUES ('361102', '361102', '信州区', '3611', 3); +INSERT INTO `dic_city` VALUES ('361103', '361103', '广丰区', '3611', 3); +INSERT INTO `dic_city` VALUES ('361104', '361104', '广信区', '3611', 3); +INSERT INTO `dic_city` VALUES ('361123', '361123', '玉山县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361124', '361124', '铅山县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361125', '361125', '横峰县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361126', '361126', '弋阳县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361127', '361127', '余干县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361128', '361128', '鄱阳县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361129', '361129', '万年县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361130', '361130', '婺源县', '3611', 3); +INSERT INTO `dic_city` VALUES ('361181', '361181', '德兴市', '3611', 3); +INSERT INTO `dic_city` VALUES ('37', '37', '山东省', NULL, 1); +INSERT INTO `dic_city` VALUES ('3701', '3701', '济南市', '37', 2); +INSERT INTO `dic_city` VALUES ('370102', '370102', '历下区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370103', '370103', '市中区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370104', '370104', '槐荫区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370105', '370105', '天桥区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370112', '370112', '历城区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370113', '370113', '长清区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370114', '370114', '章丘区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370115', '370115', '济阳区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370116', '370116', '莱芜区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370117', '370117', '钢城区', '3701', 3); +INSERT INTO `dic_city` VALUES ('370124', '370124', '平阴县', '3701', 3); +INSERT INTO `dic_city` VALUES ('370126', '370126', '商河县', '3701', 3); +INSERT INTO `dic_city` VALUES ('370171', '370171', '济南高新技术产业开发区', '3701', 3); +INSERT INTO `dic_city` VALUES ('3702', '3702', '青岛市', '37', 2); +INSERT INTO `dic_city` VALUES ('370202', '370202', '市南区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370203', '370203', '市北区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370211', '370211', '黄岛区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370212', '370212', '崂山区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370213', '370213', '李沧区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370214', '370214', '城阳区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370215', '370215', '即墨区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370271', '370271', '青岛高新技术产业开发区', '3702', 3); +INSERT INTO `dic_city` VALUES ('370281', '370281', '胶州市', '3702', 3); +INSERT INTO `dic_city` VALUES ('370283', '370283', '平度市', '3702', 3); +INSERT INTO `dic_city` VALUES ('370285', '370285', '莱西市', '3702', 3); +INSERT INTO `dic_city` VALUES ('3703', '3703', '淄博市', '37', 2); +INSERT INTO `dic_city` VALUES ('370302', '370302', '淄川区', '3703', 3); +INSERT INTO `dic_city` VALUES ('370303', '370303', '张店区', '3703', 3); +INSERT INTO `dic_city` VALUES ('370304', '370304', '博山区', '3703', 3); +INSERT INTO `dic_city` VALUES ('370305', '370305', '临淄区', '3703', 3); +INSERT INTO `dic_city` VALUES ('370306', '370306', '周村区', '3703', 3); +INSERT INTO `dic_city` VALUES ('370321', '370321', '桓台县', '3703', 3); +INSERT INTO `dic_city` VALUES ('370322', '370322', '高青县', '3703', 3); +INSERT INTO `dic_city` VALUES ('370323', '370323', '沂源县', '3703', 3); +INSERT INTO `dic_city` VALUES ('3704', '3704', '枣庄市', '37', 2); +INSERT INTO `dic_city` VALUES ('370402', '370402', '市中区', '3704', 3); +INSERT INTO `dic_city` VALUES ('370403', '370403', '薛城区', '3704', 3); +INSERT INTO `dic_city` VALUES ('370404', '370404', '峄城区', '3704', 3); +INSERT INTO `dic_city` VALUES ('370405', '370405', '台儿庄区', '3704', 3); +INSERT INTO `dic_city` VALUES ('370406', '370406', '山亭区', '3704', 3); +INSERT INTO `dic_city` VALUES ('370481', '370481', '滕州市', '3704', 3); +INSERT INTO `dic_city` VALUES ('3705', '3705', '东营市', '37', 2); +INSERT INTO `dic_city` VALUES ('370502', '370502', '东营区', '3705', 3); +INSERT INTO `dic_city` VALUES ('370503', '370503', '河口区', '3705', 3); +INSERT INTO `dic_city` VALUES ('370505', '370505', '垦利区', '3705', 3); +INSERT INTO `dic_city` VALUES ('370522', '370522', '利津县', '3705', 3); +INSERT INTO `dic_city` VALUES ('370523', '370523', '广饶县', '3705', 3); +INSERT INTO `dic_city` VALUES ('370571', '370571', '东营经济技术开发区', '3705', 3); +INSERT INTO `dic_city` VALUES ('370572', '370572', '东营港经济开发区', '3705', 3); +INSERT INTO `dic_city` VALUES ('3706', '3706', '烟台市', '37', 2); +INSERT INTO `dic_city` VALUES ('370602', '370602', '芝罘区', '3706', 3); +INSERT INTO `dic_city` VALUES ('370611', '370611', '福山区', '3706', 3); +INSERT INTO `dic_city` VALUES ('370612', '370612', '牟平区', '3706', 3); +INSERT INTO `dic_city` VALUES ('370613', '370613', '莱山区', '3706', 3); +INSERT INTO `dic_city` VALUES ('370614', '370614', '蓬莱区', '3706', 3); +INSERT INTO `dic_city` VALUES ('370671', '370671', '烟台高新技术产业开发区', '3706', 3); +INSERT INTO `dic_city` VALUES ('370672', '370672', '烟台经济技术开发区', '3706', 3); +INSERT INTO `dic_city` VALUES ('370681', '370681', '龙口市', '3706', 3); +INSERT INTO `dic_city` VALUES ('370682', '370682', '莱阳市', '3706', 3); +INSERT INTO `dic_city` VALUES ('370683', '370683', '莱州市', '3706', 3); +INSERT INTO `dic_city` VALUES ('370685', '370685', '招远市', '3706', 3); +INSERT INTO `dic_city` VALUES ('370686', '370686', '栖霞市', '3706', 3); +INSERT INTO `dic_city` VALUES ('370687', '370687', '海阳市', '3706', 3); +INSERT INTO `dic_city` VALUES ('3707', '3707', '潍坊市', '37', 2); +INSERT INTO `dic_city` VALUES ('370702', '370702', '潍城区', '3707', 3); +INSERT INTO `dic_city` VALUES ('370703', '370703', '寒亭区', '3707', 3); +INSERT INTO `dic_city` VALUES ('370704', '370704', '坊子区', '3707', 3); +INSERT INTO `dic_city` VALUES ('370705', '370705', '奎文区', '3707', 3); +INSERT INTO `dic_city` VALUES ('370724', '370724', '临朐县', '3707', 3); +INSERT INTO `dic_city` VALUES ('370725', '370725', '昌乐县', '3707', 3); +INSERT INTO `dic_city` VALUES ('370772', '370772', '潍坊滨海经济技术开发区', '3707', 3); +INSERT INTO `dic_city` VALUES ('370781', '370781', '青州市', '3707', 3); +INSERT INTO `dic_city` VALUES ('370782', '370782', '诸城市', '3707', 3); +INSERT INTO `dic_city` VALUES ('370783', '370783', '寿光市', '3707', 3); +INSERT INTO `dic_city` VALUES ('370784', '370784', '安丘市', '3707', 3); +INSERT INTO `dic_city` VALUES ('370785', '370785', '高密市', '3707', 3); +INSERT INTO `dic_city` VALUES ('370786', '370786', '昌邑市', '3707', 3); +INSERT INTO `dic_city` VALUES ('3708', '3708', '济宁市', '37', 2); +INSERT INTO `dic_city` VALUES ('370811', '370811', '任城区', '3708', 3); +INSERT INTO `dic_city` VALUES ('370812', '370812', '兖州区', '3708', 3); +INSERT INTO `dic_city` VALUES ('370826', '370826', '微山县', '3708', 3); +INSERT INTO `dic_city` VALUES ('370827', '370827', '鱼台县', '3708', 3); +INSERT INTO `dic_city` VALUES ('370828', '370828', '金乡县', '3708', 3); +INSERT INTO `dic_city` VALUES ('370829', '370829', '嘉祥县', '3708', 3); +INSERT INTO `dic_city` VALUES ('370830', '370830', '汶上县', '3708', 3); +INSERT INTO `dic_city` VALUES ('370831', '370831', '泗水县', '3708', 3); +INSERT INTO `dic_city` VALUES ('370832', '370832', '梁山县', '3708', 3); +INSERT INTO `dic_city` VALUES ('370871', '370871', '济宁高新技术产业开发区', '3708', 3); +INSERT INTO `dic_city` VALUES ('370881', '370881', '曲阜市', '3708', 3); +INSERT INTO `dic_city` VALUES ('370883', '370883', '邹城市', '3708', 3); +INSERT INTO `dic_city` VALUES ('3709', '3709', '泰安市', '37', 2); +INSERT INTO `dic_city` VALUES ('370902', '370902', '泰山区', '3709', 3); +INSERT INTO `dic_city` VALUES ('370911', '370911', '岱岳区', '3709', 3); +INSERT INTO `dic_city` VALUES ('370921', '370921', '宁阳县', '3709', 3); +INSERT INTO `dic_city` VALUES ('370923', '370923', '东平县', '3709', 3); +INSERT INTO `dic_city` VALUES ('370982', '370982', '新泰市', '3709', 3); +INSERT INTO `dic_city` VALUES ('370983', '370983', '肥城市', '3709', 3); +INSERT INTO `dic_city` VALUES ('3710', '3710', '威海市', '37', 2); +INSERT INTO `dic_city` VALUES ('371002', '371002', '环翠区', '3710', 3); +INSERT INTO `dic_city` VALUES ('371003', '371003', '文登区', '3710', 3); +INSERT INTO `dic_city` VALUES ('371071', '371071', '威海火炬高技术产业开发区', '3710', 3); +INSERT INTO `dic_city` VALUES ('371072', '371072', '威海经济技术开发区', '3710', 3); +INSERT INTO `dic_city` VALUES ('371073', '371073', '威海临港经济技术开发区', '3710', 3); +INSERT INTO `dic_city` VALUES ('371082', '371082', '荣成市', '3710', 3); +INSERT INTO `dic_city` VALUES ('371083', '371083', '乳山市', '3710', 3); +INSERT INTO `dic_city` VALUES ('3711', '3711', '日照市', '37', 2); +INSERT INTO `dic_city` VALUES ('371102', '371102', '东港区', '3711', 3); +INSERT INTO `dic_city` VALUES ('371103', '371103', '岚山区', '3711', 3); +INSERT INTO `dic_city` VALUES ('371121', '371121', '五莲县', '3711', 3); +INSERT INTO `dic_city` VALUES ('371122', '371122', '莒县', '3711', 3); +INSERT INTO `dic_city` VALUES ('371171', '371171', '日照经济技术开发区', '3711', 3); +INSERT INTO `dic_city` VALUES ('3713', '3713', '临沂市', '37', 2); +INSERT INTO `dic_city` VALUES ('371302', '371302', '兰山区', '3713', 3); +INSERT INTO `dic_city` VALUES ('371311', '371311', '罗庄区', '3713', 3); +INSERT INTO `dic_city` VALUES ('371312', '371312', '河东区', '3713', 3); +INSERT INTO `dic_city` VALUES ('371321', '371321', '沂南县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371322', '371322', '郯城县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371323', '371323', '沂水县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371324', '371324', '兰陵县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371325', '371325', '费县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371326', '371326', '平邑县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371327', '371327', '莒南县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371328', '371328', '蒙阴县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371329', '371329', '临沭县', '3713', 3); +INSERT INTO `dic_city` VALUES ('371371', '371371', '临沂高新技术产业开发区', '3713', 3); +INSERT INTO `dic_city` VALUES ('3714', '3714', '德州市', '37', 2); +INSERT INTO `dic_city` VALUES ('371402', '371402', '德城区', '3714', 3); +INSERT INTO `dic_city` VALUES ('371403', '371403', '陵城区', '3714', 3); +INSERT INTO `dic_city` VALUES ('371422', '371422', '宁津县', '3714', 3); +INSERT INTO `dic_city` VALUES ('371423', '371423', '庆云县', '3714', 3); +INSERT INTO `dic_city` VALUES ('371424', '371424', '临邑县', '3714', 3); +INSERT INTO `dic_city` VALUES ('371425', '371425', '齐河县', '3714', 3); +INSERT INTO `dic_city` VALUES ('371426', '371426', '平原县', '3714', 3); +INSERT INTO `dic_city` VALUES ('371427', '371427', '夏津县', '3714', 3); +INSERT INTO `dic_city` VALUES ('371428', '371428', '武城县', '3714', 3); +INSERT INTO `dic_city` VALUES ('371471', '371471', '德州经济技术开发区', '3714', 3); +INSERT INTO `dic_city` VALUES ('371472', '371472', '德州运河经济开发区', '3714', 3); +INSERT INTO `dic_city` VALUES ('371481', '371481', '乐陵市', '3714', 3); +INSERT INTO `dic_city` VALUES ('371482', '371482', '禹城市', '3714', 3); +INSERT INTO `dic_city` VALUES ('3715', '3715', '聊城市', '37', 2); +INSERT INTO `dic_city` VALUES ('371502', '371502', '东昌府区', '3715', 3); +INSERT INTO `dic_city` VALUES ('371503', '371503', '茌平区', '3715', 3); +INSERT INTO `dic_city` VALUES ('371521', '371521', '阳谷县', '3715', 3); +INSERT INTO `dic_city` VALUES ('371522', '371522', '莘县', '3715', 3); +INSERT INTO `dic_city` VALUES ('371524', '371524', '东阿县', '3715', 3); +INSERT INTO `dic_city` VALUES ('371525', '371525', '冠县', '3715', 3); +INSERT INTO `dic_city` VALUES ('371526', '371526', '高唐县', '3715', 3); +INSERT INTO `dic_city` VALUES ('371581', '371581', '临清市', '3715', 3); +INSERT INTO `dic_city` VALUES ('3716', '3716', '滨州市', '37', 2); +INSERT INTO `dic_city` VALUES ('371602', '371602', '滨城区', '3716', 3); +INSERT INTO `dic_city` VALUES ('371603', '371603', '沾化区', '3716', 3); +INSERT INTO `dic_city` VALUES ('371621', '371621', '惠民县', '3716', 3); +INSERT INTO `dic_city` VALUES ('371622', '371622', '阳信县', '3716', 3); +INSERT INTO `dic_city` VALUES ('371623', '371623', '无棣县', '3716', 3); +INSERT INTO `dic_city` VALUES ('371625', '371625', '博兴县', '3716', 3); +INSERT INTO `dic_city` VALUES ('371681', '371681', '邹平市', '3716', 3); +INSERT INTO `dic_city` VALUES ('3717', '3717', '菏泽市', '37', 2); +INSERT INTO `dic_city` VALUES ('371702', '371702', '牡丹区', '3717', 3); +INSERT INTO `dic_city` VALUES ('371703', '371703', '定陶区', '3717', 3); +INSERT INTO `dic_city` VALUES ('371721', '371721', '曹县', '3717', 3); +INSERT INTO `dic_city` VALUES ('371722', '371722', '单县', '3717', 3); +INSERT INTO `dic_city` VALUES ('371723', '371723', '成武县', '3717', 3); +INSERT INTO `dic_city` VALUES ('371724', '371724', '巨野县', '3717', 3); +INSERT INTO `dic_city` VALUES ('371725', '371725', '郓城县', '3717', 3); +INSERT INTO `dic_city` VALUES ('371726', '371726', '鄄城县', '3717', 3); +INSERT INTO `dic_city` VALUES ('371728', '371728', '东明县', '3717', 3); +INSERT INTO `dic_city` VALUES ('371771', '371771', '菏泽经济技术开发区', '3717', 3); +INSERT INTO `dic_city` VALUES ('371772', '371772', '菏泽高新技术开发区', '3717', 3); +INSERT INTO `dic_city` VALUES ('41', '41', '河南省', NULL, 1); +INSERT INTO `dic_city` VALUES ('4101', '4101', '郑州市', '41', 2); +INSERT INTO `dic_city` VALUES ('410102', '410102', '中原区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410103', '410103', '二七区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410104', '410104', '管城回族区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410105', '410105', '金水区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410106', '410106', '上街区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410108', '410108', '惠济区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410122', '410122', '中牟县', '4101', 3); +INSERT INTO `dic_city` VALUES ('410171', '410171', '郑州经济技术开发区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410172', '410172', '郑州高新技术产业开发区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410173', '410173', '郑州航空港经济综合实验区', '4101', 3); +INSERT INTO `dic_city` VALUES ('410181', '410181', '巩义市', '4101', 3); +INSERT INTO `dic_city` VALUES ('410182', '410182', '荥阳市', '4101', 3); +INSERT INTO `dic_city` VALUES ('410183', '410183', '新密市', '4101', 3); +INSERT INTO `dic_city` VALUES ('410184', '410184', '新郑市', '4101', 3); +INSERT INTO `dic_city` VALUES ('410185', '410185', '登封市', '4101', 3); +INSERT INTO `dic_city` VALUES ('4102', '4102', '开封市', '41', 2); +INSERT INTO `dic_city` VALUES ('410202', '410202', '龙亭区', '4102', 3); +INSERT INTO `dic_city` VALUES ('410203', '410203', '顺河回族区', '4102', 3); +INSERT INTO `dic_city` VALUES ('410204', '410204', '鼓楼区', '4102', 3); +INSERT INTO `dic_city` VALUES ('410205', '410205', '禹王台区', '4102', 3); +INSERT INTO `dic_city` VALUES ('410212', '410212', '祥符区', '4102', 3); +INSERT INTO `dic_city` VALUES ('410221', '410221', '杞县', '4102', 3); +INSERT INTO `dic_city` VALUES ('410222', '410222', '通许县', '4102', 3); +INSERT INTO `dic_city` VALUES ('410223', '410223', '尉氏县', '4102', 3); +INSERT INTO `dic_city` VALUES ('410225', '410225', '兰考县', '4102', 3); +INSERT INTO `dic_city` VALUES ('4103', '4103', '洛阳市', '41', 2); +INSERT INTO `dic_city` VALUES ('410302', '410302', '老城区', '4103', 3); +INSERT INTO `dic_city` VALUES ('410303', '410303', '西工区', '4103', 3); +INSERT INTO `dic_city` VALUES ('410304', '410304', '瀍河回族区', '4103', 3); +INSERT INTO `dic_city` VALUES ('410305', '410305', '涧西区', '4103', 3); +INSERT INTO `dic_city` VALUES ('410306', '410306', '吉利区', '4103', 3); +INSERT INTO `dic_city` VALUES ('410311', '410311', '洛龙区', '4103', 3); +INSERT INTO `dic_city` VALUES ('410322', '410322', '孟津县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410323', '410323', '新安县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410324', '410324', '栾川县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410325', '410325', '嵩县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410326', '410326', '汝阳县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410327', '410327', '宜阳县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410328', '410328', '洛宁县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410329', '410329', '伊川县', '4103', 3); +INSERT INTO `dic_city` VALUES ('410371', '410371', '洛阳高新技术产业开发区', '4103', 3); +INSERT INTO `dic_city` VALUES ('410381', '410381', '偃师市', '4103', 3); +INSERT INTO `dic_city` VALUES ('4104', '4104', '平顶山市', '41', 2); +INSERT INTO `dic_city` VALUES ('410402', '410402', '新华区', '4104', 3); +INSERT INTO `dic_city` VALUES ('410403', '410403', '卫东区', '4104', 3); +INSERT INTO `dic_city` VALUES ('410404', '410404', '石龙区', '4104', 3); +INSERT INTO `dic_city` VALUES ('410411', '410411', '湛河区', '4104', 3); +INSERT INTO `dic_city` VALUES ('410421', '410421', '宝丰县', '4104', 3); +INSERT INTO `dic_city` VALUES ('410422', '410422', '叶县', '4104', 3); +INSERT INTO `dic_city` VALUES ('410423', '410423', '鲁山县', '4104', 3); +INSERT INTO `dic_city` VALUES ('410425', '410425', '郏县', '4104', 3); +INSERT INTO `dic_city` VALUES ('410471', '410471', '平顶山高新技术产业开发区', '4104', 3); +INSERT INTO `dic_city` VALUES ('410472', '410472', '平顶山市城乡一体化示范区', '4104', 3); +INSERT INTO `dic_city` VALUES ('410481', '410481', '舞钢市', '4104', 3); +INSERT INTO `dic_city` VALUES ('410482', '410482', '汝州市', '4104', 3); +INSERT INTO `dic_city` VALUES ('4105', '4105', '安阳市', '41', 2); +INSERT INTO `dic_city` VALUES ('410502', '410502', '文峰区', '4105', 3); +INSERT INTO `dic_city` VALUES ('410503', '410503', '北关区', '4105', 3); +INSERT INTO `dic_city` VALUES ('410505', '410505', '殷都区', '4105', 3); +INSERT INTO `dic_city` VALUES ('410506', '410506', '龙安区', '4105', 3); +INSERT INTO `dic_city` VALUES ('410522', '410522', '安阳县', '4105', 3); +INSERT INTO `dic_city` VALUES ('410523', '410523', '汤阴县', '4105', 3); +INSERT INTO `dic_city` VALUES ('410526', '410526', '滑县', '4105', 3); +INSERT INTO `dic_city` VALUES ('410527', '410527', '内黄县', '4105', 3); +INSERT INTO `dic_city` VALUES ('410571', '410571', '安阳高新技术产业开发区', '4105', 3); +INSERT INTO `dic_city` VALUES ('410581', '410581', '林州市', '4105', 3); +INSERT INTO `dic_city` VALUES ('4106', '4106', '鹤壁市', '41', 2); +INSERT INTO `dic_city` VALUES ('410602', '410602', '鹤山区', '4106', 3); +INSERT INTO `dic_city` VALUES ('410603', '410603', '山城区', '4106', 3); +INSERT INTO `dic_city` VALUES ('410611', '410611', '淇滨区', '4106', 3); +INSERT INTO `dic_city` VALUES ('410621', '410621', '浚县', '4106', 3); +INSERT INTO `dic_city` VALUES ('410622', '410622', '淇县', '4106', 3); +INSERT INTO `dic_city` VALUES ('410671', '410671', '鹤壁经济技术开发区', '4106', 3); +INSERT INTO `dic_city` VALUES ('4107', '4107', '新乡市', '41', 2); +INSERT INTO `dic_city` VALUES ('410702', '410702', '红旗区', '4107', 3); +INSERT INTO `dic_city` VALUES ('410703', '410703', '卫滨区', '4107', 3); +INSERT INTO `dic_city` VALUES ('410704', '410704', '凤泉区', '4107', 3); +INSERT INTO `dic_city` VALUES ('410711', '410711', '牧野区', '4107', 3); +INSERT INTO `dic_city` VALUES ('410721', '410721', '新乡县', '4107', 3); +INSERT INTO `dic_city` VALUES ('410724', '410724', '获嘉县', '4107', 3); +INSERT INTO `dic_city` VALUES ('410725', '410725', '原阳县', '4107', 3); +INSERT INTO `dic_city` VALUES ('410726', '410726', '延津县', '4107', 3); +INSERT INTO `dic_city` VALUES ('410727', '410727', '封丘县', '4107', 3); +INSERT INTO `dic_city` VALUES ('410771', '410771', '新乡高新技术产业开发区', '4107', 3); +INSERT INTO `dic_city` VALUES ('410772', '410772', '新乡经济技术开发区', '4107', 3); +INSERT INTO `dic_city` VALUES ('410773', '410773', '新乡市平原城乡一体化示范区', '4107', 3); +INSERT INTO `dic_city` VALUES ('410781', '410781', '卫辉市', '4107', 3); +INSERT INTO `dic_city` VALUES ('410782', '410782', '辉县市', '4107', 3); +INSERT INTO `dic_city` VALUES ('410783', '410783', '长垣市', '4107', 3); +INSERT INTO `dic_city` VALUES ('4108', '4108', '焦作市', '41', 2); +INSERT INTO `dic_city` VALUES ('410802', '410802', '解放区', '4108', 3); +INSERT INTO `dic_city` VALUES ('410803', '410803', '中站区', '4108', 3); +INSERT INTO `dic_city` VALUES ('410804', '410804', '马村区', '4108', 3); +INSERT INTO `dic_city` VALUES ('410811', '410811', '山阳区', '4108', 3); +INSERT INTO `dic_city` VALUES ('410821', '410821', '修武县', '4108', 3); +INSERT INTO `dic_city` VALUES ('410822', '410822', '博爱县', '4108', 3); +INSERT INTO `dic_city` VALUES ('410823', '410823', '武陟县', '4108', 3); +INSERT INTO `dic_city` VALUES ('410825', '410825', '温县', '4108', 3); +INSERT INTO `dic_city` VALUES ('410871', '410871', '焦作城乡一体化示范区', '4108', 3); +INSERT INTO `dic_city` VALUES ('410882', '410882', '沁阳市', '4108', 3); +INSERT INTO `dic_city` VALUES ('410883', '410883', '孟州市', '4108', 3); +INSERT INTO `dic_city` VALUES ('4109', '4109', '濮阳市', '41', 2); +INSERT INTO `dic_city` VALUES ('410902', '410902', '华龙区', '4109', 3); +INSERT INTO `dic_city` VALUES ('410922', '410922', '清丰县', '4109', 3); +INSERT INTO `dic_city` VALUES ('410923', '410923', '南乐县', '4109', 3); +INSERT INTO `dic_city` VALUES ('410926', '410926', '范县', '4109', 3); +INSERT INTO `dic_city` VALUES ('410927', '410927', '台前县', '4109', 3); +INSERT INTO `dic_city` VALUES ('410928', '410928', '濮阳县', '4109', 3); +INSERT INTO `dic_city` VALUES ('410971', '410971', '河南濮阳工业园区', '4109', 3); +INSERT INTO `dic_city` VALUES ('410972', '410972', '濮阳经济技术开发区', '4109', 3); +INSERT INTO `dic_city` VALUES ('4110', '4110', '许昌市', '41', 2); +INSERT INTO `dic_city` VALUES ('411002', '411002', '魏都区', '4110', 3); +INSERT INTO `dic_city` VALUES ('411003', '411003', '建安区', '4110', 3); +INSERT INTO `dic_city` VALUES ('411024', '411024', '鄢陵县', '4110', 3); +INSERT INTO `dic_city` VALUES ('411025', '411025', '襄城县', '4110', 3); +INSERT INTO `dic_city` VALUES ('411071', '411071', '许昌经济技术开发区', '4110', 3); +INSERT INTO `dic_city` VALUES ('411081', '411081', '禹州市', '4110', 3); +INSERT INTO `dic_city` VALUES ('411082', '411082', '长葛市', '4110', 3); +INSERT INTO `dic_city` VALUES ('4111', '4111', '漯河市', '41', 2); +INSERT INTO `dic_city` VALUES ('411102', '411102', '源汇区', '4111', 3); +INSERT INTO `dic_city` VALUES ('411103', '411103', '郾城区', '4111', 3); +INSERT INTO `dic_city` VALUES ('411104', '411104', '召陵区', '4111', 3); +INSERT INTO `dic_city` VALUES ('411121', '411121', '舞阳县', '4111', 3); +INSERT INTO `dic_city` VALUES ('411122', '411122', '临颍县', '4111', 3); +INSERT INTO `dic_city` VALUES ('411171', '411171', '漯河经济技术开发区', '4111', 3); +INSERT INTO `dic_city` VALUES ('4112', '4112', '三门峡市', '41', 2); +INSERT INTO `dic_city` VALUES ('411202', '411202', '湖滨区', '4112', 3); +INSERT INTO `dic_city` VALUES ('411203', '411203', '陕州区', '4112', 3); +INSERT INTO `dic_city` VALUES ('411221', '411221', '渑池县', '4112', 3); +INSERT INTO `dic_city` VALUES ('411224', '411224', '卢氏县', '4112', 3); +INSERT INTO `dic_city` VALUES ('411271', '411271', '河南三门峡经济开发区', '4112', 3); +INSERT INTO `dic_city` VALUES ('411281', '411281', '义马市', '4112', 3); +INSERT INTO `dic_city` VALUES ('411282', '411282', '灵宝市', '4112', 3); +INSERT INTO `dic_city` VALUES ('4113', '4113', '南阳市', '41', 2); +INSERT INTO `dic_city` VALUES ('411302', '411302', '宛城区', '4113', 3); +INSERT INTO `dic_city` VALUES ('411303', '411303', '卧龙区', '4113', 3); +INSERT INTO `dic_city` VALUES ('411321', '411321', '南召县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411322', '411322', '方城县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411323', '411323', '西峡县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411324', '411324', '镇平县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411325', '411325', '内乡县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411326', '411326', '淅川县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411327', '411327', '社旗县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411328', '411328', '唐河县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411329', '411329', '新野县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411330', '411330', '桐柏县', '4113', 3); +INSERT INTO `dic_city` VALUES ('411371', '411371', '南阳高新技术产业开发区', '4113', 3); +INSERT INTO `dic_city` VALUES ('411372', '411372', '南阳市城乡一体化示范区', '4113', 3); +INSERT INTO `dic_city` VALUES ('411381', '411381', '邓州市', '4113', 3); +INSERT INTO `dic_city` VALUES ('4114', '4114', '商丘市', '41', 2); +INSERT INTO `dic_city` VALUES ('411402', '411402', '梁园区', '4114', 3); +INSERT INTO `dic_city` VALUES ('411403', '411403', '睢阳区', '4114', 3); +INSERT INTO `dic_city` VALUES ('411421', '411421', '民权县', '4114', 3); +INSERT INTO `dic_city` VALUES ('411422', '411422', '睢县', '4114', 3); +INSERT INTO `dic_city` VALUES ('411423', '411423', '宁陵县', '4114', 3); +INSERT INTO `dic_city` VALUES ('411424', '411424', '柘城县', '4114', 3); +INSERT INTO `dic_city` VALUES ('411425', '411425', '虞城县', '4114', 3); +INSERT INTO `dic_city` VALUES ('411426', '411426', '夏邑县', '4114', 3); +INSERT INTO `dic_city` VALUES ('411471', '411471', '豫东综合物流产业聚集区', '4114', 3); +INSERT INTO `dic_city` VALUES ('411472', '411472', '河南商丘经济开发区', '4114', 3); +INSERT INTO `dic_city` VALUES ('411481', '411481', '永城市', '4114', 3); +INSERT INTO `dic_city` VALUES ('4115', '4115', '信阳市', '41', 2); +INSERT INTO `dic_city` VALUES ('411502', '411502', '浉河区', '4115', 3); +INSERT INTO `dic_city` VALUES ('411503', '411503', '平桥区', '4115', 3); +INSERT INTO `dic_city` VALUES ('411521', '411521', '罗山县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411522', '411522', '光山县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411523', '411523', '新县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411524', '411524', '商城县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411525', '411525', '固始县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411526', '411526', '潢川县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411527', '411527', '淮滨县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411528', '411528', '息县', '4115', 3); +INSERT INTO `dic_city` VALUES ('411571', '411571', '信阳高新技术产业开发区', '4115', 3); +INSERT INTO `dic_city` VALUES ('4116', '4116', '周口市', '41', 2); +INSERT INTO `dic_city` VALUES ('411602', '411602', '川汇区', '4116', 3); +INSERT INTO `dic_city` VALUES ('411603', '411603', '淮阳区', '4116', 3); +INSERT INTO `dic_city` VALUES ('411621', '411621', '扶沟县', '4116', 3); +INSERT INTO `dic_city` VALUES ('411622', '411622', '西华县', '4116', 3); +INSERT INTO `dic_city` VALUES ('411623', '411623', '商水县', '4116', 3); +INSERT INTO `dic_city` VALUES ('411624', '411624', '沈丘县', '4116', 3); +INSERT INTO `dic_city` VALUES ('411625', '411625', '郸城县', '4116', 3); +INSERT INTO `dic_city` VALUES ('411627', '411627', '太康县', '4116', 3); +INSERT INTO `dic_city` VALUES ('411628', '411628', '鹿邑县', '4116', 3); +INSERT INTO `dic_city` VALUES ('411671', '411671', '河南周口经济开发区', '4116', 3); +INSERT INTO `dic_city` VALUES ('411681', '411681', '项城市', '4116', 3); +INSERT INTO `dic_city` VALUES ('4117', '4117', '驻马店市', '41', 2); +INSERT INTO `dic_city` VALUES ('411702', '411702', '驿城区', '4117', 3); +INSERT INTO `dic_city` VALUES ('411721', '411721', '西平县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411722', '411722', '上蔡县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411723', '411723', '平舆县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411724', '411724', '正阳县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411725', '411725', '确山县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411726', '411726', '泌阳县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411727', '411727', '汝南县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411728', '411728', '遂平县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411729', '411729', '新蔡县', '4117', 3); +INSERT INTO `dic_city` VALUES ('411771', '411771', '河南驻马店经济开发区', '4117', 3); +INSERT INTO `dic_city` VALUES ('4190', '4190', '省直辖县级行政区划', '41', 2); +INSERT INTO `dic_city` VALUES ('419001', '419001', '济源市', '4190', 3); +INSERT INTO `dic_city` VALUES ('42', '42', '湖北省', NULL, 1); +INSERT INTO `dic_city` VALUES ('4201', '4201', '武汉市', '42', 2); +INSERT INTO `dic_city` VALUES ('420102', '420102', '江岸区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420103', '420103', '江汉区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420104', '420104', '硚口区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420105', '420105', '汉阳区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420106', '420106', '武昌区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420107', '420107', '青山区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420111', '420111', '洪山区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420112', '420112', '东西湖区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420113', '420113', '汉南区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420114', '420114', '蔡甸区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420115', '420115', '江夏区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420116', '420116', '黄陂区', '4201', 3); +INSERT INTO `dic_city` VALUES ('420117', '420117', '新洲区', '4201', 3); +INSERT INTO `dic_city` VALUES ('4202', '4202', '黄石市', '42', 2); +INSERT INTO `dic_city` VALUES ('420202', '420202', '黄石港区', '4202', 3); +INSERT INTO `dic_city` VALUES ('420203', '420203', '西塞山区', '4202', 3); +INSERT INTO `dic_city` VALUES ('420204', '420204', '下陆区', '4202', 3); +INSERT INTO `dic_city` VALUES ('420205', '420205', '铁山区', '4202', 3); +INSERT INTO `dic_city` VALUES ('420222', '420222', '阳新县', '4202', 3); +INSERT INTO `dic_city` VALUES ('420281', '420281', '大冶市', '4202', 3); +INSERT INTO `dic_city` VALUES ('4203', '4203', '十堰市', '42', 2); +INSERT INTO `dic_city` VALUES ('420302', '420302', '茅箭区', '4203', 3); +INSERT INTO `dic_city` VALUES ('420303', '420303', '张湾区', '4203', 3); +INSERT INTO `dic_city` VALUES ('420304', '420304', '郧阳区', '4203', 3); +INSERT INTO `dic_city` VALUES ('420322', '420322', '郧西县', '4203', 3); +INSERT INTO `dic_city` VALUES ('420323', '420323', '竹山县', '4203', 3); +INSERT INTO `dic_city` VALUES ('420324', '420324', '竹溪县', '4203', 3); +INSERT INTO `dic_city` VALUES ('420325', '420325', '房县', '4203', 3); +INSERT INTO `dic_city` VALUES ('420381', '420381', '丹江口市', '4203', 3); +INSERT INTO `dic_city` VALUES ('4205', '4205', '宜昌市', '42', 2); +INSERT INTO `dic_city` VALUES ('420502', '420502', '西陵区', '4205', 3); +INSERT INTO `dic_city` VALUES ('420503', '420503', '伍家岗区', '4205', 3); +INSERT INTO `dic_city` VALUES ('420504', '420504', '点军区', '4205', 3); +INSERT INTO `dic_city` VALUES ('420505', '420505', '猇亭区', '4205', 3); +INSERT INTO `dic_city` VALUES ('420506', '420506', '夷陵区', '4205', 3); +INSERT INTO `dic_city` VALUES ('420525', '420525', '远安县', '4205', 3); +INSERT INTO `dic_city` VALUES ('420526', '420526', '兴山县', '4205', 3); +INSERT INTO `dic_city` VALUES ('420527', '420527', '秭归县', '4205', 3); +INSERT INTO `dic_city` VALUES ('420528', '420528', '长阳土家族自治县', '4205', 3); +INSERT INTO `dic_city` VALUES ('420529', '420529', '五峰土家族自治县', '4205', 3); +INSERT INTO `dic_city` VALUES ('420581', '420581', '宜都市', '4205', 3); +INSERT INTO `dic_city` VALUES ('420582', '420582', '当阳市', '4205', 3); +INSERT INTO `dic_city` VALUES ('420583', '420583', '枝江市', '4205', 3); +INSERT INTO `dic_city` VALUES ('4206', '4206', '襄阳市', '42', 2); +INSERT INTO `dic_city` VALUES ('420602', '420602', '襄城区', '4206', 3); +INSERT INTO `dic_city` VALUES ('420606', '420606', '樊城区', '4206', 3); +INSERT INTO `dic_city` VALUES ('420607', '420607', '襄州区', '4206', 3); +INSERT INTO `dic_city` VALUES ('420624', '420624', '南漳县', '4206', 3); +INSERT INTO `dic_city` VALUES ('420625', '420625', '谷城县', '4206', 3); +INSERT INTO `dic_city` VALUES ('420626', '420626', '保康县', '4206', 3); +INSERT INTO `dic_city` VALUES ('420682', '420682', '老河口市', '4206', 3); +INSERT INTO `dic_city` VALUES ('420683', '420683', '枣阳市', '4206', 3); +INSERT INTO `dic_city` VALUES ('420684', '420684', '宜城市', '4206', 3); +INSERT INTO `dic_city` VALUES ('4207', '4207', '鄂州市', '42', 2); +INSERT INTO `dic_city` VALUES ('420702', '420702', '梁子湖区', '4207', 3); +INSERT INTO `dic_city` VALUES ('420703', '420703', '华容区', '4207', 3); +INSERT INTO `dic_city` VALUES ('420704', '420704', '鄂城区', '4207', 3); +INSERT INTO `dic_city` VALUES ('4208', '4208', '荆门市', '42', 2); +INSERT INTO `dic_city` VALUES ('420802', '420802', '东宝区', '4208', 3); +INSERT INTO `dic_city` VALUES ('420804', '420804', '掇刀区', '4208', 3); +INSERT INTO `dic_city` VALUES ('420822', '420822', '沙洋县', '4208', 3); +INSERT INTO `dic_city` VALUES ('420881', '420881', '钟祥市', '4208', 3); +INSERT INTO `dic_city` VALUES ('420882', '420882', '京山市', '4208', 3); +INSERT INTO `dic_city` VALUES ('4209', '4209', '孝感市', '42', 2); +INSERT INTO `dic_city` VALUES ('420902', '420902', '孝南区', '4209', 3); +INSERT INTO `dic_city` VALUES ('420921', '420921', '孝昌县', '4209', 3); +INSERT INTO `dic_city` VALUES ('420922', '420922', '大悟县', '4209', 3); +INSERT INTO `dic_city` VALUES ('420923', '420923', '云梦县', '4209', 3); +INSERT INTO `dic_city` VALUES ('420981', '420981', '应城市', '4209', 3); +INSERT INTO `dic_city` VALUES ('420982', '420982', '安陆市', '4209', 3); +INSERT INTO `dic_city` VALUES ('420984', '420984', '汉川市', '4209', 3); +INSERT INTO `dic_city` VALUES ('4210', '4210', '荆州市', '42', 2); +INSERT INTO `dic_city` VALUES ('421002', '421002', '沙市区', '4210', 3); +INSERT INTO `dic_city` VALUES ('421003', '421003', '荆州区', '4210', 3); +INSERT INTO `dic_city` VALUES ('421022', '421022', '公安县', '4210', 3); +INSERT INTO `dic_city` VALUES ('421023', '421023', '监利县', '4210', 3); +INSERT INTO `dic_city` VALUES ('421024', '421024', '江陵县', '4210', 3); +INSERT INTO `dic_city` VALUES ('421071', '421071', '荆州经济技术开发区', '4210', 3); +INSERT INTO `dic_city` VALUES ('421081', '421081', '石首市', '4210', 3); +INSERT INTO `dic_city` VALUES ('421083', '421083', '洪湖市', '4210', 3); +INSERT INTO `dic_city` VALUES ('421087', '421087', '松滋市', '4210', 3); +INSERT INTO `dic_city` VALUES ('4211', '4211', '黄冈市', '42', 2); +INSERT INTO `dic_city` VALUES ('421102', '421102', '黄州区', '4211', 3); +INSERT INTO `dic_city` VALUES ('421121', '421121', '团风县', '4211', 3); +INSERT INTO `dic_city` VALUES ('421122', '421122', '红安县', '4211', 3); +INSERT INTO `dic_city` VALUES ('421123', '421123', '罗田县', '4211', 3); +INSERT INTO `dic_city` VALUES ('421124', '421124', '英山县', '4211', 3); +INSERT INTO `dic_city` VALUES ('421125', '421125', '浠水县', '4211', 3); +INSERT INTO `dic_city` VALUES ('421126', '421126', '蕲春县', '4211', 3); +INSERT INTO `dic_city` VALUES ('421127', '421127', '黄梅县', '4211', 3); +INSERT INTO `dic_city` VALUES ('421171', '421171', '龙感湖管理区', '4211', 3); +INSERT INTO `dic_city` VALUES ('421181', '421181', '麻城市', '4211', 3); +INSERT INTO `dic_city` VALUES ('421182', '421182', '武穴市', '4211', 3); +INSERT INTO `dic_city` VALUES ('4212', '4212', '咸宁市', '42', 2); +INSERT INTO `dic_city` VALUES ('421202', '421202', '咸安区', '4212', 3); +INSERT INTO `dic_city` VALUES ('421221', '421221', '嘉鱼县', '4212', 3); +INSERT INTO `dic_city` VALUES ('421222', '421222', '通城县', '4212', 3); +INSERT INTO `dic_city` VALUES ('421223', '421223', '崇阳县', '4212', 3); +INSERT INTO `dic_city` VALUES ('421224', '421224', '通山县', '4212', 3); +INSERT INTO `dic_city` VALUES ('421281', '421281', '赤壁市', '4212', 3); +INSERT INTO `dic_city` VALUES ('4213', '4213', '随州市', '42', 2); +INSERT INTO `dic_city` VALUES ('421303', '421303', '曾都区', '4213', 3); +INSERT INTO `dic_city` VALUES ('421321', '421321', '随县', '4213', 3); +INSERT INTO `dic_city` VALUES ('421381', '421381', '广水市', '4213', 3); +INSERT INTO `dic_city` VALUES ('4228', '4228', '恩施土家族苗族自治州', '42', 2); +INSERT INTO `dic_city` VALUES ('422801', '422801', '恩施市', '4228', 3); +INSERT INTO `dic_city` VALUES ('422802', '422802', '利川市', '4228', 3); +INSERT INTO `dic_city` VALUES ('422822', '422822', '建始县', '4228', 3); +INSERT INTO `dic_city` VALUES ('422823', '422823', '巴东县', '4228', 3); +INSERT INTO `dic_city` VALUES ('422825', '422825', '宣恩县', '4228', 3); +INSERT INTO `dic_city` VALUES ('422826', '422826', '咸丰县', '4228', 3); +INSERT INTO `dic_city` VALUES ('422827', '422827', '来凤县', '4228', 3); +INSERT INTO `dic_city` VALUES ('422828', '422828', '鹤峰县', '4228', 3); +INSERT INTO `dic_city` VALUES ('4290', '4290', '省直辖县级行政区划', '42', 2); +INSERT INTO `dic_city` VALUES ('429004', '429004', '仙桃市', '4290', 3); +INSERT INTO `dic_city` VALUES ('429005', '429005', '潜江市', '4290', 3); +INSERT INTO `dic_city` VALUES ('429006', '429006', '天门市', '4290', 3); +INSERT INTO `dic_city` VALUES ('429021', '429021', '神农架林区', '4290', 3); +INSERT INTO `dic_city` VALUES ('43', '43', '湖南省', NULL, 1); +INSERT INTO `dic_city` VALUES ('4301', '4301', '长沙市', '43', 2); +INSERT INTO `dic_city` VALUES ('430102', '430102', '芙蓉区', '4301', 3); +INSERT INTO `dic_city` VALUES ('430103', '430103', '天心区', '4301', 3); +INSERT INTO `dic_city` VALUES ('430104', '430104', '岳麓区', '4301', 3); +INSERT INTO `dic_city` VALUES ('430105', '430105', '开福区', '4301', 3); +INSERT INTO `dic_city` VALUES ('430111', '430111', '雨花区', '4301', 3); +INSERT INTO `dic_city` VALUES ('430112', '430112', '望城区', '4301', 3); +INSERT INTO `dic_city` VALUES ('430121', '430121', '长沙县', '4301', 3); +INSERT INTO `dic_city` VALUES ('430181', '430181', '浏阳市', '4301', 3); +INSERT INTO `dic_city` VALUES ('430182', '430182', '宁乡市', '4301', 3); +INSERT INTO `dic_city` VALUES ('4302', '4302', '株洲市', '43', 2); +INSERT INTO `dic_city` VALUES ('430202', '430202', '荷塘区', '4302', 3); +INSERT INTO `dic_city` VALUES ('430203', '430203', '芦淞区', '4302', 3); +INSERT INTO `dic_city` VALUES ('430204', '430204', '石峰区', '4302', 3); +INSERT INTO `dic_city` VALUES ('430211', '430211', '天元区', '4302', 3); +INSERT INTO `dic_city` VALUES ('430212', '430212', '渌口区', '4302', 3); +INSERT INTO `dic_city` VALUES ('430223', '430223', '攸县', '4302', 3); +INSERT INTO `dic_city` VALUES ('430224', '430224', '茶陵县', '4302', 3); +INSERT INTO `dic_city` VALUES ('430225', '430225', '炎陵县', '4302', 3); +INSERT INTO `dic_city` VALUES ('430271', '430271', '云龙示范区', '4302', 3); +INSERT INTO `dic_city` VALUES ('430281', '430281', '醴陵市', '4302', 3); +INSERT INTO `dic_city` VALUES ('4303', '4303', '湘潭市', '43', 2); +INSERT INTO `dic_city` VALUES ('430302', '430302', '雨湖区', '4303', 3); +INSERT INTO `dic_city` VALUES ('430304', '430304', '岳塘区', '4303', 3); +INSERT INTO `dic_city` VALUES ('430321', '430321', '湘潭县', '4303', 3); +INSERT INTO `dic_city` VALUES ('430371', '430371', '湖南湘潭高新技术产业园区', '4303', 3); +INSERT INTO `dic_city` VALUES ('430372', '430372', '湘潭昭山示范区', '4303', 3); +INSERT INTO `dic_city` VALUES ('430373', '430373', '湘潭九华示范区', '4303', 3); +INSERT INTO `dic_city` VALUES ('430381', '430381', '湘乡市', '4303', 3); +INSERT INTO `dic_city` VALUES ('430382', '430382', '韶山市', '4303', 3); +INSERT INTO `dic_city` VALUES ('4304', '4304', '衡阳市', '43', 2); +INSERT INTO `dic_city` VALUES ('430405', '430405', '珠晖区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430406', '430406', '雁峰区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430407', '430407', '石鼓区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430408', '430408', '蒸湘区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430412', '430412', '南岳区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430421', '430421', '衡阳县', '4304', 3); +INSERT INTO `dic_city` VALUES ('430422', '430422', '衡南县', '4304', 3); +INSERT INTO `dic_city` VALUES ('430423', '430423', '衡山县', '4304', 3); +INSERT INTO `dic_city` VALUES ('430424', '430424', '衡东县', '4304', 3); +INSERT INTO `dic_city` VALUES ('430426', '430426', '祁东县', '4304', 3); +INSERT INTO `dic_city` VALUES ('430471', '430471', '衡阳综合保税区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430472', '430472', '湖南衡阳高新技术产业园区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430473', '430473', '湖南衡阳松木经济开发区', '4304', 3); +INSERT INTO `dic_city` VALUES ('430481', '430481', '耒阳市', '4304', 3); +INSERT INTO `dic_city` VALUES ('430482', '430482', '常宁市', '4304', 3); +INSERT INTO `dic_city` VALUES ('4305', '4305', '邵阳市', '43', 2); +INSERT INTO `dic_city` VALUES ('430502', '430502', '双清区', '4305', 3); +INSERT INTO `dic_city` VALUES ('430503', '430503', '大祥区', '4305', 3); +INSERT INTO `dic_city` VALUES ('430511', '430511', '北塔区', '4305', 3); +INSERT INTO `dic_city` VALUES ('430522', '430522', '新邵县', '4305', 3); +INSERT INTO `dic_city` VALUES ('430523', '430523', '邵阳县', '4305', 3); +INSERT INTO `dic_city` VALUES ('430524', '430524', '隆回县', '4305', 3); +INSERT INTO `dic_city` VALUES ('430525', '430525', '洞口县', '4305', 3); +INSERT INTO `dic_city` VALUES ('430527', '430527', '绥宁县', '4305', 3); +INSERT INTO `dic_city` VALUES ('430528', '430528', '新宁县', '4305', 3); +INSERT INTO `dic_city` VALUES ('430529', '430529', '城步苗族自治县', '4305', 3); +INSERT INTO `dic_city` VALUES ('430581', '430581', '武冈市', '4305', 3); +INSERT INTO `dic_city` VALUES ('430582', '430582', '邵东市', '4305', 3); +INSERT INTO `dic_city` VALUES ('4306', '4306', '岳阳市', '43', 2); +INSERT INTO `dic_city` VALUES ('430602', '430602', '岳阳楼区', '4306', 3); +INSERT INTO `dic_city` VALUES ('430603', '430603', '云溪区', '4306', 3); +INSERT INTO `dic_city` VALUES ('430611', '430611', '君山区', '4306', 3); +INSERT INTO `dic_city` VALUES ('430621', '430621', '岳阳县', '4306', 3); +INSERT INTO `dic_city` VALUES ('430623', '430623', '华容县', '4306', 3); +INSERT INTO `dic_city` VALUES ('430624', '430624', '湘阴县', '4306', 3); +INSERT INTO `dic_city` VALUES ('430626', '430626', '平江县', '4306', 3); +INSERT INTO `dic_city` VALUES ('430671', '430671', '岳阳市屈原管理区', '4306', 3); +INSERT INTO `dic_city` VALUES ('430681', '430681', '汨罗市', '4306', 3); +INSERT INTO `dic_city` VALUES ('430682', '430682', '临湘市', '4306', 3); +INSERT INTO `dic_city` VALUES ('4307', '4307', '常德市', '43', 2); +INSERT INTO `dic_city` VALUES ('430702', '430702', '武陵区', '4307', 3); +INSERT INTO `dic_city` VALUES ('430703', '430703', '鼎城区', '4307', 3); +INSERT INTO `dic_city` VALUES ('430721', '430721', '安乡县', '4307', 3); +INSERT INTO `dic_city` VALUES ('430722', '430722', '汉寿县', '4307', 3); +INSERT INTO `dic_city` VALUES ('430723', '430723', '澧县', '4307', 3); +INSERT INTO `dic_city` VALUES ('430724', '430724', '临澧县', '4307', 3); +INSERT INTO `dic_city` VALUES ('430725', '430725', '桃源县', '4307', 3); +INSERT INTO `dic_city` VALUES ('430726', '430726', '石门县', '4307', 3); +INSERT INTO `dic_city` VALUES ('430771', '430771', '常德市西洞庭管理区', '4307', 3); +INSERT INTO `dic_city` VALUES ('430781', '430781', '津市市', '4307', 3); +INSERT INTO `dic_city` VALUES ('4308', '4308', '张家界市', '43', 2); +INSERT INTO `dic_city` VALUES ('430802', '430802', '永定区', '4308', 3); +INSERT INTO `dic_city` VALUES ('430811', '430811', '武陵源区', '4308', 3); +INSERT INTO `dic_city` VALUES ('430821', '430821', '慈利县', '4308', 3); +INSERT INTO `dic_city` VALUES ('430822', '430822', '桑植县', '4308', 3); +INSERT INTO `dic_city` VALUES ('4309', '4309', '益阳市', '43', 2); +INSERT INTO `dic_city` VALUES ('430902', '430902', '资阳区', '4309', 3); +INSERT INTO `dic_city` VALUES ('430903', '430903', '赫山区', '4309', 3); +INSERT INTO `dic_city` VALUES ('430921', '430921', '南县', '4309', 3); +INSERT INTO `dic_city` VALUES ('430922', '430922', '桃江县', '4309', 3); +INSERT INTO `dic_city` VALUES ('430923', '430923', '安化县', '4309', 3); +INSERT INTO `dic_city` VALUES ('430971', '430971', '益阳市大通湖管理区', '4309', 3); +INSERT INTO `dic_city` VALUES ('430972', '430972', '湖南益阳高新技术产业园区', '4309', 3); +INSERT INTO `dic_city` VALUES ('430981', '430981', '沅江市', '4309', 3); +INSERT INTO `dic_city` VALUES ('4310', '4310', '郴州市', '43', 2); +INSERT INTO `dic_city` VALUES ('431002', '431002', '北湖区', '4310', 3); +INSERT INTO `dic_city` VALUES ('431003', '431003', '苏仙区', '4310', 3); +INSERT INTO `dic_city` VALUES ('431021', '431021', '桂阳县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431022', '431022', '宜章县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431023', '431023', '永兴县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431024', '431024', '嘉禾县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431025', '431025', '临武县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431026', '431026', '汝城县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431027', '431027', '桂东县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431028', '431028', '安仁县', '4310', 3); +INSERT INTO `dic_city` VALUES ('431081', '431081', '资兴市', '4310', 3); +INSERT INTO `dic_city` VALUES ('4311', '4311', '永州市', '43', 2); +INSERT INTO `dic_city` VALUES ('431102', '431102', '零陵区', '4311', 3); +INSERT INTO `dic_city` VALUES ('431103', '431103', '冷水滩区', '4311', 3); +INSERT INTO `dic_city` VALUES ('431121', '431121', '祁阳县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431122', '431122', '东安县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431123', '431123', '双牌县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431124', '431124', '道县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431125', '431125', '江永县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431126', '431126', '宁远县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431127', '431127', '蓝山县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431128', '431128', '新田县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431129', '431129', '江华瑶族自治县', '4311', 3); +INSERT INTO `dic_city` VALUES ('431171', '431171', '永州经济技术开发区', '4311', 3); +INSERT INTO `dic_city` VALUES ('431172', '431172', '永州市金洞管理区', '4311', 3); +INSERT INTO `dic_city` VALUES ('431173', '431173', '永州市回龙圩管理区', '4311', 3); +INSERT INTO `dic_city` VALUES ('4312', '4312', '怀化市', '43', 2); +INSERT INTO `dic_city` VALUES ('431202', '431202', '鹤城区', '4312', 3); +INSERT INTO `dic_city` VALUES ('431221', '431221', '中方县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431222', '431222', '沅陵县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431223', '431223', '辰溪县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431224', '431224', '溆浦县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431225', '431225', '会同县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431226', '431226', '麻阳苗族自治县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431227', '431227', '新晃侗族自治县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431228', '431228', '芷江侗族自治县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431229', '431229', '靖州苗族侗族自治县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431230', '431230', '通道侗族自治县', '4312', 3); +INSERT INTO `dic_city` VALUES ('431271', '431271', '怀化市洪江管理区', '4312', 3); +INSERT INTO `dic_city` VALUES ('431281', '431281', '洪江市', '4312', 3); +INSERT INTO `dic_city` VALUES ('4313', '4313', '娄底市', '43', 2); +INSERT INTO `dic_city` VALUES ('431302', '431302', '娄星区', '4313', 3); +INSERT INTO `dic_city` VALUES ('431321', '431321', '双峰县', '4313', 3); +INSERT INTO `dic_city` VALUES ('431322', '431322', '新化县', '4313', 3); +INSERT INTO `dic_city` VALUES ('431381', '431381', '冷水江市', '4313', 3); +INSERT INTO `dic_city` VALUES ('431382', '431382', '涟源市', '4313', 3); +INSERT INTO `dic_city` VALUES ('4331', '4331', '湘西土家族苗族自治州', '43', 2); +INSERT INTO `dic_city` VALUES ('433101', '433101', '吉首市', '4331', 3); +INSERT INTO `dic_city` VALUES ('433122', '433122', '泸溪县', '4331', 3); +INSERT INTO `dic_city` VALUES ('433123', '433123', '凤凰县', '4331', 3); +INSERT INTO `dic_city` VALUES ('433124', '433124', '花垣县', '4331', 3); +INSERT INTO `dic_city` VALUES ('433125', '433125', '保靖县', '4331', 3); +INSERT INTO `dic_city` VALUES ('433126', '433126', '古丈县', '4331', 3); +INSERT INTO `dic_city` VALUES ('433127', '433127', '永顺县', '4331', 3); +INSERT INTO `dic_city` VALUES ('433130', '433130', '龙山县', '4331', 3); +INSERT INTO `dic_city` VALUES ('44', '44', '广东省', NULL, 1); +INSERT INTO `dic_city` VALUES ('4401', '4401', '广州市', '44', 2); +INSERT INTO `dic_city` VALUES ('440103', '440103', '荔湾区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440104', '440104', '越秀区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440105', '440105', '海珠区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440106', '440106', '天河区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440111', '440111', '白云区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440112', '440112', '黄埔区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440113', '440113', '番禺区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440114', '440114', '花都区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440115', '440115', '南沙区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440117', '440117', '从化区', '4401', 3); +INSERT INTO `dic_city` VALUES ('440118', '440118', '增城区', '4401', 3); +INSERT INTO `dic_city` VALUES ('4402', '4402', '韶关市', '44', 2); +INSERT INTO `dic_city` VALUES ('440203', '440203', '武江区', '4402', 3); +INSERT INTO `dic_city` VALUES ('440204', '440204', '浈江区', '4402', 3); +INSERT INTO `dic_city` VALUES ('440205', '440205', '曲江区', '4402', 3); +INSERT INTO `dic_city` VALUES ('440222', '440222', '始兴县', '4402', 3); +INSERT INTO `dic_city` VALUES ('440224', '440224', '仁化县', '4402', 3); +INSERT INTO `dic_city` VALUES ('440229', '440229', '翁源县', '4402', 3); +INSERT INTO `dic_city` VALUES ('440232', '440232', '乳源瑶族自治县', '4402', 3); +INSERT INTO `dic_city` VALUES ('440233', '440233', '新丰县', '4402', 3); +INSERT INTO `dic_city` VALUES ('440281', '440281', '乐昌市', '4402', 3); +INSERT INTO `dic_city` VALUES ('440282', '440282', '南雄市', '4402', 3); +INSERT INTO `dic_city` VALUES ('4403', '4403', '深圳市', '44', 2); +INSERT INTO `dic_city` VALUES ('440303', '440303', '罗湖区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440304', '440304', '福田区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440305', '440305', '南山区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440306', '440306', '宝安区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440307', '440307', '龙岗区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440308', '440308', '盐田区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440309', '440309', '龙华区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440310', '440310', '坪山区', '4403', 3); +INSERT INTO `dic_city` VALUES ('440311', '440311', '光明区', '4403', 3); +INSERT INTO `dic_city` VALUES ('4404', '4404', '珠海市', '44', 2); +INSERT INTO `dic_city` VALUES ('440402', '440402', '香洲区', '4404', 3); +INSERT INTO `dic_city` VALUES ('440403', '440403', '斗门区', '4404', 3); +INSERT INTO `dic_city` VALUES ('440404', '440404', '金湾区', '4404', 3); +INSERT INTO `dic_city` VALUES ('4405', '4405', '汕头市', '44', 2); +INSERT INTO `dic_city` VALUES ('440507', '440507', '龙湖区', '4405', 3); +INSERT INTO `dic_city` VALUES ('440511', '440511', '金平区', '4405', 3); +INSERT INTO `dic_city` VALUES ('440512', '440512', '濠江区', '4405', 3); +INSERT INTO `dic_city` VALUES ('440513', '440513', '潮阳区', '4405', 3); +INSERT INTO `dic_city` VALUES ('440514', '440514', '潮南区', '4405', 3); +INSERT INTO `dic_city` VALUES ('440515', '440515', '澄海区', '4405', 3); +INSERT INTO `dic_city` VALUES ('440523', '440523', '南澳县', '4405', 3); +INSERT INTO `dic_city` VALUES ('4406', '4406', '佛山市', '44', 2); +INSERT INTO `dic_city` VALUES ('440604', '440604', '禅城区', '4406', 3); +INSERT INTO `dic_city` VALUES ('440605', '440605', '南海区', '4406', 3); +INSERT INTO `dic_city` VALUES ('440606', '440606', '顺德区', '4406', 3); +INSERT INTO `dic_city` VALUES ('440607', '440607', '三水区', '4406', 3); +INSERT INTO `dic_city` VALUES ('440608', '440608', '高明区', '4406', 3); +INSERT INTO `dic_city` VALUES ('4407', '4407', '江门市', '44', 2); +INSERT INTO `dic_city` VALUES ('440703', '440703', '蓬江区', '4407', 3); +INSERT INTO `dic_city` VALUES ('440704', '440704', '江海区', '4407', 3); +INSERT INTO `dic_city` VALUES ('440705', '440705', '新会区', '4407', 3); +INSERT INTO `dic_city` VALUES ('440781', '440781', '台山市', '4407', 3); +INSERT INTO `dic_city` VALUES ('440783', '440783', '开平市', '4407', 3); +INSERT INTO `dic_city` VALUES ('440784', '440784', '鹤山市', '4407', 3); +INSERT INTO `dic_city` VALUES ('440785', '440785', '恩平市', '4407', 3); +INSERT INTO `dic_city` VALUES ('4408', '4408', '湛江市', '44', 2); +INSERT INTO `dic_city` VALUES ('440802', '440802', '赤坎区', '4408', 3); +INSERT INTO `dic_city` VALUES ('440803', '440803', '霞山区', '4408', 3); +INSERT INTO `dic_city` VALUES ('440804', '440804', '坡头区', '4408', 3); +INSERT INTO `dic_city` VALUES ('440811', '440811', '麻章区', '4408', 3); +INSERT INTO `dic_city` VALUES ('440823', '440823', '遂溪县', '4408', 3); +INSERT INTO `dic_city` VALUES ('440825', '440825', '徐闻县', '4408', 3); +INSERT INTO `dic_city` VALUES ('440881', '440881', '廉江市', '4408', 3); +INSERT INTO `dic_city` VALUES ('440882', '440882', '雷州市', '4408', 3); +INSERT INTO `dic_city` VALUES ('440883', '440883', '吴川市', '4408', 3); +INSERT INTO `dic_city` VALUES ('4409', '4409', '茂名市', '44', 2); +INSERT INTO `dic_city` VALUES ('440902', '440902', '茂南区', '4409', 3); +INSERT INTO `dic_city` VALUES ('440904', '440904', '电白区', '4409', 3); +INSERT INTO `dic_city` VALUES ('440981', '440981', '高州市', '4409', 3); +INSERT INTO `dic_city` VALUES ('440982', '440982', '化州市', '4409', 3); +INSERT INTO `dic_city` VALUES ('440983', '440983', '信宜市', '4409', 3); +INSERT INTO `dic_city` VALUES ('4412', '4412', '肇庆市', '44', 2); +INSERT INTO `dic_city` VALUES ('441202', '441202', '端州区', '4412', 3); +INSERT INTO `dic_city` VALUES ('441203', '441203', '鼎湖区', '4412', 3); +INSERT INTO `dic_city` VALUES ('441204', '441204', '高要区', '4412', 3); +INSERT INTO `dic_city` VALUES ('441223', '441223', '广宁县', '4412', 3); +INSERT INTO `dic_city` VALUES ('441224', '441224', '怀集县', '4412', 3); +INSERT INTO `dic_city` VALUES ('441225', '441225', '封开县', '4412', 3); +INSERT INTO `dic_city` VALUES ('441226', '441226', '德庆县', '4412', 3); +INSERT INTO `dic_city` VALUES ('441284', '441284', '四会市', '4412', 3); +INSERT INTO `dic_city` VALUES ('4413', '4413', '惠州市', '44', 2); +INSERT INTO `dic_city` VALUES ('441302', '441302', '惠城区', '4413', 3); +INSERT INTO `dic_city` VALUES ('441303', '441303', '惠阳区', '4413', 3); +INSERT INTO `dic_city` VALUES ('441322', '441322', '博罗县', '4413', 3); +INSERT INTO `dic_city` VALUES ('441323', '441323', '惠东县', '4413', 3); +INSERT INTO `dic_city` VALUES ('441324', '441324', '龙门县', '4413', 3); +INSERT INTO `dic_city` VALUES ('4414', '4414', '梅州市', '44', 2); +INSERT INTO `dic_city` VALUES ('441402', '441402', '梅江区', '4414', 3); +INSERT INTO `dic_city` VALUES ('441403', '441403', '梅县区', '4414', 3); +INSERT INTO `dic_city` VALUES ('441422', '441422', '大埔县', '4414', 3); +INSERT INTO `dic_city` VALUES ('441423', '441423', '丰顺县', '4414', 3); +INSERT INTO `dic_city` VALUES ('441424', '441424', '五华县', '4414', 3); +INSERT INTO `dic_city` VALUES ('441426', '441426', '平远县', '4414', 3); +INSERT INTO `dic_city` VALUES ('441427', '441427', '蕉岭县', '4414', 3); +INSERT INTO `dic_city` VALUES ('441481', '441481', '兴宁市', '4414', 3); +INSERT INTO `dic_city` VALUES ('4415', '4415', '汕尾市', '44', 2); +INSERT INTO `dic_city` VALUES ('441502', '441502', '城区', '4415', 3); +INSERT INTO `dic_city` VALUES ('441521', '441521', '海丰县', '4415', 3); +INSERT INTO `dic_city` VALUES ('441523', '441523', '陆河县', '4415', 3); +INSERT INTO `dic_city` VALUES ('441581', '441581', '陆丰市', '4415', 3); +INSERT INTO `dic_city` VALUES ('4416', '4416', '河源市', '44', 2); +INSERT INTO `dic_city` VALUES ('441602', '441602', '源城区', '4416', 3); +INSERT INTO `dic_city` VALUES ('441621', '441621', '紫金县', '4416', 3); +INSERT INTO `dic_city` VALUES ('441622', '441622', '龙川县', '4416', 3); +INSERT INTO `dic_city` VALUES ('441623', '441623', '连平县', '4416', 3); +INSERT INTO `dic_city` VALUES ('441624', '441624', '和平县', '4416', 3); +INSERT INTO `dic_city` VALUES ('441625', '441625', '东源县', '4416', 3); +INSERT INTO `dic_city` VALUES ('4417', '4417', '阳江市', '44', 2); +INSERT INTO `dic_city` VALUES ('441702', '441702', '江城区', '4417', 3); +INSERT INTO `dic_city` VALUES ('441704', '441704', '阳东区', '4417', 3); +INSERT INTO `dic_city` VALUES ('441721', '441721', '阳西县', '4417', 3); +INSERT INTO `dic_city` VALUES ('441781', '441781', '阳春市', '4417', 3); +INSERT INTO `dic_city` VALUES ('4418', '4418', '清远市', '44', 2); +INSERT INTO `dic_city` VALUES ('441802', '441802', '清城区', '4418', 3); +INSERT INTO `dic_city` VALUES ('441803', '441803', '清新区', '4418', 3); +INSERT INTO `dic_city` VALUES ('441821', '441821', '佛冈县', '4418', 3); +INSERT INTO `dic_city` VALUES ('441823', '441823', '阳山县', '4418', 3); +INSERT INTO `dic_city` VALUES ('441825', '441825', '连山壮族瑶族自治县', '4418', 3); +INSERT INTO `dic_city` VALUES ('441826', '441826', '连南瑶族自治县', '4418', 3); +INSERT INTO `dic_city` VALUES ('441881', '441881', '英德市', '4418', 3); +INSERT INTO `dic_city` VALUES ('441882', '441882', '连州市', '4418', 3); +INSERT INTO `dic_city` VALUES ('4419', '4419', '东莞市', '44', 2); +INSERT INTO `dic_city` VALUES ('441900003', '441900003', '东城街道', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900004', '441900004', '南城街道', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900005', '441900005', '万江街道', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900006', '441900006', '莞城街道', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900101', '441900101', '石碣镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900102', '441900102', '石龙镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900103', '441900103', '茶山镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900104', '441900104', '石排镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900105', '441900105', '企石镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900106', '441900106', '横沥镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900107', '441900107', '桥头镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900108', '441900108', '谢岗镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900109', '441900109', '东坑镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900110', '441900110', '常平镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900111', '441900111', '寮步镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900112', '441900112', '樟木头镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900113', '441900113', '大朗镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900114', '441900114', '黄江镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900115', '441900115', '清溪镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900116', '441900116', '塘厦镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900117', '441900117', '凤岗镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900118', '441900118', '大岭山镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900119', '441900119', '长安镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900121', '441900121', '虎门镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900122', '441900122', '厚街镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900123', '441900123', '沙田镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900124', '441900124', '道滘镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900125', '441900125', '洪梅镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900126', '441900126', '麻涌镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900127', '441900127', '望牛墩镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900128', '441900128', '中堂镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900129', '441900129', '高埗镇', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900401', '441900401', '松山湖', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900402', '441900402', '东莞港', '4419', 3); +INSERT INTO `dic_city` VALUES ('441900403', '441900403', '东莞生态园', '4419', 3); +INSERT INTO `dic_city` VALUES ('4420', '4420', '中山市', '44', 2); +INSERT INTO `dic_city` VALUES ('442000001', '442000001', '石岐街道', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000002', '442000002', '东区街道', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000003', '442000003', '中山港街道', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000004', '442000004', '西区街道', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000005', '442000005', '南区街道', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000006', '442000006', '五桂山街道', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000100', '442000100', '小榄镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000101', '442000101', '黄圃镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000102', '442000102', '民众镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000103', '442000103', '东凤镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000104', '442000104', '东升镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000105', '442000105', '古镇镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000106', '442000106', '沙溪镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000107', '442000107', '坦洲镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000108', '442000108', '港口镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000109', '442000109', '三角镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000110', '442000110', '横栏镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000111', '442000111', '南头镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000112', '442000112', '阜沙镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000113', '442000113', '南朗镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000114', '442000114', '三乡镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000115', '442000115', '板芙镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000116', '442000116', '大涌镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('442000117', '442000117', '神湾镇', '4420', 3); +INSERT INTO `dic_city` VALUES ('4451', '4451', '潮州市', '44', 2); +INSERT INTO `dic_city` VALUES ('445102', '445102', '湘桥区', '4451', 3); +INSERT INTO `dic_city` VALUES ('445103', '445103', '潮安区', '4451', 3); +INSERT INTO `dic_city` VALUES ('445122', '445122', '饶平县', '4451', 3); +INSERT INTO `dic_city` VALUES ('4452', '4452', '揭阳市', '44', 2); +INSERT INTO `dic_city` VALUES ('445202', '445202', '榕城区', '4452', 3); +INSERT INTO `dic_city` VALUES ('445203', '445203', '揭东区', '4452', 3); +INSERT INTO `dic_city` VALUES ('445222', '445222', '揭西县', '4452', 3); +INSERT INTO `dic_city` VALUES ('445224', '445224', '惠来县', '4452', 3); +INSERT INTO `dic_city` VALUES ('445281', '445281', '普宁市', '4452', 3); +INSERT INTO `dic_city` VALUES ('4453', '4453', '云浮市', '44', 2); +INSERT INTO `dic_city` VALUES ('445302', '445302', '云城区', '4453', 3); +INSERT INTO `dic_city` VALUES ('445303', '445303', '云安区', '4453', 3); +INSERT INTO `dic_city` VALUES ('445321', '445321', '新兴县', '4453', 3); +INSERT INTO `dic_city` VALUES ('445322', '445322', '郁南县', '4453', 3); +INSERT INTO `dic_city` VALUES ('445381', '445381', '罗定市', '4453', 3); +INSERT INTO `dic_city` VALUES ('45', '45', '广西壮族自治区', NULL, 1); +INSERT INTO `dic_city` VALUES ('4501', '4501', '南宁市', '45', 2); +INSERT INTO `dic_city` VALUES ('450102', '450102', '兴宁区', '4501', 3); +INSERT INTO `dic_city` VALUES ('450103', '450103', '青秀区', '4501', 3); +INSERT INTO `dic_city` VALUES ('450105', '450105', '江南区', '4501', 3); +INSERT INTO `dic_city` VALUES ('450107', '450107', '西乡塘区', '4501', 3); +INSERT INTO `dic_city` VALUES ('450108', '450108', '良庆区', '4501', 3); +INSERT INTO `dic_city` VALUES ('450109', '450109', '邕宁区', '4501', 3); +INSERT INTO `dic_city` VALUES ('450110', '450110', '武鸣区', '4501', 3); +INSERT INTO `dic_city` VALUES ('450123', '450123', '隆安县', '4501', 3); +INSERT INTO `dic_city` VALUES ('450124', '450124', '马山县', '4501', 3); +INSERT INTO `dic_city` VALUES ('450125', '450125', '上林县', '4501', 3); +INSERT INTO `dic_city` VALUES ('450126', '450126', '宾阳县', '4501', 3); +INSERT INTO `dic_city` VALUES ('450127', '450127', '横县', '4501', 3); +INSERT INTO `dic_city` VALUES ('4502', '4502', '柳州市', '45', 2); +INSERT INTO `dic_city` VALUES ('450202', '450202', '城中区', '4502', 3); +INSERT INTO `dic_city` VALUES ('450203', '450203', '鱼峰区', '4502', 3); +INSERT INTO `dic_city` VALUES ('450204', '450204', '柳南区', '4502', 3); +INSERT INTO `dic_city` VALUES ('450205', '450205', '柳北区', '4502', 3); +INSERT INTO `dic_city` VALUES ('450206', '450206', '柳江区', '4502', 3); +INSERT INTO `dic_city` VALUES ('450222', '450222', '柳城县', '4502', 3); +INSERT INTO `dic_city` VALUES ('450223', '450223', '鹿寨县', '4502', 3); +INSERT INTO `dic_city` VALUES ('450224', '450224', '融安县', '4502', 3); +INSERT INTO `dic_city` VALUES ('450225', '450225', '融水苗族自治县', '4502', 3); +INSERT INTO `dic_city` VALUES ('450226', '450226', '三江侗族自治县', '4502', 3); +INSERT INTO `dic_city` VALUES ('4503', '4503', '桂林市', '45', 2); +INSERT INTO `dic_city` VALUES ('450302', '450302', '秀峰区', '4503', 3); +INSERT INTO `dic_city` VALUES ('450303', '450303', '叠彩区', '4503', 3); +INSERT INTO `dic_city` VALUES ('450304', '450304', '象山区', '4503', 3); +INSERT INTO `dic_city` VALUES ('450305', '450305', '七星区', '4503', 3); +INSERT INTO `dic_city` VALUES ('450311', '450311', '雁山区', '4503', 3); +INSERT INTO `dic_city` VALUES ('450312', '450312', '临桂区', '4503', 3); +INSERT INTO `dic_city` VALUES ('450321', '450321', '阳朔县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450323', '450323', '灵川县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450324', '450324', '全州县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450325', '450325', '兴安县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450326', '450326', '永福县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450327', '450327', '灌阳县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450328', '450328', '龙胜各族自治县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450329', '450329', '资源县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450330', '450330', '平乐县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450332', '450332', '恭城瑶族自治县', '4503', 3); +INSERT INTO `dic_city` VALUES ('450381', '450381', '荔浦市', '4503', 3); +INSERT INTO `dic_city` VALUES ('4504', '4504', '梧州市', '45', 2); +INSERT INTO `dic_city` VALUES ('450403', '450403', '万秀区', '4504', 3); +INSERT INTO `dic_city` VALUES ('450405', '450405', '长洲区', '4504', 3); +INSERT INTO `dic_city` VALUES ('450406', '450406', '龙圩区', '4504', 3); +INSERT INTO `dic_city` VALUES ('450421', '450421', '苍梧县', '4504', 3); +INSERT INTO `dic_city` VALUES ('450422', '450422', '藤县', '4504', 3); +INSERT INTO `dic_city` VALUES ('450423', '450423', '蒙山县', '4504', 3); +INSERT INTO `dic_city` VALUES ('450481', '450481', '岑溪市', '4504', 3); +INSERT INTO `dic_city` VALUES ('4505', '4505', '北海市', '45', 2); +INSERT INTO `dic_city` VALUES ('450502', '450502', '海城区', '4505', 3); +INSERT INTO `dic_city` VALUES ('450503', '450503', '银海区', '4505', 3); +INSERT INTO `dic_city` VALUES ('450512', '450512', '铁山港区', '4505', 3); +INSERT INTO `dic_city` VALUES ('450521', '450521', '合浦县', '4505', 3); +INSERT INTO `dic_city` VALUES ('4506', '4506', '防城港市', '45', 2); +INSERT INTO `dic_city` VALUES ('450602', '450602', '港口区', '4506', 3); +INSERT INTO `dic_city` VALUES ('450603', '450603', '防城区', '4506', 3); +INSERT INTO `dic_city` VALUES ('450621', '450621', '上思县', '4506', 3); +INSERT INTO `dic_city` VALUES ('450681', '450681', '东兴市', '4506', 3); +INSERT INTO `dic_city` VALUES ('4507', '4507', '钦州市', '45', 2); +INSERT INTO `dic_city` VALUES ('450702', '450702', '钦南区', '4507', 3); +INSERT INTO `dic_city` VALUES ('450703', '450703', '钦北区', '4507', 3); +INSERT INTO `dic_city` VALUES ('450721', '450721', '灵山县', '4507', 3); +INSERT INTO `dic_city` VALUES ('450722', '450722', '浦北县', '4507', 3); +INSERT INTO `dic_city` VALUES ('4508', '4508', '贵港市', '45', 2); +INSERT INTO `dic_city` VALUES ('450802', '450802', '港北区', '4508', 3); +INSERT INTO `dic_city` VALUES ('450803', '450803', '港南区', '4508', 3); +INSERT INTO `dic_city` VALUES ('450804', '450804', '覃塘区', '4508', 3); +INSERT INTO `dic_city` VALUES ('450821', '450821', '平南县', '4508', 3); +INSERT INTO `dic_city` VALUES ('450881', '450881', '桂平市', '4508', 3); +INSERT INTO `dic_city` VALUES ('4509', '4509', '玉林市', '45', 2); +INSERT INTO `dic_city` VALUES ('450902', '450902', '玉州区', '4509', 3); +INSERT INTO `dic_city` VALUES ('450903', '450903', '福绵区', '4509', 3); +INSERT INTO `dic_city` VALUES ('450921', '450921', '容县', '4509', 3); +INSERT INTO `dic_city` VALUES ('450922', '450922', '陆川县', '4509', 3); +INSERT INTO `dic_city` VALUES ('450923', '450923', '博白县', '4509', 3); +INSERT INTO `dic_city` VALUES ('450924', '450924', '兴业县', '4509', 3); +INSERT INTO `dic_city` VALUES ('450981', '450981', '北流市', '4509', 3); +INSERT INTO `dic_city` VALUES ('4510', '4510', '百色市', '45', 2); +INSERT INTO `dic_city` VALUES ('451002', '451002', '右江区', '4510', 3); +INSERT INTO `dic_city` VALUES ('451003', '451003', '田阳区', '4510', 3); +INSERT INTO `dic_city` VALUES ('451022', '451022', '田东县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451024', '451024', '德保县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451026', '451026', '那坡县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451027', '451027', '凌云县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451028', '451028', '乐业县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451029', '451029', '田林县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451030', '451030', '西林县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451031', '451031', '隆林各族自治县', '4510', 3); +INSERT INTO `dic_city` VALUES ('451081', '451081', '靖西市', '4510', 3); +INSERT INTO `dic_city` VALUES ('451082', '451082', '平果市', '4510', 3); +INSERT INTO `dic_city` VALUES ('4511', '4511', '贺州市', '45', 2); +INSERT INTO `dic_city` VALUES ('451102', '451102', '八步区', '4511', 3); +INSERT INTO `dic_city` VALUES ('451103', '451103', '平桂区', '4511', 3); +INSERT INTO `dic_city` VALUES ('451121', '451121', '昭平县', '4511', 3); +INSERT INTO `dic_city` VALUES ('451122', '451122', '钟山县', '4511', 3); +INSERT INTO `dic_city` VALUES ('451123', '451123', '富川瑶族自治县', '4511', 3); +INSERT INTO `dic_city` VALUES ('4512', '4512', '河池市', '45', 2); +INSERT INTO `dic_city` VALUES ('451202', '451202', '金城江区', '4512', 3); +INSERT INTO `dic_city` VALUES ('451203', '451203', '宜州区', '4512', 3); +INSERT INTO `dic_city` VALUES ('451221', '451221', '南丹县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451222', '451222', '天峨县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451223', '451223', '凤山县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451224', '451224', '东兰县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451225', '451225', '罗城仫佬族自治县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451226', '451226', '环江毛南族自治县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451227', '451227', '巴马瑶族自治县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451228', '451228', '都安瑶族自治县', '4512', 3); +INSERT INTO `dic_city` VALUES ('451229', '451229', '大化瑶族自治县', '4512', 3); +INSERT INTO `dic_city` VALUES ('4513', '4513', '来宾市', '45', 2); +INSERT INTO `dic_city` VALUES ('451302', '451302', '兴宾区', '4513', 3); +INSERT INTO `dic_city` VALUES ('451321', '451321', '忻城县', '4513', 3); +INSERT INTO `dic_city` VALUES ('451322', '451322', '象州县', '4513', 3); +INSERT INTO `dic_city` VALUES ('451323', '451323', '武宣县', '4513', 3); +INSERT INTO `dic_city` VALUES ('451324', '451324', '金秀瑶族自治县', '4513', 3); +INSERT INTO `dic_city` VALUES ('451381', '451381', '合山市', '4513', 3); +INSERT INTO `dic_city` VALUES ('4514', '4514', '崇左市', '45', 2); +INSERT INTO `dic_city` VALUES ('451402', '451402', '江州区', '4514', 3); +INSERT INTO `dic_city` VALUES ('451421', '451421', '扶绥县', '4514', 3); +INSERT INTO `dic_city` VALUES ('451422', '451422', '宁明县', '4514', 3); +INSERT INTO `dic_city` VALUES ('451423', '451423', '龙州县', '4514', 3); +INSERT INTO `dic_city` VALUES ('451424', '451424', '大新县', '4514', 3); +INSERT INTO `dic_city` VALUES ('451425', '451425', '天等县', '4514', 3); +INSERT INTO `dic_city` VALUES ('451481', '451481', '凭祥市', '4514', 3); +INSERT INTO `dic_city` VALUES ('46', '46', '海南省', NULL, 1); +INSERT INTO `dic_city` VALUES ('4601', '4601', '海口市', '46', 2); +INSERT INTO `dic_city` VALUES ('460105', '460105', '秀英区', '4601', 3); +INSERT INTO `dic_city` VALUES ('460106', '460106', '龙华区', '4601', 3); +INSERT INTO `dic_city` VALUES ('460107', '460107', '琼山区', '4601', 3); +INSERT INTO `dic_city` VALUES ('460108', '460108', '美兰区', '4601', 3); +INSERT INTO `dic_city` VALUES ('4602', '4602', '三亚市', '46', 2); +INSERT INTO `dic_city` VALUES ('460202', '460202', '海棠区', '4602', 3); +INSERT INTO `dic_city` VALUES ('460203', '460203', '吉阳区', '4602', 3); +INSERT INTO `dic_city` VALUES ('460204', '460204', '天涯区', '4602', 3); +INSERT INTO `dic_city` VALUES ('460205', '460205', '崖州区', '4602', 3); +INSERT INTO `dic_city` VALUES ('4603', '4603', '三沙市', '46', 2); +INSERT INTO `dic_city` VALUES ('460321', '460321', '西沙群岛', '4603', 3); +INSERT INTO `dic_city` VALUES ('460322', '460322', '南沙群岛', '4603', 3); +INSERT INTO `dic_city` VALUES ('460323', '460323', '中沙群岛的岛礁及其海域', '4603', 3); +INSERT INTO `dic_city` VALUES ('4604', '4604', '儋州市', '46', 2); +INSERT INTO `dic_city` VALUES ('460400100', '460400100', '那大镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400101', '460400101', '和庆镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400102', '460400102', '南丰镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400103', '460400103', '大成镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400104', '460400104', '雅星镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400105', '460400105', '兰洋镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400106', '460400106', '光村镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400107', '460400107', '木棠镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400108', '460400108', '海头镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400109', '460400109', '峨蔓镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400111', '460400111', '王五镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400112', '460400112', '白马井镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400113', '460400113', '中和镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400114', '460400114', '排浦镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400115', '460400115', '东成镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400116', '460400116', '新州镇', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400499', '460400499', '洋浦经济开发区', '4604', 3); +INSERT INTO `dic_city` VALUES ('460400500', '460400500', '华南热作学院', '4604', 3); +INSERT INTO `dic_city` VALUES ('4690', '4690', '省直辖县级行政区划', '46', 2); +INSERT INTO `dic_city` VALUES ('469001', '469001', '五指山市', '4690', 3); +INSERT INTO `dic_city` VALUES ('469002', '469002', '琼海市', '4690', 3); +INSERT INTO `dic_city` VALUES ('469005', '469005', '文昌市', '4690', 3); +INSERT INTO `dic_city` VALUES ('469006', '469006', '万宁市', '4690', 3); +INSERT INTO `dic_city` VALUES ('469007', '469007', '东方市', '4690', 3); +INSERT INTO `dic_city` VALUES ('469021', '469021', '定安县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469022', '469022', '屯昌县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469023', '469023', '澄迈县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469024', '469024', '临高县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469025', '469025', '白沙黎族自治县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469026', '469026', '昌江黎族自治县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469027', '469027', '乐东黎族自治县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469028', '469028', '陵水黎族自治县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469029', '469029', '保亭黎族苗族自治县', '4690', 3); +INSERT INTO `dic_city` VALUES ('469030', '469030', '琼中黎族苗族自治县', '4690', 3); +INSERT INTO `dic_city` VALUES ('50', '50', '重庆市', NULL, 1); +INSERT INTO `dic_city` VALUES ('5001', '5001', '市辖区', '50', 2); +INSERT INTO `dic_city` VALUES ('500101', '500101', '万州区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500102', '500102', '涪陵区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500103', '500103', '渝中区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500104', '500104', '大渡口区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500105', '500105', '江北区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500106', '500106', '沙坪坝区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500107', '500107', '九龙坡区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500108', '500108', '南岸区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500109', '500109', '北碚区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500110', '500110', '綦江区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500111', '500111', '大足区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500112', '500112', '渝北区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500113', '500113', '巴南区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500114', '500114', '黔江区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500115', '500115', '长寿区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500116', '500116', '江津区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500117', '500117', '合川区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500118', '500118', '永川区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500119', '500119', '南川区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500120', '500120', '璧山区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500151', '500151', '铜梁区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500152', '500152', '潼南区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500153', '500153', '荣昌区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500154', '500154', '开州区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500155', '500155', '梁平区', '5001', 3); +INSERT INTO `dic_city` VALUES ('500156', '500156', '武隆区', '5001', 3); +INSERT INTO `dic_city` VALUES ('5002', '5002', '县', '50', 2); +INSERT INTO `dic_city` VALUES ('500229', '500229', '城口县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500230', '500230', '丰都县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500231', '500231', '垫江县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500233', '500233', '忠县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500235', '500235', '云阳县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500236', '500236', '奉节县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500237', '500237', '巫山县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500238', '500238', '巫溪县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500240', '500240', '石柱土家族自治县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500241', '500241', '秀山土家族苗族自治县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500242', '500242', '酉阳土家族苗族自治县', '5002', 3); +INSERT INTO `dic_city` VALUES ('500243', '500243', '彭水苗族土家族自治县', '5002', 3); +INSERT INTO `dic_city` VALUES ('51', '51', '四川省', NULL, 1); +INSERT INTO `dic_city` VALUES ('5101', '5101', '成都市', '51', 2); +INSERT INTO `dic_city` VALUES ('510104', '510104', '锦江区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510105', '510105', '青羊区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510106', '510106', '金牛区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510107', '510107', '武侯区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510108', '510108', '成华区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510112', '510112', '龙泉驿区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510113', '510113', '青白江区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510114', '510114', '新都区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510115', '510115', '温江区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510116', '510116', '双流区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510117', '510117', '郫都区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510118', '510118', '新津区', '5101', 3); +INSERT INTO `dic_city` VALUES ('510121', '510121', '金堂县', '5101', 3); +INSERT INTO `dic_city` VALUES ('510129', '510129', '大邑县', '5101', 3); +INSERT INTO `dic_city` VALUES ('510131', '510131', '蒲江县', '5101', 3); +INSERT INTO `dic_city` VALUES ('510181', '510181', '都江堰市', '5101', 3); +INSERT INTO `dic_city` VALUES ('510182', '510182', '彭州市', '5101', 3); +INSERT INTO `dic_city` VALUES ('510183', '510183', '邛崃市', '5101', 3); +INSERT INTO `dic_city` VALUES ('510184', '510184', '崇州市', '5101', 3); +INSERT INTO `dic_city` VALUES ('510185', '510185', '简阳市', '5101', 3); +INSERT INTO `dic_city` VALUES ('5103', '5103', '自贡市', '51', 2); +INSERT INTO `dic_city` VALUES ('510302', '510302', '自流井区', '5103', 3); +INSERT INTO `dic_city` VALUES ('510303', '510303', '贡井区', '5103', 3); +INSERT INTO `dic_city` VALUES ('510304', '510304', '大安区', '5103', 3); +INSERT INTO `dic_city` VALUES ('510311', '510311', '沿滩区', '5103', 3); +INSERT INTO `dic_city` VALUES ('510321', '510321', '荣县', '5103', 3); +INSERT INTO `dic_city` VALUES ('510322', '510322', '富顺县', '5103', 3); +INSERT INTO `dic_city` VALUES ('5104', '5104', '攀枝花市', '51', 2); +INSERT INTO `dic_city` VALUES ('510402', '510402', '东区', '5104', 3); +INSERT INTO `dic_city` VALUES ('510403', '510403', '西区', '5104', 3); +INSERT INTO `dic_city` VALUES ('510411', '510411', '仁和区', '5104', 3); +INSERT INTO `dic_city` VALUES ('510421', '510421', '米易县', '5104', 3); +INSERT INTO `dic_city` VALUES ('510422', '510422', '盐边县', '5104', 3); +INSERT INTO `dic_city` VALUES ('5105', '5105', '泸州市', '51', 2); +INSERT INTO `dic_city` VALUES ('510502', '510502', '江阳区', '5105', 3); +INSERT INTO `dic_city` VALUES ('510503', '510503', '纳溪区', '5105', 3); +INSERT INTO `dic_city` VALUES ('510504', '510504', '龙马潭区', '5105', 3); +INSERT INTO `dic_city` VALUES ('510521', '510521', '泸县', '5105', 3); +INSERT INTO `dic_city` VALUES ('510522', '510522', '合江县', '5105', 3); +INSERT INTO `dic_city` VALUES ('510524', '510524', '叙永县', '5105', 3); +INSERT INTO `dic_city` VALUES ('510525', '510525', '古蔺县', '5105', 3); +INSERT INTO `dic_city` VALUES ('5106', '5106', '德阳市', '51', 2); +INSERT INTO `dic_city` VALUES ('510603', '510603', '旌阳区', '5106', 3); +INSERT INTO `dic_city` VALUES ('510604', '510604', '罗江区', '5106', 3); +INSERT INTO `dic_city` VALUES ('510623', '510623', '中江县', '5106', 3); +INSERT INTO `dic_city` VALUES ('510681', '510681', '广汉市', '5106', 3); +INSERT INTO `dic_city` VALUES ('510682', '510682', '什邡市', '5106', 3); +INSERT INTO `dic_city` VALUES ('510683', '510683', '绵竹市', '5106', 3); +INSERT INTO `dic_city` VALUES ('5107', '5107', '绵阳市', '51', 2); +INSERT INTO `dic_city` VALUES ('510703', '510703', '涪城区', '5107', 3); +INSERT INTO `dic_city` VALUES ('510704', '510704', '游仙区', '5107', 3); +INSERT INTO `dic_city` VALUES ('510705', '510705', '安州区', '5107', 3); +INSERT INTO `dic_city` VALUES ('510722', '510722', '三台县', '5107', 3); +INSERT INTO `dic_city` VALUES ('510723', '510723', '盐亭县', '5107', 3); +INSERT INTO `dic_city` VALUES ('510725', '510725', '梓潼县', '5107', 3); +INSERT INTO `dic_city` VALUES ('510726', '510726', '北川羌族自治县', '5107', 3); +INSERT INTO `dic_city` VALUES ('510727', '510727', '平武县', '5107', 3); +INSERT INTO `dic_city` VALUES ('510781', '510781', '江油市', '5107', 3); +INSERT INTO `dic_city` VALUES ('5108', '5108', '广元市', '51', 2); +INSERT INTO `dic_city` VALUES ('510802', '510802', '利州区', '5108', 3); +INSERT INTO `dic_city` VALUES ('510811', '510811', '昭化区', '5108', 3); +INSERT INTO `dic_city` VALUES ('510812', '510812', '朝天区', '5108', 3); +INSERT INTO `dic_city` VALUES ('510821', '510821', '旺苍县', '5108', 3); +INSERT INTO `dic_city` VALUES ('510822', '510822', '青川县', '5108', 3); +INSERT INTO `dic_city` VALUES ('510823', '510823', '剑阁县', '5108', 3); +INSERT INTO `dic_city` VALUES ('510824', '510824', '苍溪县', '5108', 3); +INSERT INTO `dic_city` VALUES ('5109', '5109', '遂宁市', '51', 2); +INSERT INTO `dic_city` VALUES ('510903', '510903', '船山区', '5109', 3); +INSERT INTO `dic_city` VALUES ('510904', '510904', '安居区', '5109', 3); +INSERT INTO `dic_city` VALUES ('510921', '510921', '蓬溪县', '5109', 3); +INSERT INTO `dic_city` VALUES ('510923', '510923', '大英县', '5109', 3); +INSERT INTO `dic_city` VALUES ('510981', '510981', '射洪市', '5109', 3); +INSERT INTO `dic_city` VALUES ('5110', '5110', '内江市', '51', 2); +INSERT INTO `dic_city` VALUES ('511002', '511002', '市中区', '5110', 3); +INSERT INTO `dic_city` VALUES ('511011', '511011', '东兴区', '5110', 3); +INSERT INTO `dic_city` VALUES ('511024', '511024', '威远县', '5110', 3); +INSERT INTO `dic_city` VALUES ('511025', '511025', '资中县', '5110', 3); +INSERT INTO `dic_city` VALUES ('511071', '511071', '内江经济开发区', '5110', 3); +INSERT INTO `dic_city` VALUES ('511083', '511083', '隆昌市', '5110', 3); +INSERT INTO `dic_city` VALUES ('5111', '5111', '乐山市', '51', 2); +INSERT INTO `dic_city` VALUES ('511102', '511102', '市中区', '5111', 3); +INSERT INTO `dic_city` VALUES ('511111', '511111', '沙湾区', '5111', 3); +INSERT INTO `dic_city` VALUES ('511112', '511112', '五通桥区', '5111', 3); +INSERT INTO `dic_city` VALUES ('511113', '511113', '金口河区', '5111', 3); +INSERT INTO `dic_city` VALUES ('511123', '511123', '犍为县', '5111', 3); +INSERT INTO `dic_city` VALUES ('511124', '511124', '井研县', '5111', 3); +INSERT INTO `dic_city` VALUES ('511126', '511126', '夹江县', '5111', 3); +INSERT INTO `dic_city` VALUES ('511129', '511129', '沐川县', '5111', 3); +INSERT INTO `dic_city` VALUES ('511132', '511132', '峨边彝族自治县', '5111', 3); +INSERT INTO `dic_city` VALUES ('511133', '511133', '马边彝族自治县', '5111', 3); +INSERT INTO `dic_city` VALUES ('511181', '511181', '峨眉山市', '5111', 3); +INSERT INTO `dic_city` VALUES ('5113', '5113', '南充市', '51', 2); +INSERT INTO `dic_city` VALUES ('511302', '511302', '顺庆区', '5113', 3); +INSERT INTO `dic_city` VALUES ('511303', '511303', '高坪区', '5113', 3); +INSERT INTO `dic_city` VALUES ('511304', '511304', '嘉陵区', '5113', 3); +INSERT INTO `dic_city` VALUES ('511321', '511321', '南部县', '5113', 3); +INSERT INTO `dic_city` VALUES ('511322', '511322', '营山县', '5113', 3); +INSERT INTO `dic_city` VALUES ('511323', '511323', '蓬安县', '5113', 3); +INSERT INTO `dic_city` VALUES ('511324', '511324', '仪陇县', '5113', 3); +INSERT INTO `dic_city` VALUES ('511325', '511325', '西充县', '5113', 3); +INSERT INTO `dic_city` VALUES ('511381', '511381', '阆中市', '5113', 3); +INSERT INTO `dic_city` VALUES ('5114', '5114', '眉山市', '51', 2); +INSERT INTO `dic_city` VALUES ('511402', '511402', '东坡区', '5114', 3); +INSERT INTO `dic_city` VALUES ('511403', '511403', '彭山区', '5114', 3); +INSERT INTO `dic_city` VALUES ('511421', '511421', '仁寿县', '5114', 3); +INSERT INTO `dic_city` VALUES ('511423', '511423', '洪雅县', '5114', 3); +INSERT INTO `dic_city` VALUES ('511424', '511424', '丹棱县', '5114', 3); +INSERT INTO `dic_city` VALUES ('511425', '511425', '青神县', '5114', 3); +INSERT INTO `dic_city` VALUES ('5115', '5115', '宜宾市', '51', 2); +INSERT INTO `dic_city` VALUES ('511502', '511502', '翠屏区', '5115', 3); +INSERT INTO `dic_city` VALUES ('511503', '511503', '南溪区', '5115', 3); +INSERT INTO `dic_city` VALUES ('511504', '511504', '叙州区', '5115', 3); +INSERT INTO `dic_city` VALUES ('511523', '511523', '江安县', '5115', 3); +INSERT INTO `dic_city` VALUES ('511524', '511524', '长宁县', '5115', 3); +INSERT INTO `dic_city` VALUES ('511525', '511525', '高县', '5115', 3); +INSERT INTO `dic_city` VALUES ('511526', '511526', '珙县', '5115', 3); +INSERT INTO `dic_city` VALUES ('511527', '511527', '筠连县', '5115', 3); +INSERT INTO `dic_city` VALUES ('511528', '511528', '兴文县', '5115', 3); +INSERT INTO `dic_city` VALUES ('511529', '511529', '屏山县', '5115', 3); +INSERT INTO `dic_city` VALUES ('5116', '5116', '广安市', '51', 2); +INSERT INTO `dic_city` VALUES ('511602', '511602', '广安区', '5116', 3); +INSERT INTO `dic_city` VALUES ('511603', '511603', '前锋区', '5116', 3); +INSERT INTO `dic_city` VALUES ('511621', '511621', '岳池县', '5116', 3); +INSERT INTO `dic_city` VALUES ('511622', '511622', '武胜县', '5116', 3); +INSERT INTO `dic_city` VALUES ('511623', '511623', '邻水县', '5116', 3); +INSERT INTO `dic_city` VALUES ('511681', '511681', '华蓥市', '5116', 3); +INSERT INTO `dic_city` VALUES ('5117', '5117', '达州市', '51', 2); +INSERT INTO `dic_city` VALUES ('511702', '511702', '通川区', '5117', 3); +INSERT INTO `dic_city` VALUES ('511703', '511703', '达川区', '5117', 3); +INSERT INTO `dic_city` VALUES ('511722', '511722', '宣汉县', '5117', 3); +INSERT INTO `dic_city` VALUES ('511723', '511723', '开江县', '5117', 3); +INSERT INTO `dic_city` VALUES ('511724', '511724', '大竹县', '5117', 3); +INSERT INTO `dic_city` VALUES ('511725', '511725', '渠县', '5117', 3); +INSERT INTO `dic_city` VALUES ('511771', '511771', '达州经济开发区', '5117', 3); +INSERT INTO `dic_city` VALUES ('511781', '511781', '万源市', '5117', 3); +INSERT INTO `dic_city` VALUES ('5118', '5118', '雅安市', '51', 2); +INSERT INTO `dic_city` VALUES ('511802', '511802', '雨城区', '5118', 3); +INSERT INTO `dic_city` VALUES ('511803', '511803', '名山区', '5118', 3); +INSERT INTO `dic_city` VALUES ('511822', '511822', '荥经县', '5118', 3); +INSERT INTO `dic_city` VALUES ('511823', '511823', '汉源县', '5118', 3); +INSERT INTO `dic_city` VALUES ('511824', '511824', '石棉县', '5118', 3); +INSERT INTO `dic_city` VALUES ('511825', '511825', '天全县', '5118', 3); +INSERT INTO `dic_city` VALUES ('511826', '511826', '芦山县', '5118', 3); +INSERT INTO `dic_city` VALUES ('511827', '511827', '宝兴县', '5118', 3); +INSERT INTO `dic_city` VALUES ('5119', '5119', '巴中市', '51', 2); +INSERT INTO `dic_city` VALUES ('511902', '511902', '巴州区', '5119', 3); +INSERT INTO `dic_city` VALUES ('511903', '511903', '恩阳区', '5119', 3); +INSERT INTO `dic_city` VALUES ('511921', '511921', '通江县', '5119', 3); +INSERT INTO `dic_city` VALUES ('511922', '511922', '南江县', '5119', 3); +INSERT INTO `dic_city` VALUES ('511923', '511923', '平昌县', '5119', 3); +INSERT INTO `dic_city` VALUES ('511971', '511971', '巴中经济开发区', '5119', 3); +INSERT INTO `dic_city` VALUES ('5120', '5120', '资阳市', '51', 2); +INSERT INTO `dic_city` VALUES ('512002', '512002', '雁江区', '5120', 3); +INSERT INTO `dic_city` VALUES ('512021', '512021', '安岳县', '5120', 3); +INSERT INTO `dic_city` VALUES ('512022', '512022', '乐至县', '5120', 3); +INSERT INTO `dic_city` VALUES ('5132', '5132', '阿坝藏族羌族自治州', '51', 2); +INSERT INTO `dic_city` VALUES ('513201', '513201', '马尔康市', '5132', 3); +INSERT INTO `dic_city` VALUES ('513221', '513221', '汶川县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513222', '513222', '理县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513223', '513223', '茂县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513224', '513224', '松潘县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513225', '513225', '九寨沟县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513226', '513226', '金川县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513227', '513227', '小金县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513228', '513228', '黑水县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513230', '513230', '壤塘县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513231', '513231', '阿坝县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513232', '513232', '若尔盖县', '5132', 3); +INSERT INTO `dic_city` VALUES ('513233', '513233', '红原县', '5132', 3); +INSERT INTO `dic_city` VALUES ('5133', '5133', '甘孜藏族自治州', '51', 2); +INSERT INTO `dic_city` VALUES ('513301', '513301', '康定市', '5133', 3); +INSERT INTO `dic_city` VALUES ('513322', '513322', '泸定县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513323', '513323', '丹巴县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513324', '513324', '九龙县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513325', '513325', '雅江县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513326', '513326', '道孚县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513327', '513327', '炉霍县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513328', '513328', '甘孜县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513329', '513329', '新龙县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513330', '513330', '德格县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513331', '513331', '白玉县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513332', '513332', '石渠县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513333', '513333', '色达县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513334', '513334', '理塘县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513335', '513335', '巴塘县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513336', '513336', '乡城县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513337', '513337', '稻城县', '5133', 3); +INSERT INTO `dic_city` VALUES ('513338', '513338', '得荣县', '5133', 3); +INSERT INTO `dic_city` VALUES ('5134', '5134', '凉山彝族自治州', '51', 2); +INSERT INTO `dic_city` VALUES ('513401', '513401', '西昌市', '5134', 3); +INSERT INTO `dic_city` VALUES ('513422', '513422', '木里藏族自治县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513423', '513423', '盐源县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513424', '513424', '德昌县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513425', '513425', '会理县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513426', '513426', '会东县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513427', '513427', '宁南县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513428', '513428', '普格县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513429', '513429', '布拖县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513430', '513430', '金阳县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513431', '513431', '昭觉县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513432', '513432', '喜德县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513433', '513433', '冕宁县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513434', '513434', '越西县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513435', '513435', '甘洛县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513436', '513436', '美姑县', '5134', 3); +INSERT INTO `dic_city` VALUES ('513437', '513437', '雷波县', '5134', 3); +INSERT INTO `dic_city` VALUES ('52', '52', '贵州省', NULL, 1); +INSERT INTO `dic_city` VALUES ('5201', '5201', '贵阳市', '52', 2); +INSERT INTO `dic_city` VALUES ('520102', '520102', '南明区', '5201', 3); +INSERT INTO `dic_city` VALUES ('520103', '520103', '云岩区', '5201', 3); +INSERT INTO `dic_city` VALUES ('520111', '520111', '花溪区', '5201', 3); +INSERT INTO `dic_city` VALUES ('520112', '520112', '乌当区', '5201', 3); +INSERT INTO `dic_city` VALUES ('520113', '520113', '白云区', '5201', 3); +INSERT INTO `dic_city` VALUES ('520115', '520115', '观山湖区', '5201', 3); +INSERT INTO `dic_city` VALUES ('520121', '520121', '开阳县', '5201', 3); +INSERT INTO `dic_city` VALUES ('520122', '520122', '息烽县', '5201', 3); +INSERT INTO `dic_city` VALUES ('520123', '520123', '修文县', '5201', 3); +INSERT INTO `dic_city` VALUES ('520181', '520181', '清镇市', '5201', 3); +INSERT INTO `dic_city` VALUES ('5202', '5202', '六盘水市', '52', 2); +INSERT INTO `dic_city` VALUES ('520201', '520201', '钟山区', '5202', 3); +INSERT INTO `dic_city` VALUES ('520203', '520203', '六枝特区', '5202', 3); +INSERT INTO `dic_city` VALUES ('520221', '520221', '水城县', '5202', 3); +INSERT INTO `dic_city` VALUES ('520281', '520281', '盘州市', '5202', 3); +INSERT INTO `dic_city` VALUES ('5203', '5203', '遵义市', '52', 2); +INSERT INTO `dic_city` VALUES ('520302', '520302', '红花岗区', '5203', 3); +INSERT INTO `dic_city` VALUES ('520303', '520303', '汇川区', '5203', 3); +INSERT INTO `dic_city` VALUES ('520304', '520304', '播州区', '5203', 3); +INSERT INTO `dic_city` VALUES ('520322', '520322', '桐梓县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520323', '520323', '绥阳县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520324', '520324', '正安县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520325', '520325', '道真仡佬族苗族自治县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520326', '520326', '务川仡佬族苗族自治县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520327', '520327', '凤冈县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520328', '520328', '湄潭县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520329', '520329', '余庆县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520330', '520330', '习水县', '5203', 3); +INSERT INTO `dic_city` VALUES ('520381', '520381', '赤水市', '5203', 3); +INSERT INTO `dic_city` VALUES ('520382', '520382', '仁怀市', '5203', 3); +INSERT INTO `dic_city` VALUES ('5204', '5204', '安顺市', '52', 2); +INSERT INTO `dic_city` VALUES ('520402', '520402', '西秀区', '5204', 3); +INSERT INTO `dic_city` VALUES ('520403', '520403', '平坝区', '5204', 3); +INSERT INTO `dic_city` VALUES ('520422', '520422', '普定县', '5204', 3); +INSERT INTO `dic_city` VALUES ('520423', '520423', '镇宁布依族苗族自治县', '5204', 3); +INSERT INTO `dic_city` VALUES ('520424', '520424', '关岭布依族苗族自治县', '5204', 3); +INSERT INTO `dic_city` VALUES ('520425', '520425', '紫云苗族布依族自治县', '5204', 3); +INSERT INTO `dic_city` VALUES ('5205', '5205', '毕节市', '52', 2); +INSERT INTO `dic_city` VALUES ('520502', '520502', '七星关区', '5205', 3); +INSERT INTO `dic_city` VALUES ('520521', '520521', '大方县', '5205', 3); +INSERT INTO `dic_city` VALUES ('520522', '520522', '黔西县', '5205', 3); +INSERT INTO `dic_city` VALUES ('520523', '520523', '金沙县', '5205', 3); +INSERT INTO `dic_city` VALUES ('520524', '520524', '织金县', '5205', 3); +INSERT INTO `dic_city` VALUES ('520525', '520525', '纳雍县', '5205', 3); +INSERT INTO `dic_city` VALUES ('520526', '520526', '威宁彝族回族苗族自治县', '5205', 3); +INSERT INTO `dic_city` VALUES ('520527', '520527', '赫章县', '5205', 3); +INSERT INTO `dic_city` VALUES ('5206', '5206', '铜仁市', '52', 2); +INSERT INTO `dic_city` VALUES ('520602', '520602', '碧江区', '5206', 3); +INSERT INTO `dic_city` VALUES ('520603', '520603', '万山区', '5206', 3); +INSERT INTO `dic_city` VALUES ('520621', '520621', '江口县', '5206', 3); +INSERT INTO `dic_city` VALUES ('520622', '520622', '玉屏侗族自治县', '5206', 3); +INSERT INTO `dic_city` VALUES ('520623', '520623', '石阡县', '5206', 3); +INSERT INTO `dic_city` VALUES ('520624', '520624', '思南县', '5206', 3); +INSERT INTO `dic_city` VALUES ('520625', '520625', '印江土家族苗族自治县', '5206', 3); +INSERT INTO `dic_city` VALUES ('520626', '520626', '德江县', '5206', 3); +INSERT INTO `dic_city` VALUES ('520627', '520627', '沿河土家族自治县', '5206', 3); +INSERT INTO `dic_city` VALUES ('520628', '520628', '松桃苗族自治县', '5206', 3); +INSERT INTO `dic_city` VALUES ('5223', '5223', '黔西南布依族苗族自治州', '52', 2); +INSERT INTO `dic_city` VALUES ('522301', '522301', '兴义市', '5223', 3); +INSERT INTO `dic_city` VALUES ('522302', '522302', '兴仁市', '5223', 3); +INSERT INTO `dic_city` VALUES ('522323', '522323', '普安县', '5223', 3); +INSERT INTO `dic_city` VALUES ('522324', '522324', '晴隆县', '5223', 3); +INSERT INTO `dic_city` VALUES ('522325', '522325', '贞丰县', '5223', 3); +INSERT INTO `dic_city` VALUES ('522326', '522326', '望谟县', '5223', 3); +INSERT INTO `dic_city` VALUES ('522327', '522327', '册亨县', '5223', 3); +INSERT INTO `dic_city` VALUES ('522328', '522328', '安龙县', '5223', 3); +INSERT INTO `dic_city` VALUES ('5226', '5226', '黔东南苗族侗族自治州', '52', 2); +INSERT INTO `dic_city` VALUES ('522601', '522601', '凯里市', '5226', 3); +INSERT INTO `dic_city` VALUES ('522622', '522622', '黄平县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522623', '522623', '施秉县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522624', '522624', '三穗县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522625', '522625', '镇远县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522626', '522626', '岑巩县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522627', '522627', '天柱县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522628', '522628', '锦屏县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522629', '522629', '剑河县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522630', '522630', '台江县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522631', '522631', '黎平县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522632', '522632', '榕江县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522633', '522633', '从江县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522634', '522634', '雷山县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522635', '522635', '麻江县', '5226', 3); +INSERT INTO `dic_city` VALUES ('522636', '522636', '丹寨县', '5226', 3); +INSERT INTO `dic_city` VALUES ('5227', '5227', '黔南布依族苗族自治州', '52', 2); +INSERT INTO `dic_city` VALUES ('522701', '522701', '都匀市', '5227', 3); +INSERT INTO `dic_city` VALUES ('522702', '522702', '福泉市', '5227', 3); +INSERT INTO `dic_city` VALUES ('522722', '522722', '荔波县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522723', '522723', '贵定县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522725', '522725', '瓮安县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522726', '522726', '独山县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522727', '522727', '平塘县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522728', '522728', '罗甸县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522729', '522729', '长顺县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522730', '522730', '龙里县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522731', '522731', '惠水县', '5227', 3); +INSERT INTO `dic_city` VALUES ('522732', '522732', '三都水族自治县', '5227', 3); +INSERT INTO `dic_city` VALUES ('53', '53', '云南省', NULL, 1); +INSERT INTO `dic_city` VALUES ('5301', '5301', '昆明市', '53', 2); +INSERT INTO `dic_city` VALUES ('530102', '530102', '五华区', '5301', 3); +INSERT INTO `dic_city` VALUES ('530103', '530103', '盘龙区', '5301', 3); +INSERT INTO `dic_city` VALUES ('530111', '530111', '官渡区', '5301', 3); +INSERT INTO `dic_city` VALUES ('530112', '530112', '西山区', '5301', 3); +INSERT INTO `dic_city` VALUES ('530113', '530113', '东川区', '5301', 3); +INSERT INTO `dic_city` VALUES ('530114', '530114', '呈贡区', '5301', 3); +INSERT INTO `dic_city` VALUES ('530115', '530115', '晋宁区', '5301', 3); +INSERT INTO `dic_city` VALUES ('530124', '530124', '富民县', '5301', 3); +INSERT INTO `dic_city` VALUES ('530125', '530125', '宜良县', '5301', 3); +INSERT INTO `dic_city` VALUES ('530126', '530126', '石林彝族自治县', '5301', 3); +INSERT INTO `dic_city` VALUES ('530127', '530127', '嵩明县', '5301', 3); +INSERT INTO `dic_city` VALUES ('530128', '530128', '禄劝彝族苗族自治县', '5301', 3); +INSERT INTO `dic_city` VALUES ('530129', '530129', '寻甸回族彝族自治县', '5301', 3); +INSERT INTO `dic_city` VALUES ('530181', '530181', '安宁市', '5301', 3); +INSERT INTO `dic_city` VALUES ('5303', '5303', '曲靖市', '53', 2); +INSERT INTO `dic_city` VALUES ('530302', '530302', '麒麟区', '5303', 3); +INSERT INTO `dic_city` VALUES ('530303', '530303', '沾益区', '5303', 3); +INSERT INTO `dic_city` VALUES ('530304', '530304', '马龙区', '5303', 3); +INSERT INTO `dic_city` VALUES ('530322', '530322', '陆良县', '5303', 3); +INSERT INTO `dic_city` VALUES ('530323', '530323', '师宗县', '5303', 3); +INSERT INTO `dic_city` VALUES ('530324', '530324', '罗平县', '5303', 3); +INSERT INTO `dic_city` VALUES ('530325', '530325', '富源县', '5303', 3); +INSERT INTO `dic_city` VALUES ('530326', '530326', '会泽县', '5303', 3); +INSERT INTO `dic_city` VALUES ('530381', '530381', '宣威市', '5303', 3); +INSERT INTO `dic_city` VALUES ('5304', '5304', '玉溪市', '53', 2); +INSERT INTO `dic_city` VALUES ('530402', '530402', '红塔区', '5304', 3); +INSERT INTO `dic_city` VALUES ('530403', '530403', '江川区', '5304', 3); +INSERT INTO `dic_city` VALUES ('530423', '530423', '通海县', '5304', 3); +INSERT INTO `dic_city` VALUES ('530424', '530424', '华宁县', '5304', 3); +INSERT INTO `dic_city` VALUES ('530425', '530425', '易门县', '5304', 3); +INSERT INTO `dic_city` VALUES ('530426', '530426', '峨山彝族自治县', '5304', 3); +INSERT INTO `dic_city` VALUES ('530427', '530427', '新平彝族傣族自治县', '5304', 3); +INSERT INTO `dic_city` VALUES ('530428', '530428', '元江哈尼族彝族傣族自治县', '5304', 3); +INSERT INTO `dic_city` VALUES ('530481', '530481', '澄江市', '5304', 3); +INSERT INTO `dic_city` VALUES ('5305', '5305', '保山市', '53', 2); +INSERT INTO `dic_city` VALUES ('530502', '530502', '隆阳区', '5305', 3); +INSERT INTO `dic_city` VALUES ('530521', '530521', '施甸县', '5305', 3); +INSERT INTO `dic_city` VALUES ('530523', '530523', '龙陵县', '5305', 3); +INSERT INTO `dic_city` VALUES ('530524', '530524', '昌宁县', '5305', 3); +INSERT INTO `dic_city` VALUES ('530581', '530581', '腾冲市', '5305', 3); +INSERT INTO `dic_city` VALUES ('5306', '5306', '昭通市', '53', 2); +INSERT INTO `dic_city` VALUES ('530602', '530602', '昭阳区', '5306', 3); +INSERT INTO `dic_city` VALUES ('530621', '530621', '鲁甸县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530622', '530622', '巧家县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530623', '530623', '盐津县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530624', '530624', '大关县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530625', '530625', '永善县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530626', '530626', '绥江县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530627', '530627', '镇雄县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530628', '530628', '彝良县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530629', '530629', '威信县', '5306', 3); +INSERT INTO `dic_city` VALUES ('530681', '530681', '水富市', '5306', 3); +INSERT INTO `dic_city` VALUES ('5307', '5307', '丽江市', '53', 2); +INSERT INTO `dic_city` VALUES ('530702', '530702', '古城区', '5307', 3); +INSERT INTO `dic_city` VALUES ('530721', '530721', '玉龙纳西族自治县', '5307', 3); +INSERT INTO `dic_city` VALUES ('530722', '530722', '永胜县', '5307', 3); +INSERT INTO `dic_city` VALUES ('530723', '530723', '华坪县', '5307', 3); +INSERT INTO `dic_city` VALUES ('530724', '530724', '宁蒗彝族自治县', '5307', 3); +INSERT INTO `dic_city` VALUES ('5308', '5308', '普洱市', '53', 2); +INSERT INTO `dic_city` VALUES ('530802', '530802', '思茅区', '5308', 3); +INSERT INTO `dic_city` VALUES ('530821', '530821', '宁洱哈尼族彝族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530822', '530822', '墨江哈尼族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530823', '530823', '景东彝族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530824', '530824', '景谷傣族彝族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530825', '530825', '镇沅彝族哈尼族拉祜族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530826', '530826', '江城哈尼族彝族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530827', '530827', '孟连傣族拉祜族佤族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530828', '530828', '澜沧拉祜族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('530829', '530829', '西盟佤族自治县', '5308', 3); +INSERT INTO `dic_city` VALUES ('5309', '5309', '临沧市', '53', 2); +INSERT INTO `dic_city` VALUES ('530902', '530902', '临翔区', '5309', 3); +INSERT INTO `dic_city` VALUES ('530921', '530921', '凤庆县', '5309', 3); +INSERT INTO `dic_city` VALUES ('530922', '530922', '云县', '5309', 3); +INSERT INTO `dic_city` VALUES ('530923', '530923', '永德县', '5309', 3); +INSERT INTO `dic_city` VALUES ('530924', '530924', '镇康县', '5309', 3); +INSERT INTO `dic_city` VALUES ('530925', '530925', '双江拉祜族佤族布朗族傣族自治县', '5309', 3); +INSERT INTO `dic_city` VALUES ('530926', '530926', '耿马傣族佤族自治县', '5309', 3); +INSERT INTO `dic_city` VALUES ('530927', '530927', '沧源佤族自治县', '5309', 3); +INSERT INTO `dic_city` VALUES ('5323', '5323', '楚雄彝族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('532301', '532301', '楚雄市', '5323', 3); +INSERT INTO `dic_city` VALUES ('532322', '532322', '双柏县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532323', '532323', '牟定县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532324', '532324', '南华县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532325', '532325', '姚安县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532326', '532326', '大姚县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532327', '532327', '永仁县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532328', '532328', '元谋县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532329', '532329', '武定县', '5323', 3); +INSERT INTO `dic_city` VALUES ('532331', '532331', '禄丰县', '5323', 3); +INSERT INTO `dic_city` VALUES ('5325', '5325', '红河哈尼族彝族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('532501', '532501', '个旧市', '5325', 3); +INSERT INTO `dic_city` VALUES ('532502', '532502', '开远市', '5325', 3); +INSERT INTO `dic_city` VALUES ('532503', '532503', '蒙自市', '5325', 3); +INSERT INTO `dic_city` VALUES ('532504', '532504', '弥勒市', '5325', 3); +INSERT INTO `dic_city` VALUES ('532523', '532523', '屏边苗族自治县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532524', '532524', '建水县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532525', '532525', '石屏县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532527', '532527', '泸西县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532528', '532528', '元阳县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532529', '532529', '红河县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532530', '532530', '金平苗族瑶族傣族自治县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532531', '532531', '绿春县', '5325', 3); +INSERT INTO `dic_city` VALUES ('532532', '532532', '河口瑶族自治县', '5325', 3); +INSERT INTO `dic_city` VALUES ('5326', '5326', '文山壮族苗族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('532601', '532601', '文山市', '5326', 3); +INSERT INTO `dic_city` VALUES ('532622', '532622', '砚山县', '5326', 3); +INSERT INTO `dic_city` VALUES ('532623', '532623', '西畴县', '5326', 3); +INSERT INTO `dic_city` VALUES ('532624', '532624', '麻栗坡县', '5326', 3); +INSERT INTO `dic_city` VALUES ('532625', '532625', '马关县', '5326', 3); +INSERT INTO `dic_city` VALUES ('532626', '532626', '丘北县', '5326', 3); +INSERT INTO `dic_city` VALUES ('532627', '532627', '广南县', '5326', 3); +INSERT INTO `dic_city` VALUES ('532628', '532628', '富宁县', '5326', 3); +INSERT INTO `dic_city` VALUES ('5328', '5328', '西双版纳傣族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('532801', '532801', '景洪市', '5328', 3); +INSERT INTO `dic_city` VALUES ('532822', '532822', '勐海县', '5328', 3); +INSERT INTO `dic_city` VALUES ('532823', '532823', '勐腊县', '5328', 3); +INSERT INTO `dic_city` VALUES ('5329', '5329', '大理白族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('532901', '532901', '大理市', '5329', 3); +INSERT INTO `dic_city` VALUES ('532922', '532922', '漾濞彝族自治县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532923', '532923', '祥云县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532924', '532924', '宾川县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532925', '532925', '弥渡县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532926', '532926', '南涧彝族自治县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532927', '532927', '巍山彝族回族自治县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532928', '532928', '永平县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532929', '532929', '云龙县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532930', '532930', '洱源县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532931', '532931', '剑川县', '5329', 3); +INSERT INTO `dic_city` VALUES ('532932', '532932', '鹤庆县', '5329', 3); +INSERT INTO `dic_city` VALUES ('5331', '5331', '德宏傣族景颇族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('533102', '533102', '瑞丽市', '5331', 3); +INSERT INTO `dic_city` VALUES ('533103', '533103', '芒市', '5331', 3); +INSERT INTO `dic_city` VALUES ('533122', '533122', '梁河县', '5331', 3); +INSERT INTO `dic_city` VALUES ('533123', '533123', '盈江县', '5331', 3); +INSERT INTO `dic_city` VALUES ('533124', '533124', '陇川县', '5331', 3); +INSERT INTO `dic_city` VALUES ('5333', '5333', '怒江傈僳族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('533301', '533301', '泸水市', '5333', 3); +INSERT INTO `dic_city` VALUES ('533323', '533323', '福贡县', '5333', 3); +INSERT INTO `dic_city` VALUES ('533324', '533324', '贡山独龙族怒族自治县', '5333', 3); +INSERT INTO `dic_city` VALUES ('533325', '533325', '兰坪白族普米族自治县', '5333', 3); +INSERT INTO `dic_city` VALUES ('5334', '5334', '迪庆藏族自治州', '53', 2); +INSERT INTO `dic_city` VALUES ('533401', '533401', '香格里拉市', '5334', 3); +INSERT INTO `dic_city` VALUES ('533422', '533422', '德钦县', '5334', 3); +INSERT INTO `dic_city` VALUES ('533423', '533423', '维西傈僳族自治县', '5334', 3); +INSERT INTO `dic_city` VALUES ('54', '54', '西藏自治区', NULL, 1); +INSERT INTO `dic_city` VALUES ('5401', '5401', '拉萨市', '54', 2); +INSERT INTO `dic_city` VALUES ('540102', '540102', '城关区', '5401', 3); +INSERT INTO `dic_city` VALUES ('540103', '540103', '堆龙德庆区', '5401', 3); +INSERT INTO `dic_city` VALUES ('540104', '540104', '达孜区', '5401', 3); +INSERT INTO `dic_city` VALUES ('540121', '540121', '林周县', '5401', 3); +INSERT INTO `dic_city` VALUES ('540122', '540122', '当雄县', '5401', 3); +INSERT INTO `dic_city` VALUES ('540123', '540123', '尼木县', '5401', 3); +INSERT INTO `dic_city` VALUES ('540124', '540124', '曲水县', '5401', 3); +INSERT INTO `dic_city` VALUES ('540127', '540127', '墨竹工卡县', '5401', 3); +INSERT INTO `dic_city` VALUES ('540171', '540171', '格尔木藏青工业园区', '5401', 3); +INSERT INTO `dic_city` VALUES ('540172', '540172', '拉萨经济技术开发区', '5401', 3); +INSERT INTO `dic_city` VALUES ('540173', '540173', '西藏文化旅游创意园区', '5401', 3); +INSERT INTO `dic_city` VALUES ('540174', '540174', '达孜工业园区', '5401', 3); +INSERT INTO `dic_city` VALUES ('5402', '5402', '日喀则市', '54', 2); +INSERT INTO `dic_city` VALUES ('540202', '540202', '桑珠孜区', '5402', 3); +INSERT INTO `dic_city` VALUES ('540221', '540221', '南木林县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540222', '540222', '江孜县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540223', '540223', '定日县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540224', '540224', '萨迦县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540225', '540225', '拉孜县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540226', '540226', '昂仁县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540227', '540227', '谢通门县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540228', '540228', '白朗县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540229', '540229', '仁布县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540230', '540230', '康马县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540231', '540231', '定结县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540232', '540232', '仲巴县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540233', '540233', '亚东县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540234', '540234', '吉隆县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540235', '540235', '聂拉木县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540236', '540236', '萨嘎县', '5402', 3); +INSERT INTO `dic_city` VALUES ('540237', '540237', '岗巴县', '5402', 3); +INSERT INTO `dic_city` VALUES ('5403', '5403', '昌都市', '54', 2); +INSERT INTO `dic_city` VALUES ('540302', '540302', '卡若区', '5403', 3); +INSERT INTO `dic_city` VALUES ('540321', '540321', '江达县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540322', '540322', '贡觉县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540323', '540323', '类乌齐县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540324', '540324', '丁青县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540325', '540325', '察雅县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540326', '540326', '八宿县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540327', '540327', '左贡县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540328', '540328', '芒康县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540329', '540329', '洛隆县', '5403', 3); +INSERT INTO `dic_city` VALUES ('540330', '540330', '边坝县', '5403', 3); +INSERT INTO `dic_city` VALUES ('5404', '5404', '林芝市', '54', 2); +INSERT INTO `dic_city` VALUES ('540402', '540402', '巴宜区', '5404', 3); +INSERT INTO `dic_city` VALUES ('540421', '540421', '工布江达县', '5404', 3); +INSERT INTO `dic_city` VALUES ('540422', '540422', '米林县', '5404', 3); +INSERT INTO `dic_city` VALUES ('540423', '540423', '墨脱县', '5404', 3); +INSERT INTO `dic_city` VALUES ('540424', '540424', '波密县', '5404', 3); +INSERT INTO `dic_city` VALUES ('540425', '540425', '察隅县', '5404', 3); +INSERT INTO `dic_city` VALUES ('540426', '540426', '朗县', '5404', 3); +INSERT INTO `dic_city` VALUES ('5405', '5405', '山南市', '54', 2); +INSERT INTO `dic_city` VALUES ('540502', '540502', '乃东区', '5405', 3); +INSERT INTO `dic_city` VALUES ('540521', '540521', '扎囊县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540522', '540522', '贡嘎县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540523', '540523', '桑日县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540524', '540524', '琼结县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540525', '540525', '曲松县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540526', '540526', '措美县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540527', '540527', '洛扎县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540528', '540528', '加查县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540529', '540529', '隆子县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540530', '540530', '错那县', '5405', 3); +INSERT INTO `dic_city` VALUES ('540531', '540531', '浪卡子县', '5405', 3); +INSERT INTO `dic_city` VALUES ('5406', '5406', '那曲市', '54', 2); +INSERT INTO `dic_city` VALUES ('540602', '540602', '色尼区', '5406', 3); +INSERT INTO `dic_city` VALUES ('540621', '540621', '嘉黎县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540622', '540622', '比如县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540623', '540623', '聂荣县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540624', '540624', '安多县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540625', '540625', '申扎县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540626', '540626', '索县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540627', '540627', '班戈县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540628', '540628', '巴青县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540629', '540629', '尼玛县', '5406', 3); +INSERT INTO `dic_city` VALUES ('540630', '540630', '双湖县', '5406', 3); +INSERT INTO `dic_city` VALUES ('5425', '5425', '阿里地区', '54', 2); +INSERT INTO `dic_city` VALUES ('542521', '542521', '普兰县', '5425', 3); +INSERT INTO `dic_city` VALUES ('542522', '542522', '札达县', '5425', 3); +INSERT INTO `dic_city` VALUES ('542523', '542523', '噶尔县', '5425', 3); +INSERT INTO `dic_city` VALUES ('542524', '542524', '日土县', '5425', 3); +INSERT INTO `dic_city` VALUES ('542525', '542525', '革吉县', '5425', 3); +INSERT INTO `dic_city` VALUES ('542526', '542526', '改则县', '5425', 3); +INSERT INTO `dic_city` VALUES ('542527', '542527', '措勤县', '5425', 3); +INSERT INTO `dic_city` VALUES ('61', '61', '陕西省', NULL, 1); +INSERT INTO `dic_city` VALUES ('6101', '6101', '西安市', '61', 2); +INSERT INTO `dic_city` VALUES ('610102', '610102', '新城区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610103', '610103', '碑林区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610104', '610104', '莲湖区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610111', '610111', '灞桥区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610112', '610112', '未央区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610113', '610113', '雁塔区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610114', '610114', '阎良区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610115', '610115', '临潼区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610116', '610116', '长安区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610117', '610117', '高陵区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610118', '610118', '鄠邑区', '6101', 3); +INSERT INTO `dic_city` VALUES ('610122', '610122', '蓝田县', '6101', 3); +INSERT INTO `dic_city` VALUES ('610124', '610124', '周至县', '6101', 3); +INSERT INTO `dic_city` VALUES ('6102', '6102', '铜川市', '61', 2); +INSERT INTO `dic_city` VALUES ('610202', '610202', '王益区', '6102', 3); +INSERT INTO `dic_city` VALUES ('610203', '610203', '印台区', '6102', 3); +INSERT INTO `dic_city` VALUES ('610204', '610204', '耀州区', '6102', 3); +INSERT INTO `dic_city` VALUES ('610222', '610222', '宜君县', '6102', 3); +INSERT INTO `dic_city` VALUES ('6103', '6103', '宝鸡市', '61', 2); +INSERT INTO `dic_city` VALUES ('610302', '610302', '渭滨区', '6103', 3); +INSERT INTO `dic_city` VALUES ('610303', '610303', '金台区', '6103', 3); +INSERT INTO `dic_city` VALUES ('610304', '610304', '陈仓区', '6103', 3); +INSERT INTO `dic_city` VALUES ('610322', '610322', '凤翔县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610323', '610323', '岐山县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610324', '610324', '扶风县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610326', '610326', '眉县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610327', '610327', '陇县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610328', '610328', '千阳县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610329', '610329', '麟游县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610330', '610330', '凤县', '6103', 3); +INSERT INTO `dic_city` VALUES ('610331', '610331', '太白县', '6103', 3); +INSERT INTO `dic_city` VALUES ('6104', '6104', '咸阳市', '61', 2); +INSERT INTO `dic_city` VALUES ('610402', '610402', '秦都区', '6104', 3); +INSERT INTO `dic_city` VALUES ('610403', '610403', '杨陵区', '6104', 3); +INSERT INTO `dic_city` VALUES ('610404', '610404', '渭城区', '6104', 3); +INSERT INTO `dic_city` VALUES ('610422', '610422', '三原县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610423', '610423', '泾阳县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610424', '610424', '乾县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610425', '610425', '礼泉县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610426', '610426', '永寿县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610428', '610428', '长武县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610429', '610429', '旬邑县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610430', '610430', '淳化县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610431', '610431', '武功县', '6104', 3); +INSERT INTO `dic_city` VALUES ('610481', '610481', '兴平市', '6104', 3); +INSERT INTO `dic_city` VALUES ('610482', '610482', '彬州市', '6104', 3); +INSERT INTO `dic_city` VALUES ('6105', '6105', '渭南市', '61', 2); +INSERT INTO `dic_city` VALUES ('610502', '610502', '临渭区', '6105', 3); +INSERT INTO `dic_city` VALUES ('610503', '610503', '华州区', '6105', 3); +INSERT INTO `dic_city` VALUES ('610522', '610522', '潼关县', '6105', 3); +INSERT INTO `dic_city` VALUES ('610523', '610523', '大荔县', '6105', 3); +INSERT INTO `dic_city` VALUES ('610524', '610524', '合阳县', '6105', 3); +INSERT INTO `dic_city` VALUES ('610525', '610525', '澄城县', '6105', 3); +INSERT INTO `dic_city` VALUES ('610526', '610526', '蒲城县', '6105', 3); +INSERT INTO `dic_city` VALUES ('610527', '610527', '白水县', '6105', 3); +INSERT INTO `dic_city` VALUES ('610528', '610528', '富平县', '6105', 3); +INSERT INTO `dic_city` VALUES ('610581', '610581', '韩城市', '6105', 3); +INSERT INTO `dic_city` VALUES ('610582', '610582', '华阴市', '6105', 3); +INSERT INTO `dic_city` VALUES ('6106', '6106', '延安市', '61', 2); +INSERT INTO `dic_city` VALUES ('610602', '610602', '宝塔区', '6106', 3); +INSERT INTO `dic_city` VALUES ('610603', '610603', '安塞区', '6106', 3); +INSERT INTO `dic_city` VALUES ('610621', '610621', '延长县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610622', '610622', '延川县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610625', '610625', '志丹县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610626', '610626', '吴起县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610627', '610627', '甘泉县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610628', '610628', '富县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610629', '610629', '洛川县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610630', '610630', '宜川县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610631', '610631', '黄龙县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610632', '610632', '黄陵县', '6106', 3); +INSERT INTO `dic_city` VALUES ('610681', '610681', '子长市', '6106', 3); +INSERT INTO `dic_city` VALUES ('6107', '6107', '汉中市', '61', 2); +INSERT INTO `dic_city` VALUES ('610702', '610702', '汉台区', '6107', 3); +INSERT INTO `dic_city` VALUES ('610703', '610703', '南郑区', '6107', 3); +INSERT INTO `dic_city` VALUES ('610722', '610722', '城固县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610723', '610723', '洋县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610724', '610724', '西乡县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610725', '610725', '勉县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610726', '610726', '宁强县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610727', '610727', '略阳县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610728', '610728', '镇巴县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610729', '610729', '留坝县', '6107', 3); +INSERT INTO `dic_city` VALUES ('610730', '610730', '佛坪县', '6107', 3); +INSERT INTO `dic_city` VALUES ('6108', '6108', '榆林市', '61', 2); +INSERT INTO `dic_city` VALUES ('610802', '610802', '榆阳区', '6108', 3); +INSERT INTO `dic_city` VALUES ('610803', '610803', '横山区', '6108', 3); +INSERT INTO `dic_city` VALUES ('610822', '610822', '府谷县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610824', '610824', '靖边县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610825', '610825', '定边县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610826', '610826', '绥德县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610827', '610827', '米脂县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610828', '610828', '佳县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610829', '610829', '吴堡县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610830', '610830', '清涧县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610831', '610831', '子洲县', '6108', 3); +INSERT INTO `dic_city` VALUES ('610881', '610881', '神木市', '6108', 3); +INSERT INTO `dic_city` VALUES ('6109', '6109', '安康市', '61', 2); +INSERT INTO `dic_city` VALUES ('610902', '610902', '汉滨区', '6109', 3); +INSERT INTO `dic_city` VALUES ('610921', '610921', '汉阴县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610922', '610922', '石泉县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610923', '610923', '宁陕县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610924', '610924', '紫阳县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610925', '610925', '岚皋县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610926', '610926', '平利县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610927', '610927', '镇坪县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610928', '610928', '旬阳县', '6109', 3); +INSERT INTO `dic_city` VALUES ('610929', '610929', '白河县', '6109', 3); +INSERT INTO `dic_city` VALUES ('6110', '6110', '商洛市', '61', 2); +INSERT INTO `dic_city` VALUES ('611002', '611002', '商州区', '6110', 3); +INSERT INTO `dic_city` VALUES ('611021', '611021', '洛南县', '6110', 3); +INSERT INTO `dic_city` VALUES ('611022', '611022', '丹凤县', '6110', 3); +INSERT INTO `dic_city` VALUES ('611023', '611023', '商南县', '6110', 3); +INSERT INTO `dic_city` VALUES ('611024', '611024', '山阳县', '6110', 3); +INSERT INTO `dic_city` VALUES ('611025', '611025', '镇安县', '6110', 3); +INSERT INTO `dic_city` VALUES ('611026', '611026', '柞水县', '6110', 3); +INSERT INTO `dic_city` VALUES ('62', '62', '甘肃省', NULL, 1); +INSERT INTO `dic_city` VALUES ('6201', '6201', '兰州市', '62', 2); +INSERT INTO `dic_city` VALUES ('620102', '620102', '城关区', '6201', 3); +INSERT INTO `dic_city` VALUES ('620103', '620103', '七里河区', '6201', 3); +INSERT INTO `dic_city` VALUES ('620104', '620104', '西固区', '6201', 3); +INSERT INTO `dic_city` VALUES ('620105', '620105', '安宁区', '6201', 3); +INSERT INTO `dic_city` VALUES ('620111', '620111', '红古区', '6201', 3); +INSERT INTO `dic_city` VALUES ('620121', '620121', '永登县', '6201', 3); +INSERT INTO `dic_city` VALUES ('620122', '620122', '皋兰县', '6201', 3); +INSERT INTO `dic_city` VALUES ('620123', '620123', '榆中县', '6201', 3); +INSERT INTO `dic_city` VALUES ('620171', '620171', '兰州新区', '6201', 3); +INSERT INTO `dic_city` VALUES ('6202', '6202', '嘉峪关市', '62', 2); +INSERT INTO `dic_city` VALUES ('620201001', '620201001', '雄关街道', '6202', 3); +INSERT INTO `dic_city` VALUES ('620201002', '620201002', '钢城街道', '6202', 3); +INSERT INTO `dic_city` VALUES ('620201100', '620201100', '新城镇', '6202', 3); +INSERT INTO `dic_city` VALUES ('620201101', '620201101', '峪泉镇', '6202', 3); +INSERT INTO `dic_city` VALUES ('620201102', '620201102', '文殊镇', '6202', 3); +INSERT INTO `dic_city` VALUES ('6203', '6203', '金昌市', '62', 2); +INSERT INTO `dic_city` VALUES ('620302', '620302', '金川区', '6203', 3); +INSERT INTO `dic_city` VALUES ('620321', '620321', '永昌县', '6203', 3); +INSERT INTO `dic_city` VALUES ('6204', '6204', '白银市', '62', 2); +INSERT INTO `dic_city` VALUES ('620402', '620402', '白银区', '6204', 3); +INSERT INTO `dic_city` VALUES ('620403', '620403', '平川区', '6204', 3); +INSERT INTO `dic_city` VALUES ('620421', '620421', '靖远县', '6204', 3); +INSERT INTO `dic_city` VALUES ('620422', '620422', '会宁县', '6204', 3); +INSERT INTO `dic_city` VALUES ('620423', '620423', '景泰县', '6204', 3); +INSERT INTO `dic_city` VALUES ('6205', '6205', '天水市', '62', 2); +INSERT INTO `dic_city` VALUES ('620502', '620502', '秦州区', '6205', 3); +INSERT INTO `dic_city` VALUES ('620503', '620503', '麦积区', '6205', 3); +INSERT INTO `dic_city` VALUES ('620521', '620521', '清水县', '6205', 3); +INSERT INTO `dic_city` VALUES ('620522', '620522', '秦安县', '6205', 3); +INSERT INTO `dic_city` VALUES ('620523', '620523', '甘谷县', '6205', 3); +INSERT INTO `dic_city` VALUES ('620524', '620524', '武山县', '6205', 3); +INSERT INTO `dic_city` VALUES ('620525', '620525', '张家川回族自治县', '6205', 3); +INSERT INTO `dic_city` VALUES ('6206', '6206', '武威市', '62', 2); +INSERT INTO `dic_city` VALUES ('620602', '620602', '凉州区', '6206', 3); +INSERT INTO `dic_city` VALUES ('620621', '620621', '民勤县', '6206', 3); +INSERT INTO `dic_city` VALUES ('620622', '620622', '古浪县', '6206', 3); +INSERT INTO `dic_city` VALUES ('620623', '620623', '天祝藏族自治县', '6206', 3); +INSERT INTO `dic_city` VALUES ('6207', '6207', '张掖市', '62', 2); +INSERT INTO `dic_city` VALUES ('620702', '620702', '甘州区', '6207', 3); +INSERT INTO `dic_city` VALUES ('620721', '620721', '肃南裕固族自治县', '6207', 3); +INSERT INTO `dic_city` VALUES ('620722', '620722', '民乐县', '6207', 3); +INSERT INTO `dic_city` VALUES ('620723', '620723', '临泽县', '6207', 3); +INSERT INTO `dic_city` VALUES ('620724', '620724', '高台县', '6207', 3); +INSERT INTO `dic_city` VALUES ('620725', '620725', '山丹县', '6207', 3); +INSERT INTO `dic_city` VALUES ('6208', '6208', '平凉市', '62', 2); +INSERT INTO `dic_city` VALUES ('620802', '620802', '崆峒区', '6208', 3); +INSERT INTO `dic_city` VALUES ('620821', '620821', '泾川县', '6208', 3); +INSERT INTO `dic_city` VALUES ('620822', '620822', '灵台县', '6208', 3); +INSERT INTO `dic_city` VALUES ('620823', '620823', '崇信县', '6208', 3); +INSERT INTO `dic_city` VALUES ('620825', '620825', '庄浪县', '6208', 3); +INSERT INTO `dic_city` VALUES ('620826', '620826', '静宁县', '6208', 3); +INSERT INTO `dic_city` VALUES ('620881', '620881', '华亭市', '6208', 3); +INSERT INTO `dic_city` VALUES ('6209', '6209', '酒泉市', '62', 2); +INSERT INTO `dic_city` VALUES ('620902', '620902', '肃州区', '6209', 3); +INSERT INTO `dic_city` VALUES ('620921', '620921', '金塔县', '6209', 3); +INSERT INTO `dic_city` VALUES ('620922', '620922', '瓜州县', '6209', 3); +INSERT INTO `dic_city` VALUES ('620923', '620923', '肃北蒙古族自治县', '6209', 3); +INSERT INTO `dic_city` VALUES ('620924', '620924', '阿克塞哈萨克族自治县', '6209', 3); +INSERT INTO `dic_city` VALUES ('620981', '620981', '玉门市', '6209', 3); +INSERT INTO `dic_city` VALUES ('620982', '620982', '敦煌市', '6209', 3); +INSERT INTO `dic_city` VALUES ('6210', '6210', '庆阳市', '62', 2); +INSERT INTO `dic_city` VALUES ('621002', '621002', '西峰区', '6210', 3); +INSERT INTO `dic_city` VALUES ('621021', '621021', '庆城县', '6210', 3); +INSERT INTO `dic_city` VALUES ('621022', '621022', '环县', '6210', 3); +INSERT INTO `dic_city` VALUES ('621023', '621023', '华池县', '6210', 3); +INSERT INTO `dic_city` VALUES ('621024', '621024', '合水县', '6210', 3); +INSERT INTO `dic_city` VALUES ('621025', '621025', '正宁县', '6210', 3); +INSERT INTO `dic_city` VALUES ('621026', '621026', '宁县', '6210', 3); +INSERT INTO `dic_city` VALUES ('621027', '621027', '镇原县', '6210', 3); +INSERT INTO `dic_city` VALUES ('6211', '6211', '定西市', '62', 2); +INSERT INTO `dic_city` VALUES ('621102', '621102', '安定区', '6211', 3); +INSERT INTO `dic_city` VALUES ('621121', '621121', '通渭县', '6211', 3); +INSERT INTO `dic_city` VALUES ('621122', '621122', '陇西县', '6211', 3); +INSERT INTO `dic_city` VALUES ('621123', '621123', '渭源县', '6211', 3); +INSERT INTO `dic_city` VALUES ('621124', '621124', '临洮县', '6211', 3); +INSERT INTO `dic_city` VALUES ('621125', '621125', '漳县', '6211', 3); +INSERT INTO `dic_city` VALUES ('621126', '621126', '岷县', '6211', 3); +INSERT INTO `dic_city` VALUES ('6212', '6212', '陇南市', '62', 2); +INSERT INTO `dic_city` VALUES ('621202', '621202', '武都区', '6212', 3); +INSERT INTO `dic_city` VALUES ('621221', '621221', '成县', '6212', 3); +INSERT INTO `dic_city` VALUES ('621222', '621222', '文县', '6212', 3); +INSERT INTO `dic_city` VALUES ('621223', '621223', '宕昌县', '6212', 3); +INSERT INTO `dic_city` VALUES ('621224', '621224', '康县', '6212', 3); +INSERT INTO `dic_city` VALUES ('621225', '621225', '西和县', '6212', 3); +INSERT INTO `dic_city` VALUES ('621226', '621226', '礼县', '6212', 3); +INSERT INTO `dic_city` VALUES ('621227', '621227', '徽县', '6212', 3); +INSERT INTO `dic_city` VALUES ('621228', '621228', '两当县', '6212', 3); +INSERT INTO `dic_city` VALUES ('6229', '6229', '临夏回族自治州', '62', 2); +INSERT INTO `dic_city` VALUES ('622901', '622901', '临夏市', '6229', 3); +INSERT INTO `dic_city` VALUES ('622921', '622921', '临夏县', '6229', 3); +INSERT INTO `dic_city` VALUES ('622922', '622922', '康乐县', '6229', 3); +INSERT INTO `dic_city` VALUES ('622923', '622923', '永靖县', '6229', 3); +INSERT INTO `dic_city` VALUES ('622924', '622924', '广河县', '6229', 3); +INSERT INTO `dic_city` VALUES ('622925', '622925', '和政县', '6229', 3); +INSERT INTO `dic_city` VALUES ('622926', '622926', '东乡族自治县', '6229', 3); +INSERT INTO `dic_city` VALUES ('622927', '622927', '积石山保安族东乡族撒拉族自治县', '6229', 3); +INSERT INTO `dic_city` VALUES ('6230', '6230', '甘南藏族自治州', '62', 2); +INSERT INTO `dic_city` VALUES ('623001', '623001', '合作市', '6230', 3); +INSERT INTO `dic_city` VALUES ('623021', '623021', '临潭县', '6230', 3); +INSERT INTO `dic_city` VALUES ('623022', '623022', '卓尼县', '6230', 3); +INSERT INTO `dic_city` VALUES ('623023', '623023', '舟曲县', '6230', 3); +INSERT INTO `dic_city` VALUES ('623024', '623024', '迭部县', '6230', 3); +INSERT INTO `dic_city` VALUES ('623025', '623025', '玛曲县', '6230', 3); +INSERT INTO `dic_city` VALUES ('623026', '623026', '碌曲县', '6230', 3); +INSERT INTO `dic_city` VALUES ('623027', '623027', '夏河县', '6230', 3); +INSERT INTO `dic_city` VALUES ('63', '63', '青海省', NULL, 1); +INSERT INTO `dic_city` VALUES ('6301', '6301', '西宁市', '63', 2); +INSERT INTO `dic_city` VALUES ('630102', '630102', '城东区', '6301', 3); +INSERT INTO `dic_city` VALUES ('630103', '630103', '城中区', '6301', 3); +INSERT INTO `dic_city` VALUES ('630104', '630104', '城西区', '6301', 3); +INSERT INTO `dic_city` VALUES ('630105', '630105', '城北区', '6301', 3); +INSERT INTO `dic_city` VALUES ('630106', '630106', '湟中区', '6301', 3); +INSERT INTO `dic_city` VALUES ('630121', '630121', '大通回族土族自治县', '6301', 3); +INSERT INTO `dic_city` VALUES ('630123', '630123', '湟源县', '6301', 3); +INSERT INTO `dic_city` VALUES ('6302', '6302', '海东市', '63', 2); +INSERT INTO `dic_city` VALUES ('630202', '630202', '乐都区', '6302', 3); +INSERT INTO `dic_city` VALUES ('630203', '630203', '平安区', '6302', 3); +INSERT INTO `dic_city` VALUES ('630222', '630222', '民和回族土族自治县', '6302', 3); +INSERT INTO `dic_city` VALUES ('630223', '630223', '互助土族自治县', '6302', 3); +INSERT INTO `dic_city` VALUES ('630224', '630224', '化隆回族自治县', '6302', 3); +INSERT INTO `dic_city` VALUES ('630225', '630225', '循化撒拉族自治县', '6302', 3); +INSERT INTO `dic_city` VALUES ('6322', '6322', '海北藏族自治州', '63', 2); +INSERT INTO `dic_city` VALUES ('632221', '632221', '门源回族自治县', '6322', 3); +INSERT INTO `dic_city` VALUES ('632222', '632222', '祁连县', '6322', 3); +INSERT INTO `dic_city` VALUES ('632223', '632223', '海晏县', '6322', 3); +INSERT INTO `dic_city` VALUES ('632224', '632224', '刚察县', '6322', 3); +INSERT INTO `dic_city` VALUES ('6323', '6323', '黄南藏族自治州', '63', 2); +INSERT INTO `dic_city` VALUES ('632321', '632321', '同仁县', '6323', 3); +INSERT INTO `dic_city` VALUES ('632322', '632322', '尖扎县', '6323', 3); +INSERT INTO `dic_city` VALUES ('632323', '632323', '泽库县', '6323', 3); +INSERT INTO `dic_city` VALUES ('632324', '632324', '河南蒙古族自治县', '6323', 3); +INSERT INTO `dic_city` VALUES ('6325', '6325', '海南藏族自治州', '63', 2); +INSERT INTO `dic_city` VALUES ('632521', '632521', '共和县', '6325', 3); +INSERT INTO `dic_city` VALUES ('632522', '632522', '同德县', '6325', 3); +INSERT INTO `dic_city` VALUES ('632523', '632523', '贵德县', '6325', 3); +INSERT INTO `dic_city` VALUES ('632524', '632524', '兴海县', '6325', 3); +INSERT INTO `dic_city` VALUES ('632525', '632525', '贵南县', '6325', 3); +INSERT INTO `dic_city` VALUES ('6326', '6326', '果洛藏族自治州', '63', 2); +INSERT INTO `dic_city` VALUES ('632621', '632621', '玛沁县', '6326', 3); +INSERT INTO `dic_city` VALUES ('632622', '632622', '班玛县', '6326', 3); +INSERT INTO `dic_city` VALUES ('632623', '632623', '甘德县', '6326', 3); +INSERT INTO `dic_city` VALUES ('632624', '632624', '达日县', '6326', 3); +INSERT INTO `dic_city` VALUES ('632625', '632625', '久治县', '6326', 3); +INSERT INTO `dic_city` VALUES ('632626', '632626', '玛多县', '6326', 3); +INSERT INTO `dic_city` VALUES ('6327', '6327', '玉树藏族自治州', '63', 2); +INSERT INTO `dic_city` VALUES ('632701', '632701', '玉树市', '6327', 3); +INSERT INTO `dic_city` VALUES ('632722', '632722', '杂多县', '6327', 3); +INSERT INTO `dic_city` VALUES ('632723', '632723', '称多县', '6327', 3); +INSERT INTO `dic_city` VALUES ('632724', '632724', '治多县', '6327', 3); +INSERT INTO `dic_city` VALUES ('632725', '632725', '囊谦县', '6327', 3); +INSERT INTO `dic_city` VALUES ('632726', '632726', '曲麻莱县', '6327', 3); +INSERT INTO `dic_city` VALUES ('6328', '6328', '海西蒙古族藏族自治州', '63', 2); +INSERT INTO `dic_city` VALUES ('632801', '632801', '格尔木市', '6328', 3); +INSERT INTO `dic_city` VALUES ('632802', '632802', '德令哈市', '6328', 3); +INSERT INTO `dic_city` VALUES ('632803', '632803', '茫崖市', '6328', 3); +INSERT INTO `dic_city` VALUES ('632821', '632821', '乌兰县', '6328', 3); +INSERT INTO `dic_city` VALUES ('632822', '632822', '都兰县', '6328', 3); +INSERT INTO `dic_city` VALUES ('632823', '632823', '天峻县', '6328', 3); +INSERT INTO `dic_city` VALUES ('632857', '632857', '大柴旦行政委员会', '6328', 3); +INSERT INTO `dic_city` VALUES ('64', '64', '宁夏回族自治区', NULL, 1); +INSERT INTO `dic_city` VALUES ('6401', '6401', '银川市', '64', 2); +INSERT INTO `dic_city` VALUES ('640104', '640104', '兴庆区', '6401', 3); +INSERT INTO `dic_city` VALUES ('640105', '640105', '西夏区', '6401', 3); +INSERT INTO `dic_city` VALUES ('640106', '640106', '金凤区', '6401', 3); +INSERT INTO `dic_city` VALUES ('640121', '640121', '永宁县', '6401', 3); +INSERT INTO `dic_city` VALUES ('640122', '640122', '贺兰县', '6401', 3); +INSERT INTO `dic_city` VALUES ('640181', '640181', '灵武市', '6401', 3); +INSERT INTO `dic_city` VALUES ('6402', '6402', '石嘴山市', '64', 2); +INSERT INTO `dic_city` VALUES ('640202', '640202', '大武口区', '6402', 3); +INSERT INTO `dic_city` VALUES ('640205', '640205', '惠农区', '6402', 3); +INSERT INTO `dic_city` VALUES ('640221', '640221', '平罗县', '6402', 3); +INSERT INTO `dic_city` VALUES ('6403', '6403', '吴忠市', '64', 2); +INSERT INTO `dic_city` VALUES ('640302', '640302', '利通区', '6403', 3); +INSERT INTO `dic_city` VALUES ('640303', '640303', '红寺堡区', '6403', 3); +INSERT INTO `dic_city` VALUES ('640323', '640323', '盐池县', '6403', 3); +INSERT INTO `dic_city` VALUES ('640324', '640324', '同心县', '6403', 3); +INSERT INTO `dic_city` VALUES ('640381', '640381', '青铜峡市', '6403', 3); +INSERT INTO `dic_city` VALUES ('6404', '6404', '固原市', '64', 2); +INSERT INTO `dic_city` VALUES ('640402', '640402', '原州区', '6404', 3); +INSERT INTO `dic_city` VALUES ('640422', '640422', '西吉县', '6404', 3); +INSERT INTO `dic_city` VALUES ('640423', '640423', '隆德县', '6404', 3); +INSERT INTO `dic_city` VALUES ('640424', '640424', '泾源县', '6404', 3); +INSERT INTO `dic_city` VALUES ('640425', '640425', '彭阳县', '6404', 3); +INSERT INTO `dic_city` VALUES ('6405', '6405', '中卫市', '64', 2); +INSERT INTO `dic_city` VALUES ('640502', '640502', '沙坡头区', '6405', 3); +INSERT INTO `dic_city` VALUES ('640521', '640521', '中宁县', '6405', 3); +INSERT INTO `dic_city` VALUES ('640522', '640522', '海原县', '6405', 3); +INSERT INTO `dic_city` VALUES ('65', '65', '新疆维吾尔自治区', NULL, 1); +INSERT INTO `dic_city` VALUES ('6501', '6501', '乌鲁木齐市', '65', 2); +INSERT INTO `dic_city` VALUES ('650102', '650102', '天山区', '6501', 3); +INSERT INTO `dic_city` VALUES ('650103', '650103', '沙依巴克区', '6501', 3); +INSERT INTO `dic_city` VALUES ('650104', '650104', '新市区', '6501', 3); +INSERT INTO `dic_city` VALUES ('650105', '650105', '水磨沟区', '6501', 3); +INSERT INTO `dic_city` VALUES ('650106', '650106', '头屯河区', '6501', 3); +INSERT INTO `dic_city` VALUES ('650107', '650107', '达坂城区', '6501', 3); +INSERT INTO `dic_city` VALUES ('650109', '650109', '米东区', '6501', 3); +INSERT INTO `dic_city` VALUES ('650121', '650121', '乌鲁木齐县', '6501', 3); +INSERT INTO `dic_city` VALUES ('6502', '6502', '克拉玛依市', '65', 2); +INSERT INTO `dic_city` VALUES ('650202', '650202', '独山子区', '6502', 3); +INSERT INTO `dic_city` VALUES ('650203', '650203', '克拉玛依区', '6502', 3); +INSERT INTO `dic_city` VALUES ('650204', '650204', '白碱滩区', '6502', 3); +INSERT INTO `dic_city` VALUES ('650205', '650205', '乌尔禾区', '6502', 3); +INSERT INTO `dic_city` VALUES ('6504', '6504', '吐鲁番市', '65', 2); +INSERT INTO `dic_city` VALUES ('650402', '650402', '高昌区', '6504', 3); +INSERT INTO `dic_city` VALUES ('650421', '650421', '鄯善县', '6504', 3); +INSERT INTO `dic_city` VALUES ('650422', '650422', '托克逊县', '6504', 3); +INSERT INTO `dic_city` VALUES ('6505', '6505', '哈密市', '65', 2); +INSERT INTO `dic_city` VALUES ('650502', '650502', '伊州区', '6505', 3); +INSERT INTO `dic_city` VALUES ('650521', '650521', '巴里坤哈萨克自治县', '6505', 3); +INSERT INTO `dic_city` VALUES ('650522', '650522', '伊吾县', '6505', 3); +INSERT INTO `dic_city` VALUES ('6523', '6523', '昌吉回族自治州', '65', 2); +INSERT INTO `dic_city` VALUES ('652301', '652301', '昌吉市', '6523', 3); +INSERT INTO `dic_city` VALUES ('652302', '652302', '阜康市', '6523', 3); +INSERT INTO `dic_city` VALUES ('652323', '652323', '呼图壁县', '6523', 3); +INSERT INTO `dic_city` VALUES ('652324', '652324', '玛纳斯县', '6523', 3); +INSERT INTO `dic_city` VALUES ('652325', '652325', '奇台县', '6523', 3); +INSERT INTO `dic_city` VALUES ('652327', '652327', '吉木萨尔县', '6523', 3); +INSERT INTO `dic_city` VALUES ('652328', '652328', '木垒哈萨克自治县', '6523', 3); +INSERT INTO `dic_city` VALUES ('6527', '6527', '博尔塔拉蒙古自治州', '65', 2); +INSERT INTO `dic_city` VALUES ('652701', '652701', '博乐市', '6527', 3); +INSERT INTO `dic_city` VALUES ('652702', '652702', '阿拉山口市', '6527', 3); +INSERT INTO `dic_city` VALUES ('652722', '652722', '精河县', '6527', 3); +INSERT INTO `dic_city` VALUES ('652723', '652723', '温泉县', '6527', 3); +INSERT INTO `dic_city` VALUES ('6528', '6528', '巴音郭楞蒙古自治州', '65', 2); +INSERT INTO `dic_city` VALUES ('652801', '652801', '库尔勒市', '6528', 3); +INSERT INTO `dic_city` VALUES ('652822', '652822', '轮台县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652823', '652823', '尉犁县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652824', '652824', '若羌县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652825', '652825', '且末县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652826', '652826', '焉耆回族自治县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652827', '652827', '和静县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652828', '652828', '和硕县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652829', '652829', '博湖县', '6528', 3); +INSERT INTO `dic_city` VALUES ('652871', '652871', '库尔勒经济技术开发区', '6528', 3); +INSERT INTO `dic_city` VALUES ('6529', '6529', '阿克苏地区', '65', 2); +INSERT INTO `dic_city` VALUES ('652901', '652901', '阿克苏市', '6529', 3); +INSERT INTO `dic_city` VALUES ('652902', '652902', '库车市', '6529', 3); +INSERT INTO `dic_city` VALUES ('652922', '652922', '温宿县', '6529', 3); +INSERT INTO `dic_city` VALUES ('652924', '652924', '沙雅县', '6529', 3); +INSERT INTO `dic_city` VALUES ('652925', '652925', '新和县', '6529', 3); +INSERT INTO `dic_city` VALUES ('652926', '652926', '拜城县', '6529', 3); +INSERT INTO `dic_city` VALUES ('652927', '652927', '乌什县', '6529', 3); +INSERT INTO `dic_city` VALUES ('652928', '652928', '阿瓦提县', '6529', 3); +INSERT INTO `dic_city` VALUES ('652929', '652929', '柯坪县', '6529', 3); +INSERT INTO `dic_city` VALUES ('6530', '6530', '克孜勒苏柯尔克孜自治州', '65', 2); +INSERT INTO `dic_city` VALUES ('653001', '653001', '阿图什市', '6530', 3); +INSERT INTO `dic_city` VALUES ('653022', '653022', '阿克陶县', '6530', 3); +INSERT INTO `dic_city` VALUES ('653023', '653023', '阿合奇县', '6530', 3); +INSERT INTO `dic_city` VALUES ('653024', '653024', '乌恰县', '6530', 3); +INSERT INTO `dic_city` VALUES ('6531', '6531', '喀什地区', '65', 2); +INSERT INTO `dic_city` VALUES ('653101', '653101', '喀什市', '6531', 3); +INSERT INTO `dic_city` VALUES ('653121', '653121', '疏附县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653122', '653122', '疏勒县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653123', '653123', '英吉沙县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653124', '653124', '泽普县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653125', '653125', '莎车县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653126', '653126', '叶城县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653127', '653127', '麦盖提县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653128', '653128', '岳普湖县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653129', '653129', '伽师县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653130', '653130', '巴楚县', '6531', 3); +INSERT INTO `dic_city` VALUES ('653131', '653131', '塔什库尔干塔吉克自治县', '6531', 3); +INSERT INTO `dic_city` VALUES ('6532', '6532', '和田地区', '65', 2); +INSERT INTO `dic_city` VALUES ('653201', '653201', '和田市', '6532', 3); +INSERT INTO `dic_city` VALUES ('653221', '653221', '和田县', '6532', 3); +INSERT INTO `dic_city` VALUES ('653222', '653222', '墨玉县', '6532', 3); +INSERT INTO `dic_city` VALUES ('653223', '653223', '皮山县', '6532', 3); +INSERT INTO `dic_city` VALUES ('653224', '653224', '洛浦县', '6532', 3); +INSERT INTO `dic_city` VALUES ('653225', '653225', '策勒县', '6532', 3); +INSERT INTO `dic_city` VALUES ('653226', '653226', '于田县', '6532', 3); +INSERT INTO `dic_city` VALUES ('653227', '653227', '民丰县', '6532', 3); +INSERT INTO `dic_city` VALUES ('6540', '6540', '伊犁哈萨克自治州', '65', 2); +INSERT INTO `dic_city` VALUES ('654002', '654002', '伊宁市', '6540', 3); +INSERT INTO `dic_city` VALUES ('654003', '654003', '奎屯市', '6540', 3); +INSERT INTO `dic_city` VALUES ('654004', '654004', '霍尔果斯市', '6540', 3); +INSERT INTO `dic_city` VALUES ('654021', '654021', '伊宁县', '6540', 3); +INSERT INTO `dic_city` VALUES ('654022', '654022', '察布查尔锡伯自治县', '6540', 3); +INSERT INTO `dic_city` VALUES ('654023', '654023', '霍城县', '6540', 3); +INSERT INTO `dic_city` VALUES ('654024', '654024', '巩留县', '6540', 3); +INSERT INTO `dic_city` VALUES ('654025', '654025', '新源县', '6540', 3); +INSERT INTO `dic_city` VALUES ('654026', '654026', '昭苏县', '6540', 3); +INSERT INTO `dic_city` VALUES ('654027', '654027', '特克斯县', '6540', 3); +INSERT INTO `dic_city` VALUES ('654028', '654028', '尼勒克县', '6540', 3); +INSERT INTO `dic_city` VALUES ('6542', '6542', '塔城地区', '65', 2); +INSERT INTO `dic_city` VALUES ('654201', '654201', '塔城市', '6542', 3); +INSERT INTO `dic_city` VALUES ('654202', '654202', '乌苏市', '6542', 3); +INSERT INTO `dic_city` VALUES ('654221', '654221', '额敏县', '6542', 3); +INSERT INTO `dic_city` VALUES ('654223', '654223', '沙湾县', '6542', 3); +INSERT INTO `dic_city` VALUES ('654224', '654224', '托里县', '6542', 3); +INSERT INTO `dic_city` VALUES ('654225', '654225', '裕民县', '6542', 3); +INSERT INTO `dic_city` VALUES ('654226', '654226', '和布克赛尔蒙古自治县', '6542', 3); +INSERT INTO `dic_city` VALUES ('6543', '6543', '阿勒泰地区', '65', 2); +INSERT INTO `dic_city` VALUES ('654301', '654301', '阿勒泰市', '6543', 3); +INSERT INTO `dic_city` VALUES ('654321', '654321', '布尔津县', '6543', 3); +INSERT INTO `dic_city` VALUES ('654322', '654322', '富蕴县', '6543', 3); +INSERT INTO `dic_city` VALUES ('654323', '654323', '福海县', '6543', 3); +INSERT INTO `dic_city` VALUES ('654324', '654324', '哈巴河县', '6543', 3); +INSERT INTO `dic_city` VALUES ('654325', '654325', '青河县', '6543', 3); +INSERT INTO `dic_city` VALUES ('654326', '654326', '吉木乃县', '6543', 3); +INSERT INTO `dic_city` VALUES ('6590', '6590', '自治区直辖县级行政区划', '65', 2); +INSERT INTO `dic_city` VALUES ('659001', '659001', '石河子市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659002', '659002', '阿拉尔市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659003', '659003', '图木舒克市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659004', '659004', '五家渠市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659005', '659005', '北屯市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659006', '659006', '铁门关市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659007', '659007', '双河市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659008', '659008', '可克达拉市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659009', '659009', '昆玉市', '6590', 3); +INSERT INTO `dic_city` VALUES ('659010', '659010', '胡杨河市', '6590', 3); + +-- ---------------------------- +-- Table structure for gen_create_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_create_column_config`; +CREATE TABLE `gen_create_column_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `required` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否必填', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '新增功能代码生成配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_create_column_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_form +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_form`; +CREATE TABLE `gen_custom_form` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类ID', + `is_dialog` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否对话框表单', + `dialog_tittle` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对话框标题', + `dialog_width` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '1' COMMENT '对话框宽度', + `form_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '表单配置', + `prefix_submit` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '前置提交脚本', + `suffix_submit` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '后置提交脚本', + `require_query` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否需要查询', + `query_bean` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '查询数据Bean名称', + `handle_bean` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '操作数据Bean名称', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `category_id`(`category_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义对话框' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_form +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_form_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_form_category`; +CREATE TABLE `gen_custom_form_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义列表分类' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_form_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_list +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list`; +CREATE TABLE `gen_custom_list` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类ID', + `data_obj_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '数据对象ID', + `list_type` tinyint(3) NOT NULL DEFAULT 0 COMMENT '列表类型', + `label_width` int(11) NOT NULL COMMENT '表单Label宽度', + `has_page` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否分页', + `tree_data` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否树形列表', + `id_column` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ID字段', + `id_column_rela_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ID字段关联ID', + `tree_pid_column` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级ID字段', + `tree_pid_column_rela_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级ID字段关联ID', + `tree_node_column` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '树形节点字段', + `tree_node_column_rela_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '树形节点字段关联ID', + `tree_children_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '子节点Key值', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `query_prefix_sql` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '查询前置SQL', + `query_suffix_sql` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '查询后置SQL', + `suffix_sql` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '后置SQL', + `allow_export` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否允许导出', + PRIMARY KEY (`id`) USING BTREE, + INDEX `category_id`(`category_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义列表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_list +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_list_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_category`; +CREATE TABLE `gen_custom_list_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义列表分类' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_list_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_list_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_detail`; +CREATE TABLE `gen_custom_list_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `custom_list_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '自定义列表ID', + `rela_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联ID', + `data_entity_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据实体ID', + `width_type` tinyint(3) NOT NULL COMMENT '宽度类型', + `width` int(11) NOT NULL COMMENT '宽度', + `sortable` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否页面排序', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `type` tinyint(3) NOT NULL COMMENT '类型', + `formatter` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '格式化脚本', + PRIMARY KEY (`id`) USING BTREE, + INDEX `custom_list_id`(`custom_list_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义列表明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_list_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_list_handle_column +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_handle_column`; +CREATE TABLE `gen_custom_list_handle_column` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `custom_list_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '自定义列表ID', + `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '显示名称', + `view_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '显示类型', + `btn_type` tinyint(3) NOT NULL COMMENT '按钮类型', + `btn_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '按钮配置', + `request_param` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求参数', + `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标', + `width` int(11) NOT NULL COMMENT '宽度', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义列表工具栏' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_list_handle_column +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_list_query_params +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_query_params`; +CREATE TABLE `gen_custom_list_query_params` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `custom_list_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '自定义列表ID', + `rela_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关联ID', + `data_entity_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据实体ID', + `front_show` tinyint(1) NOT NULL DEFAULT 1 COMMENT '前端显示', + `query_type` tinyint(3) NOT NULL COMMENT '查询类型', + `form_width` int(11) NOT NULL DEFAULT 6 COMMENT '表单宽度', + `default_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '默认值', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `type` tinyint(3) NOT NULL COMMENT '类型', + PRIMARY KEY (`id`) USING BTREE, + INDEX `custom_list_id`(`custom_list_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义列表查询参数' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_list_query_params +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_list_toolbar +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_toolbar`; +CREATE TABLE `gen_custom_list_toolbar` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `custom_list_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '自定义列表ID', + `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '显示名称', + `view_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '显示类型', + `btn_type` tinyint(3) NOT NULL COMMENT '按钮类型', + `btn_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '按钮配置', + `request_param` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '请求参数', + `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义列表工具栏' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_list_toolbar +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_page +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_page`; +CREATE TABLE `gen_custom_page` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类ID', + `page_code` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '页面代码', + `script_code` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '脚本代码', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `category_id`(`category_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义页面' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of gen_custom_page +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_page_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_page_category`; +CREATE TABLE `gen_custom_page_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `parent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义页面分类' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of gen_custom_page_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_selector +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_selector`; +CREATE TABLE `gen_custom_selector` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类ID', + `custom_list_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '数据对象ID', + `dialog_tittle` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对话框标题', + `dialog_width` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '对话框宽度', + `placeholder` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '占位符', + `id_column` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ID字段', + `id_column_rela_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ID字段关联ID', + `name_column` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称ID字段', + `name_column_rela_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称ID字段关联ID', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `category_id`(`category_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义对话框' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_selector +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_custom_selector_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_selector_category`; +CREATE TABLE `gen_custom_selector_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义对话框分类' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_custom_selector_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_data_entity +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_entity`; +CREATE TABLE `gen_data_entity` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类ID', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `gen_status` tinyint(3) NOT NULL DEFAULT 1 COMMENT '状态', + `table_schema` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据表所属的数据库名', + `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据库表名', + `engine` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据库引擎', + `table_collation` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字符校验编码集', + `table_comment` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '备注', + `convert_type` tinyint(3) NOT NULL COMMENT '转换方式', + PRIMARY KEY (`id`) USING BTREE, + INDEX `category_id`(`category_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据实体' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_data_entity +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_data_entity_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_entity_category`; +CREATE TABLE `gen_data_entity_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据实体分类' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_data_entity_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_data_entity_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_entity_detail`; +CREATE TABLE `gen_data_entity_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `entity_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '实体ID', + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字段显示名称', + `column_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字段名称', + `is_key` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否主键', + `data_type` tinyint(3) NOT NULL COMMENT '数据类型', + `column_order` int(11) NOT NULL COMMENT '排序编号', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `view_type` tinyint(3) NOT NULL COMMENT '显示类型', + `data_dic_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据字典ID', + `custom_selector_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '自定义选择器ID', + `fix_enum` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否内置枚举', + `enum_back` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '后端枚举名', + `enum_front` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '前端枚举名', + `regular_expression` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '正则表达式', + `is_order` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否排序字段', + `order_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '排序类型', + `len` bigint(20) NULL DEFAULT NULL COMMENT '长度', + `decimals` int(11) NULL DEFAULT NULL COMMENT '小数位数', + `db_column_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字段名', + `db_data_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '字段数据类型', + `is_nullable` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否允许为空', + `column_default` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '默认值', + `ordinal_position` bigint(21) UNSIGNED NOT NULL DEFAULT 0 COMMENT '字段排序', + `column_comment` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '字段备注', + `db_len` bigint(20) NULL DEFAULT NULL COMMENT '长度', + `db_decimals` int(11) NULL DEFAULT NULL COMMENT '小数位数', + PRIMARY KEY (`id`) USING BTREE, + INDEX `entity_id`(`entity_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据实体明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_data_entity_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_data_obj +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj`; +CREATE TABLE `gen_data_obj` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类ID', + `main_table_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '主表ID', + `main_table_alias` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主表别名', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `category_id`(`category_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据对象' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_data_obj +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_data_obj_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj_category`; +CREATE TABLE `gen_data_obj_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据实体分类' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_data_obj_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_data_obj_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj_detail`; +CREATE TABLE `gen_data_obj_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `data_obj_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据对象ID', + `main_table_detail_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主表字段', + `rela_type` tinyint(3) NOT NULL COMMENT '关联类型', + `rela_mode` tinyint(3) NOT NULL COMMENT '关联方式', + `sub_table_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '子表ID', + `sub_table_alias` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '子表别名', + `sub_table_detail_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '子表字段', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE, + INDEX `data_obj_id`(`data_obj_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据对象明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_data_obj_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_data_obj_query_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj_query_detail`; +CREATE TABLE `gen_data_obj_query_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `data_obj_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据对象ID', + `custom_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '显示名称', + `custom_sql` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '自定义SQL', + `custom_alias` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '自定义别名', + `data_type` tinyint(3) NOT NULL COMMENT '数据类型', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE, + INDEX `data_obj_id`(`data_obj_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据对象自定义查询明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_data_obj_query_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_detail_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_detail_column_config`; +CREATE TABLE `gen_detail_column_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `span` int(11) NOT NULL COMMENT '列宽', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '详情功能代码生成配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_detail_column_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_generate_info +-- ---------------------------- +DROP TABLE IF EXISTS `gen_generate_info`; +CREATE TABLE `gen_generate_info` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `template_type` tinyint(3) NOT NULL COMMENT '生成模板类型', + `package_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '包名', + `module_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模块名', + `biz_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务名', + `class_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类名', + `parent_menu_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级菜单ID', + `key_type` tinyint(3) NOT NULL COMMENT '主键类型', + `author` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '作者', + `class_description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类描述', + `menu_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '本级菜单编号', + `menu_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '本级菜单名称', + `detail_span` int(11) NOT NULL COMMENT '详情页Span总数量', + `is_cache` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否应用缓存', + `has_delete` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否内置删除功能', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '代码生成基本信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_generate_info +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_query_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_query_column_config`; +CREATE TABLE `gen_query_column_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `width_type` tinyint(3) NOT NULL COMMENT '宽度类型', + `width` int(11) NOT NULL COMMENT '宽度', + `sortable` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否页面排序', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '查询功能代码生成配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_query_column_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_query_params_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_query_params_column_config`; +CREATE TABLE `gen_query_params_column_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `query_type` tinyint(3) NOT NULL COMMENT '查询类型', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '查询参数功能代码生成配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_query_params_column_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_simple_table +-- ---------------------------- +DROP TABLE IF EXISTS `gen_simple_table`; +CREATE TABLE `gen_simple_table` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `table_schema` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据表所属的数据库名', + `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据库表名', + `engine` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据库引擎', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `table_collation` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字符校验编码集', + `table_comment` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '备注', + `convert_type` tinyint(3) NOT NULL COMMENT '转换方式', + PRIMARY KEY (`id`) USING BTREE, + INDEX `table_schema`(`table_schema`, `table_name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据库单表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_simple_table +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_simple_table_column +-- ---------------------------- +DROP TABLE IF EXISTS `gen_simple_table_column`; +CREATE TABLE `gen_simple_table_column` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `table_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `column_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字段名', + `data_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '字段数据类型', + `is_nullable` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否允许为空', + `is_key` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否主键', + `column_default` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '默认值', + `ordinal_position` bigint(21) UNSIGNED NOT NULL DEFAULT 0 COMMENT '字段排序', + `column_comment` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '字段备注', + `len` bigint(20) NULL DEFAULT NULL COMMENT '长度', + `decimals` int(11) NULL DEFAULT NULL COMMENT '小数位数', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据库单表列信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_simple_table_column +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_update_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_update_column_config`; +CREATE TABLE `gen_update_column_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `required` tinyint(1) NOT NULL DEFAULT 0, + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '修改功能代码生成配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of gen_update_column_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for op_logs +-- ---------------------------- +DROP TABLE IF EXISTS `op_logs`; +CREATE TABLE `op_logs` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '日志名称', + `log_type` int(11) NOT NULL COMMENT '类别', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `extra` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '补充信息', + `ip` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'IP地址', + PRIMARY KEY (`id`) USING BTREE, + INDEX `create_by`(`create_by`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '操作日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of op_logs +-- ---------------------------- + +-- ---------------------------- +-- Table structure for recursion_mapping +-- ---------------------------- +DROP TABLE IF EXISTS `recursion_mapping`; +CREATE TABLE `recursion_mapping` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `node_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '节点ID', + `node_type` tinyint(3) NOT NULL COMMENT '节点类型', + `path` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '从顶点到当前结点的路径,用,分割', + `level` int(11) NOT NULL COMMENT '节点层级', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `node_id`(`node_id`, `node_type`) USING BTREE, + INDEX `node_type`(`node_type`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '树形数据节点关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of recursion_mapping +-- ---------------------------- +INSERT INTO `recursion_mapping` VALUES ('1', '2', 1, NULL, 1); +INSERT INTO `recursion_mapping` VALUES ('2', '4', 1, '2', 2); +INSERT INTO `recursion_mapping` VALUES ('3', '3', 1, '1', 2); +INSERT INTO `recursion_mapping` VALUES ('4', '1', 1, NULL, 1); + +-- ---------------------------- +-- Table structure for settle_check_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_check_sheet`; +CREATE TABLE `settle_check_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `supplier_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商ID', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `total_pay_amount` decimal(24, 2) NOT NULL COMMENT '应付金额', + `total_payed_amount` decimal(24, 2) NOT NULL COMMENT '已付金额', + `total_discount_amount` decimal(24, 2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `supplier_id`(`supplier_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商对账单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_check_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_check_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_check_sheet_detail`; +CREATE TABLE `settle_check_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '对账单ID', + `biz_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单据ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `calc_type` tinyint(3) NOT NULL COMMENT '计算类型', + `pay_amount` decimal(24, 2) NOT NULL COMMENT '应付金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `biz_id`) USING BTREE, + INDEX `biz_id`(`biz_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商对账单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_check_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_fee_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_fee_sheet`; +CREATE TABLE `settle_fee_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `supplier_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商ID', + `sheet_type` tinyint(3) NOT NULL COMMENT '单据类型', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `supplier_id`(`supplier_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商费用单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_fee_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_fee_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_fee_sheet_detail`; +CREATE TABLE `settle_fee_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '费用单ID', + `item_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目ID', + `amount` decimal(24, 2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `item_id`) USING BTREE, + INDEX `item_id`(`item_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商费用单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_fee_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_in_item +-- ---------------------------- +DROP TABLE IF EXISTS `settle_in_item`; +CREATE TABLE `settle_in_item` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '收入项目' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_in_item +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_out_item +-- ---------------------------- +DROP TABLE IF EXISTS `settle_out_item`; +CREATE TABLE `settle_out_item` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支出项目' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_out_item +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_pre_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_pre_sheet`; +CREATE TABLE `settle_pre_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `supplier_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商ID', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `supplier_id`(`supplier_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商预付款单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_pre_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_pre_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_pre_sheet_detail`; +CREATE TABLE `settle_pre_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '预付款单ID', + `item_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目ID', + `amount` decimal(24, 2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `item_id`) USING BTREE, + INDEX `item_id`(`item_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商预付款单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_pre_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_sheet`; +CREATE TABLE `settle_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `supplier_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商ID', + `total_amount` decimal(24, 2) NOT NULL COMMENT '总金额', + `total_discount_amount` decimal(24, 2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `supplier_id`(`supplier_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商结算单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for settle_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_sheet_detail`; +CREATE TABLE `settle_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '结算单ID', + `biz_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单据ID', + `pay_amount` decimal(24, 2) NOT NULL COMMENT '实付金额', + `discount_amount` decimal(24, 2) NOT NULL COMMENT '优惠金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `biz_id`) USING BTREE, + INDEX `biz_id`(`biz_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '供应商结算单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of settle_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sw_file_box +-- ---------------------------- +DROP TABLE IF EXISTS `sw_file_box`; +CREATE TABLE `sw_file_box` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `url` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'Url', + `content_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ContentType', + `file_type` tinyint(3) NOT NULL COMMENT '文件类型', + `file_size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件大小', + `file_path` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件路径', + `file_suffix` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件后缀', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文件收纳箱' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sw_file_box +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sw_online_excel +-- ---------------------------- +DROP TABLE IF EXISTS `sw_online_excel`; +CREATE TABLE `sw_online_excel` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态 1-在用 0停用', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '在线Excel' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sw_online_excel +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_data_dic +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_dic`; +CREATE TABLE `sys_data_dic` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `category_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分类ID', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + UNIQUE INDEX `name`(`name`) USING BTREE, + INDEX `category_id`(`category_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_data_dic +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_data_dic_category +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_dic_category`; +CREATE TABLE `sys_data_dic_category` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典分类' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_data_dic_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_data_dic_item +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_dic_item`; +CREATE TABLE `sys_data_dic_item` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `dic_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典ID', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `dic_id`(`dic_id`, `code`) USING BTREE, + UNIQUE INDEX `dic_id_2`(`dic_id`, `name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据字典' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_data_dic_item +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_data_permission_data +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_permission_data`; +CREATE TABLE `sys_data_permission_data` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `biz_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `permission_type` tinyint(3) NOT NULL COMMENT '权限类型', + `permission` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据权限', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `biz_id`(`biz_id`, `biz_type`, `permission_type`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据权限数据' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_data_permission_data +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_data_permission_model_detail +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_permission_model_detail`; +CREATE TABLE `sys_data_permission_model_detail` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `model_id` int(11) NOT NULL COMMENT '模型ID', + `condition_type` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '条件', + `input_type` tinyint(3) NOT NULL COMMENT '输入类型', + `table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '表名', + `column_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字段名', + `enum_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '前端枚举名', + `sql_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'SQL', + PRIMARY KEY (`id`) USING BTREE, + INDEX `model_id`(`model_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据权限模型明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_data_permission_model_detail +-- ---------------------------- +INSERT INTO `sys_data_permission_model_detail` VALUES (1, '编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (2, '名称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (3, '简称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'short_name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (4, 'SKU', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'sku_code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (5, '外部编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'external_code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (6, '品类编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'category', 'code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (7, '品类名称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'category', 'name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (8, '品牌编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'brand', 'code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (9, '品牌名称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'brand', 'name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (10, '规格', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'spec', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (11, '单位', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'unit', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (12, '状态', 1, '0,5,6,7', 1, 'product', 'available', 'AVAILABLE', NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (13, '创建时间', 1, '0,1,2,3,4,5', 2, 'product', 'create_time', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (14, '创建人部门与本人相同', 2, '6', 99, 'order', 'create_by_id', NULL, 'SELECT __ud.user_id FROM sys_user_dept AS __ud WHERE __ud.dept_id IN ({__var#curDeptIds})'); +INSERT INTO `sys_data_permission_model_detail` VALUES (15, '创建人部门是本人的上级部门', 2, '6', 99, 'order', 'create_by_id', NULL, 'SELECT DISTINCT __ud.user_id FROM sys_user_dept AS __ud WHERE FIND_IN_SET(__ud.dept_id,(SELECT GROUP_CONCAT(__mp.path) FROM sys_dept AS __d INNER JOIN recursion_mapping AS __mp ON __mp.node_id=__d.id AND __mp.node_type=1 WHERE __d.id IN ({__var#curDeptIds}) AND __mp.level> 1))'); +INSERT INTO `sys_data_permission_model_detail` VALUES (16, '创建人部门是本人的下级部门', 2, '6', 99, 'order', 'create_by_id', NULL, 'SELECT DISTINCT __ud.user_id FROM sys_user_dept AS __ud WHERE __ud.dept_id IN (SELECT __mp.node_id FROM recursion_mapping AS __mp WHERE FIND_IN_SET((SELECT __d.id FROM sys_dept AS __d WHERE __d.id IN ({__var#curDeptIds})),__mp.path) AND __mp.node_type=1)'); +INSERT INTO `sys_data_permission_model_detail` VALUES (17, '创建时间', 2, '0,1,2,3,4,5', 2, 'order', 'create_time', NULL, NULL); + +-- ---------------------------- +-- Table structure for sys_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dept`; +CREATE TABLE `sys_dept` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `short_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '简称', + `parent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级ID', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + UNIQUE INDEX `name`(`name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '部门' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_dept +-- ---------------------------- +INSERT INTO `sys_dept` VALUES ('1', '001', '销售中心', '销售中心', NULL, 1, '', '系统管理员', '1', '2022-01-13 00:37:06', '系统管理员', '1', '2022-01-13 00:37:06'); +INSERT INTO `sys_dept` VALUES ('2', '002', '研发中心', '研发中心', NULL, 1, '', '系统管理员', '1', '2022-01-13 00:37:17', '系统管理员', '1', '2022-01-13 00:37:17'); +INSERT INTO `sys_dept` VALUES ('3', '001001', '销售部', '销售部', '1', 1, '', '系统管理员', '1', '2022-01-13 00:38:03', '系统管理员', '1', '2022-01-13 00:38:03'); +INSERT INTO `sys_dept` VALUES ('4', '002001', '研发部', '研发部', '2', 1, '', '系统管理员', '1', '2022-01-13 00:38:15', '系统管理员', '1', '2022-01-13 00:38:15'); + +-- ---------------------------- +-- Table structure for sys_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu`; +CREATE TABLE `sys_menu` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称(前端使用)', + `title` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `icon` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标', + `component_type` tinyint(3) NULL DEFAULT NULL COMMENT '组件类型(前端使用)', + `component` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件(前端使用)', + `request_param` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '自定义请求参数', + `parent_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级ID', + `sys_module_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '系统模块ID', + `path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由路径(前端使用)', + `no_cache` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否缓存(前端使用)', + `display` tinyint(3) NOT NULL COMMENT '类型 0-目录 1-菜单 2-功能', + `hidden` tinyint(1) NULL DEFAULT 0 COMMENT '是否隐藏(前端使用)', + `permission` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限', + `is_special` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否特殊菜单', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `code`(`code`, `name`, `title`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '菜单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_menu +-- ---------------------------- +INSERT INTO `sys_menu` VALUES ('1000', '1000', 'System', '系统管理', 'ant-design:setting-outlined', NULL, '', NULL, NULL, '2', '/system', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2023-10-27 17:01:09'); +INSERT INTO `sys_menu` VALUES ('1000001', '1000001', 'Menu', '菜单管理', NULL, 0, '/system/menu/index', NULL, '1000', '2', '/menu', 0, 1, 0, 'system:menu:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2023-10-27 17:01:09'); +INSERT INTO `sys_menu` VALUES ('1000001001', '1000001001', '', '新增菜单', NULL, 0, '', NULL, '1000001', '2', '', 0, 2, 0, 'system:menu:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2023-10-27 17:01:09'); +INSERT INTO `sys_menu` VALUES ('1000001002', '1000001002', '', '修改菜单', NULL, 0, '', NULL, '1000001', '2', '', 0, 2, 0, 'system:menu:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2023-10-27 17:00:27'); +INSERT INTO `sys_menu` VALUES ('1000001003', '1000001003', '', '删除菜单', NULL, 0, '', NULL, '1000001', '2', '', 0, 2, 0, 'system:menu:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2023-10-27 17:00:27'); +INSERT INTO `sys_menu` VALUES ('1000002', '1000002', 'Dept', '部门管理', NULL, 0, '/system/dept/index', NULL, '1000', '2', '/dept', 0, 1, 0, 'system:dept:query', 1, 1, '', '系统管理员', '1', '2021-07-05 01:09:27', '系统管理员', '1', '2023-10-27 17:00:27'); +INSERT INTO `sys_menu` VALUES ('1000002001', '1000002001', '', '新增部门', NULL, 0, '', NULL, '1000002', '2', '', 0, 2, 0, 'system:dept:add', 1, 1, '', '系统管理员', '1', '2021-06-27 01:33:31', '系统管理员', '1', '2023-10-27 17:00:27'); +INSERT INTO `sys_menu` VALUES ('1000002002', '1000002002', '', '修改部门', NULL, 0, '', NULL, '1000002', '2', '', 0, 2, 0, 'system:dept:modify', 1, 1, '', '系统管理员', '1', '2021-06-27 01:33:47', '系统管理员', '1', '2023-10-27 17:00:27'); +INSERT INTO `sys_menu` VALUES ('1000002003', '1000002003', '', '部门权限', NULL, 0, '', NULL, '1000002', '2', '', 0, 2, 0, 'system:dept:permission', 1, 1, '', '系统管理员', '1', '2021-06-27 01:33:47', '系统管理员', '1', '2023-10-27 17:00:27'); +INSERT INTO `sys_menu` VALUES ('1000003', '1000003', 'Position', '岗位管理', NULL, 0, '/system/position/index', NULL, '1000', '2', '/position', 0, 1, 0, 'system:position:query', 1, 1, '', '系统管理员', '1', '2021-07-01 23:26:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000003001', '1000003001', '', '新增岗位', NULL, 0, '', NULL, '1000003', '2', '', 0, 2, 0, 'system:position:add', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000003002', '1000003002', '', '修改岗位', NULL, 0, '', NULL, '1000003', '2', '', 0, 2, 0, 'system:position:modify', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000004', '1000004', 'Role', '角色管理', NULL, 0, '/system/role/index', NULL, '1000', '2', '/role', 0, 1, 0, 'system:role:query', 1, 1, '', '系统管理员', '1', '2021-07-04 00:35:49', '系统管理员', '1', '2021-07-04 00:35:49'); +INSERT INTO `sys_menu` VALUES ('1000004001', '1000004001', '', '新增角色', NULL, 0, '', NULL, '1000004', '2', '', 0, 2, 0, 'system:role:add', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000004002', '1000004002', '', '修改角色', NULL, 0, '', NULL, '1000004', '2', '', 0, 2, 0, 'system:role:modify', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000004003', '1000004003', '', '角色授权', NULL, 0, '', NULL, '1000004', '2', '', 0, 2, 0, 'system:role:permission', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000005', '1000005', 'User', '用户管理', NULL, 0, '/system/user/index', NULL, '1000', '2', '/user', 0, 1, 0, 'system:user:query', 1, 1, '', '系统管理员', '1', '2021-07-05 01:08:40', '系统管理员', '1', '2021-07-05 01:08:40'); +INSERT INTO `sys_menu` VALUES ('1000005001', '1000005001', '', '新增用户', NULL, 0, '', NULL, '1000005', '2', '', 0, 2, 0, 'system:user:add', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000005002', '1000005002', '', '修改用户', NULL, 0, '', NULL, '1000005', '2', '', 0, 2, 0, 'system:user:modify', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000005003', '1000005003', '', '用户授权', NULL, 0, '', NULL, '1000005', '2', '', 0, 2, 0, 'system:user:permission', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000006', '1000006', 'Oplog', '操作日志', NULL, 0, '/system/oplog/index', NULL, '1000', '2', '/oplog', 0, 1, 0, 'system:oplog:query', 1, 1, '', '系统管理员', '1', '2021-07-05 01:08:40', '系统管理员', '1', '2021-07-05 01:08:40'); +INSERT INTO `sys_menu` VALUES ('1000007', '1000007', 'SysParameter', '系统参数', NULL, 0, '/system/parameter/index', NULL, '1000', '2', '/parameter', 0, 1, 0, 'system:parameter:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000007001', '1000007001', '', '新增系统参数', NULL, 0, '', NULL, '1000007', '2', '', 0, 2, 0, 'system:parameter:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000007002', '1000007002', '', '修改系统参数', NULL, 0, '', NULL, '1000007', '2', '', 0, 2, 0, 'system:parameter:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000007003', '1000007003', '', '删除系统参数', NULL, 0, '', NULL, '1000007', '2', '', 0, 2, 0, 'system:parameter:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000008', '1000008', 'PublishSysNotice', '发布系统通知', NULL, 0, '/system/notice/publish', NULL, '1000', '2', '/system/notice/publish', 0, 1, 0, 'system:notice:publish', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000008001', '1000008001', '', '新增系统通知', NULL, 0, '', NULL, '1000008', '2', '', 0, 2, 0, 'system:notice:add', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000008002', '1000008002', '', '修改系统通知', NULL, 0, '', NULL, '1000008', '2', '', 0, 2, 0, 'system:notice:modify', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000009', '1000009', 'SysNotice', '系统通知', NULL, 0, '/system/notice/index', NULL, '1000', '2', '/system/notice', 0, 1, 0, 'system:notice:query', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000010', '1000010', 'SysDataDic', '数据字典', NULL, 0, '/system/dic/index', NULL, '1000', '2', '/dic', 0, 1, 0, 'system:dic:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010001', '1000010001', '', '新增数据字典', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010002', '1000010002', '', '修改数据字典', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010003', '1000010003', '', '删除数据字典', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1000010004', '1000010004', '', '新增数据字典分类', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic-category:add', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010005', '1000010005', '', '修改数据字典分类', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic-category:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010006', '1000010006', '', '删除数据字典分类', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic-category:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010007', '1000010007', '', '新增数据字典值', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010008', '1000010008', '', '修改数据字典值', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000010009', '1000010009', '', '删除数据字典值', NULL, 0, '', NULL, '1000010', '2', '', 0, 2, 0, 'system:dic-item:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1000011', '1000011', 'SysTenant', '租户管理', NULL, 0, '/system/tenant/index', NULL, '1001', '1', '/system/tenant', 0, 1, 0, 'system:tenant:query', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000011001', '1000011001', '', '新增租户', NULL, 0, '', NULL, '1000011', '1', '', 0, 2, 0, 'system:tenant:add', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000011002', '1000011002', '', '修改租户', NULL, 0, '', NULL, '1000011', '1', '', 0, 2, 0, 'system:tenant:modify', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000011003', '1000011003', '', '授权模块', NULL, 0, '', NULL, '1000011', '1', '', 0, 2, 0, 'system:tenant:module', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` VALUES ('1000012', '1000012', 'OpenDomain', '开放域', NULL, 0, '/system/open-domain/index', NULL, '1001', '14', '/open-domain', 0, 1, 0, 'system:open-domain:config', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('1001', '1001', 'Platform', '平台管理', 'ant-design:global-outlined', NULL, '', NULL, NULL, '1', '/platform', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('1001001', '1001001', 'OnelineCode', '在线开发', NULL, 0, '/iframes/index', NULL, '1001', '1', '/online-code?src=${magic-api.base-url}${magic-api.web}/index.html', 0, 1, 0, 'system:online-code:config', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('2000', '2000', 'BaseData', '基础信息管理', 'ant-design:container-outlined', NULL, '', NULL, NULL, '3', '/base-data', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('2000002', '2000002', 'StoreCenterInfo', '仓库信息', NULL, 0, '/base-data/store-center/index', NULL, '2000', '3', '/store-center', 0, 1, 0, 'base-data:store-center:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000002001', '2000002001', '', '新增仓库', NULL, 0, '', NULL, '2000002', '3', '', 0, 2, 0, 'base-data:store-center:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000002002', '2000002002', '', '修改仓库', NULL, 0, '', NULL, '2000002', '3', '', 0, 2, 0, 'base-data:store-center:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000002003', '2000002003', '', '导入仓库', NULL, 0, '', NULL, '2000002', '3', '', 0, 2, 0, 'base-data:store-center:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000004', '2000004', 'Customer', '客户信息', NULL, 0, '/base-data/customer/index', NULL, '2000', '3', '/customer', 0, 1, 0, 'base-data:customer:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000004001', '2000004001', '', '新增客户', NULL, 0, '', NULL, '2000004', '3', '', 0, 2, 0, 'base-data:customer:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000004002', '2000004002', '', '修改客户', NULL, 0, '', NULL, '2000004', '3', '', 0, 2, 0, 'base-data:customer:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000004003', '2000004003', '', '导入客户', NULL, 0, '', NULL, '2000004', '3', '', 0, 2, 0, 'base-data:customer:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000005', '2000005', 'Supplier', '供应商信息', NULL, 0, '/base-data/supplier/index', NULL, '2000', '3', '/supplier', 0, 1, 0, 'base-data:supplier:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000005001', '2000005001', '', '新增供应商', NULL, 0, '', NULL, '2000005', '3', '', 0, 2, 0, 'base-data:supplier:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000005002', '2000005002', '', '修改供应商', NULL, 0, '', NULL, '2000005', '3', '', 0, 2, 0, 'base-data:supplier:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000005003', '2000005003', '', '导入供应商', NULL, 0, '', NULL, '2000005', '3', '', 0, 2, 0, 'base-data:supplier:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000006', '2000006', 'Member', '会员信息', NULL, 0, '/base-data/member/index', NULL, '2000', '3', '/member', 0, 1, 0, 'base-data:member:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000006001', '2000006001', '', '新增会员', NULL, 0, '', NULL, '2000006', '3', '', 0, 2, 0, 'base-data:member:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000006002', '2000006002', '', '修改会员', NULL, 0, '', NULL, '2000006', '3', '', 0, 2, 0, 'base-data:member:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000006003', '2000006003', '', '导入会员', NULL, 0, '', NULL, '2000006', '3', '', 0, 2, 0, 'base-data:member:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000007', '2000007', 'Shop', '门店信息', NULL, 0, '/base-data/shop/index', NULL, '2000', '3', '/shop', 0, 1, 0, 'base-data:shop:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000007001', '2000007001', '', '新增门店', NULL, 0, '', NULL, '2000007', '3', '', 0, 2, 0, 'base-data:shop:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000007002', '2000007002', '', '修改门店', NULL, 0, '', NULL, '2000007', '3', '', 0, 2, 0, 'base-data:shop:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000007003', '2000007003', '', '导入门店', NULL, 0, '', NULL, '2000007', '3', '', 0, 2, 0, 'base-data:shop:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000008', '2000008', 'PayType', '支付方式', NULL, 0, '/base-data/pay-type/index', NULL, '2000', '3', '/pay-type', 0, 1, 0, 'base-data:pay-type:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000008001', '2000008001', '', '新增支付方式', NULL, 0, '', NULL, '2000008', '3', '', 0, 2, 0, 'base-data:pay-type:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000008002', '2000008002', '', '修改支付方式', NULL, 0, '', NULL, '2000008', '3', '', 0, 2, 0, 'base-data:pay-type:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000009', '2000009', 'Address', '地址库', NULL, 0, '/base-data/address/index', NULL, '2000', '15', '/address', 0, 1, 0, 'base-data:address:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000009001', '2000009001', '', '新增地址', NULL, 0, '', NULL, '2000009', '15', '', 0, 2, 0, 'base-data:address:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000009002', '2000009002', '', '修改地址', NULL, 0, '', NULL, '2000009', '15', '', 0, 2, 0, 'base-data:address:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000009003', '2000009003', '', '导出地址', NULL, 0, '', NULL, '2000009', '15', '', 0, 2, 0, 'base-data:address:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000009004', '2000009004', '', '导入地址', NULL, 0, '', NULL, '2000009', '15', '', 0, 2, 0, 'base-data:address:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000010', '2000010', 'LogisticsCompany', '物流公司', NULL, 0, '/base-data/logistics/company/index', NULL, '2000', '15', '/logistics/company', 0, 1, 0, 'base-data:logistics-company:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2000010001', '2000010001', '', '新增物流公司', NULL, 0, '', NULL, '2000010', '15', '', 0, 2, 0, 'base-data:logistics-company:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2000010002', '2000010002', '', '修改物流公司', NULL, 0, '', NULL, '2000010', '15', '', 0, 2, 0, 'base-data:logistics-company:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001', '2001', 'Product', '商品中心', 'ant-design:appstore-outlined', NULL, '', NULL, NULL, '4', '/product', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('2001001', '2001001', 'ProductCategory', '商品类目', NULL, 0, '/base-data/product/category/index', NULL, '2001', '4', '/category', 0, 1, 0, 'base-data:product:category:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2001001001', '2001001001', '', '新增类目', NULL, 0, '', NULL, '2001001', '4', '', 0, 2, 0, 'base-data:product:category:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001001002', '2001001002', '', '修改类目', NULL, 0, '', NULL, '2001001', '4', '', 0, 2, 0, 'base-data:product:category:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001001003', '2001001003', '', '导入类目', NULL, 0, '', NULL, '2001001', '4', '', 0, 2, 0, 'base-data:product:category:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001002', '2001002', 'ProductBrand', '商品品牌', NULL, 0, '/base-data/product/brand/index', NULL, '2001', '4', '/brand', 0, 1, 0, 'base-data:product:brand:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` VALUES ('2001002001', '2001002001', '', '新增品牌', NULL, 0, '', NULL, '2001002', '4', '', 0, 2, 0, 'base-data:product:brand:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001002002', '2001002002', '', '修改品牌', NULL, 0, '', NULL, '2001002', '4', '', 0, 2, 0, 'base-data:product:brand:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001002003', '2001002003', '', '导入品牌', NULL, 0, '', NULL, '2001002', '4', '', 0, 2, 0, 'base-data:product:brand:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001004', '2001004', 'ProductProperty', '商品属性', NULL, 0, '/base-data/product/property/index', NULL, '2001', '4', '/property', 0, 1, 0, 'base-data:product:property:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` VALUES ('2001004001', '2001004001', '', '新增属性', NULL, 0, '', NULL, '2001004', '4', '', 0, 2, 0, 'base-data:product:property:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001004002', '2001004002', '', '修改属性', NULL, 0, '', NULL, '2001004', '4', '', 0, 2, 0, 'base-data:product:property:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001004003', '2001004003', '', '查询属性值', NULL, 0, '', NULL, '2001004', '4', '', 0, 2, 0, 'base-data:product:property-item:query', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001004004', '2001004004', '', '新增属性值', NULL, 0, '', NULL, '2001004', '4', '', 0, 2, 0, 'base-data:product:property-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001004005', '2001004005', '', '修改属性值', NULL, 0, '', NULL, '2001004', '4', '', 0, 2, 0, 'base-data:product:property-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001005', '2001005', 'ProductInfo', '商品管理', NULL, 0, '/base-data/product/info/index', NULL, '2001', '4', '/info', 0, 1, 0, 'base-data:product:info:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` VALUES ('2001005001', '2001005001', '', '新增商品', NULL, 0, '', NULL, '2001005', '4', '', 0, 2, 0, 'base-data:product:info:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001005002', '2001005002', '', '修改商品', NULL, 0, '', NULL, '2001005', '4', '', 0, 2, 0, 'base-data:product:info:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2001005003', '2001005003', '', '导入商品', NULL, 0, '', NULL, '2001005', '4', '', 0, 2, 0, 'base-data:product:info:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002', '2002', 'Purchase', '采购管理', 'ant-design:money-collect-outlined', NULL, '', NULL, NULL, '5', '/purchase', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('2002001', '2002001', 'PurchaseConfig', '采购参数设置', NULL, 0, '/sc/purchase/config/index', NULL, '2002', '5', '/config', 1, 1, 0, 'purchase:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2002002', '2002002', 'PurchaseOrder', '采购订单管理', NULL, 0, '/sc/purchase/order/index', NULL, '2002', '5', '/order', 0, 1, 0, 'purchase:order:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2002002001', '2002002001', '', '新增采购订单', NULL, 0, '', NULL, '2002002', '5', '', 0, 2, 0, 'purchase:order:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002002002', '2002002002', '', '修改采购订单', NULL, 0, '', NULL, '2002002', '5', '', 0, 2, 0, 'purchase:order:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002002003', '2002002003', '', '删除采购订单', NULL, 0, '', NULL, '2002002', '5', '', 0, 2, 0, 'purchase:order:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002002004', '2002002004', '', '审核采购订单', NULL, 0, '', NULL, '2002002', '5', '', 0, 2, 0, 'purchase:order:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002002005', '2002002005', '', '导出采购订单', NULL, 0, '', NULL, '2002002', '5', '', 0, 2, 0, 'purchase:order:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002002006', '2002002006', '', '导入采购订单', NULL, 0, '', NULL, '2002002', '5', '', 0, 2, 0, 'purchase:order:import', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002003', '2002003', 'ReceiveSheet', '采购收货管理', NULL, 0, '/sc/purchase/receive/index', NULL, '2002', '5', '/receive', 0, 1, 0, 'purchase:receive:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2002003001', '2002003001', '', '新增采购收货单', NULL, 0, '', NULL, '2002003', '5', '', 0, 2, 0, 'purchase:receive:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002003002', '2002003002', '', '修改采购收货单', NULL, 0, '', NULL, '2002003', '5', '', 0, 2, 0, 'purchase:receive:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002003003', '2002003003', '', '删除采购收货单', NULL, 0, '', NULL, '2002003', '5', '', 0, 2, 0, 'purchase:receive:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002003004', '2002003004', '', '审核采购收货单', NULL, 0, '', NULL, '2002003', '5', '', 0, 2, 0, 'purchase:receive:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002003005', '2002003005', '', '导出采购收货单', NULL, 0, '', NULL, '2002003', '5', '', 0, 2, 0, 'purchase:receive:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002003006', '2002003006', '', '导入采购收货单', NULL, 0, '', NULL, '2002003', '5', '', 0, 2, 0, 'purchase:receive:import', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002004', '2002004', 'PurchaseReturn', '采购退货管理', NULL, 0, '/sc/purchase/return/index', NULL, '2002', '5', '/return', 0, 1, 0, 'purchase:return:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2002004001', '2002004001', '', '新增采购退货单', NULL, 0, '', NULL, '2002004', '5', '', 0, 2, 0, 'purchase:return:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002004002', '2002004002', '', '修改采购退货单', NULL, 0, '', NULL, '2002004', '5', '', 0, 2, 0, 'purchase:return:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002004003', '2002004003', '', '删除采购退货单', NULL, 0, '', NULL, '2002004', '5', '', 0, 2, 0, 'purchase:return:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002004004', '2002004004', '', '审核采购退货单', NULL, 0, '', NULL, '2002004', '5', '', 0, 2, 0, 'purchase:return:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2002004005', '2002004005', '', '导出采购退货单', NULL, 0, '', NULL, '2002004', '5', '', 0, 2, 0, 'purchase:return:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003', '2003', 'Sale', '销售管理', 'ant-design:rocket-outlined', NULL, '', NULL, NULL, '6', '/sale', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('2003001', '2003001', 'SaleConfig', '销售参数设置', NULL, 0, '/sc/sale/config/index', NULL, '2003', '6', '/config', 1, 1, 0, 'sale:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2003002', '2003002', 'SaleOrder', '销售订单管理', NULL, 0, '/sc/sale/order/index', NULL, '2003', '6', '/order', 0, 1, 0, 'sale:order:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2003002001', '2003002001', '', '新增销售订单', NULL, 0, '', NULL, '2003002', '6', '', 0, 2, 0, 'sale:order:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003002002', '2003002002', '', '修改销售订单', NULL, 0, '', NULL, '2003002', '6', '', 0, 2, 0, 'sale:order:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003002003', '2003002003', '', '删除销售订单', NULL, 0, '', NULL, '2003002', '6', '', 0, 2, 0, 'sale:order:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003002004', '2003002004', '', '审核销售订单', NULL, 0, '', NULL, '2003002', '6', '', 0, 2, 0, 'sale:order:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003002005', '2003002005', '', '导出销售订单', NULL, 0, '', NULL, '2003002', '6', '', 0, 2, 0, 'sale:order:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003003', '2003003', 'SaleOutSheet', '销售出库管理', NULL, 0, '/sc/sale/out/index', NULL, '2003', '6', '/out', 0, 1, 0, 'sale:out:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2003003001', '2003003001', '', '新增销售出库单', NULL, 0, '', NULL, '2003003', '6', '', 0, 2, 0, 'sale:out:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003003002', '2003003002', '', '修改销售出库单', NULL, 0, '', NULL, '2003003', '6', '', 0, 2, 0, 'sale:out:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003003003', '2003003003', '', '删除销售出库单', NULL, 0, '', NULL, '2003003', '6', '', 0, 2, 0, 'sale:out:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003003004', '2003003004', '', '审核销售出库单', NULL, 0, '', NULL, '2003003', '6', '', 0, 2, 0, 'sale:out:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003003005', '2003003005', '', '导出销售出库单', NULL, 0, '', NULL, '2003003', '6', '', 0, 2, 0, 'sale:out:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003004', '2003004', 'SaleReturn', '销售退货管理', NULL, 0, '/sc/sale/return/index', NULL, '2003', '6', '/return', 0, 1, 0, 'sale:return:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2003004001', '2003004001', '', '新增销售退货单', NULL, 0, '', NULL, '2003004', '6', '', 0, 2, 0, 'sale:return:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003004002', '2003004002', '', '修改销售退货单', NULL, 0, '', NULL, '2003004', '6', '', 0, 2, 0, 'sale:return:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003004003', '2003004003', '', '删除销售退货单', NULL, 0, '', NULL, '2003004', '6', '', 0, 2, 0, 'sale:return:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003004004', '2003004004', '', '审核销售退货单', NULL, 0, '', NULL, '2003004', '6', '', 0, 2, 0, 'sale:return:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2003004005', '2003004005', '', '导出销售退货单', NULL, 0, '', NULL, '2003004', '6', '', 0, 2, 0, 'sale:return:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004', '2004', 'Retail', '零售管理', 'ant-design:flag-outlined', NULL, '', NULL, NULL, '7', '/retail', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('2004001', '2004001', 'RetailConfig', '零售参数设置', NULL, 0, '/sc/retail/config/index', NULL, '2004', '7', '/config', 1, 1, 0, 'retail:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2004002', '2004002', 'RetailOutSheet', '零售出库管理', NULL, 0, '/sc/retail/out/index', NULL, '2004', '7', '/out', 0, 1, 0, 'retail:out:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2004002001', '2004002001', '', '新增零售出库单', NULL, 0, '', NULL, '2004002', '7', '', 0, 2, 0, 'retail:out:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004002002', '2004002002', '', '修改零售出库单', NULL, 0, '', NULL, '2004002', '7', '', 0, 2, 0, 'retail:out:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004002003', '2004002003', '', '删除零售出库单', NULL, 0, '', NULL, '2004002', '7', '', 0, 2, 0, 'retail:out:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004002004', '2004002004', '', '审核零售出库单', NULL, 0, '', NULL, '2004002', '7', '', 0, 2, 0, 'retail:out:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004002005', '2004002005', '', '导出零售出库单', NULL, 0, '', NULL, '2004002', '7', '', 0, 2, 0, 'retail:out:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004003', '2004003', 'RetailReturn', '零售退货管理', NULL, 0, '/sc/retail/return/index', NULL, '2004', '7', '/return', 0, 1, 0, 'retail:return:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('2004003001', '2004003001', '', '新增零售退货单', NULL, 0, '', NULL, '2004003', '7', '', 0, 2, 0, 'retail:return:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004003002', '2004003002', '', '修改零售退货单', NULL, 0, '', NULL, '2004003', '7', '', 0, 2, 0, 'retail:return:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004003003', '2004003003', '', '删除零售退货单', NULL, 0, '', NULL, '2004003', '7', '', 0, 2, 0, 'retail:return:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004003004', '2004003004', '', '审核零售退货单', NULL, 0, '', NULL, '2004003', '7', '', 0, 2, 0, 'retail:return:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('2004003005', '2004003005', '', '导出零售退货单', NULL, 0, '', NULL, '2004003', '7', '', 0, 2, 0, 'retail:return:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000', '3000', 'StockManage', '库存管理', 'ant-design:hdd-outlined', NULL, '', NULL, NULL, '8', '/stock', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('3000001', '3000001', 'ProductStock', '商品库存', NULL, 0, '/sc/stock/product/index', NULL, '3000', '8', '/product', 0, 1, 0, 'stock:product:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000001001', '3000001001', '', '导出商品库存', NULL, 0, '', NULL, '3000001', '8', '', 0, 2, 0, 'stock:product:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000003', '3000003', 'ProductStockLog', '商品库存变动记录', NULL, 0, '/sc/stock/product-log/index', NULL, '3000', '8', '/product/log', 0, 1, 0, 'stock:product-log:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000003001', '3000003001', '', '导出商品库存变动记录', NULL, 0, '', NULL, '3000003', '8', '', 0, 2, 0, 'stock:product-log:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004', '3000004', 'TakeStock', '库存盘点', 'ant-design:monitor-outlined', NULL, '', NULL, NULL, '9', '/take', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('3000004001', '3000004001', 'TakeStockConfig', '盘点参数设置', NULL, 0, '/sc/stock/take/config/index', NULL, '3000004', '9', '/config', 1, 1, 0, 'stock:take:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000004002', '3000004002', 'PreTakeStockSheet', '预先盘点单管理', NULL, 0, '/sc/stock/take/pre/index', NULL, '3000004', '9', '/pre', 0, 1, 0, 'stock:take:pre:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000004002001', '3000004002001', '', '新增预先盘点单', NULL, 0, '', NULL, '3000004002', '9', '', 0, 2, 0, 'stock:take:pre:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004002002', '3000004002002', '', '修改预先盘点单', NULL, 0, '', NULL, '3000004002', '9', '', 0, 2, 0, 'stock:take:pre:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004002003', '3000004002003', '', '删除预先盘点单', NULL, 0, '', NULL, '3000004002', '9', '', 0, 2, 0, 'stock:take:pre:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004002004', '3000004002004', '', '导出预先盘点单', NULL, 0, '', NULL, '3000004002', '9', '', 0, 2, 0, 'stock:take:pre:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004003', '3000004003', 'TakeStockPlan', '盘点任务管理', NULL, 0, '/sc/stock/take/plan/index', NULL, '3000004', '9', '/plan', 0, 1, 0, 'stock:take:plan:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000004003001', '3000004003001', '', '新增盘点任务', NULL, 0, '', NULL, '3000004003', '9', '', 0, 2, 0, 'stock:take:plan:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004003002', '3000004003002', '', '修改盘点任务', NULL, 0, '', NULL, '3000004003', '9', '', 0, 2, 0, 'stock:take:plan:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004003003', '3000004003003', '', '删除盘点任务', NULL, 0, '', NULL, '3000004003', '9', '', 0, 2, 0, 'stock:take:plan:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004003004', '3000004003004', '', '导出盘点任务', NULL, 0, '', NULL, '3000004003', '9', '', 0, 2, 0, 'stock:take:plan:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004003005', '3000004003005', '', '差异生成', NULL, 0, '', NULL, '3000004003', '9', '', 0, 2, 0, 'stock:take:plan:create-diff', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004003006', '3000004003006', '', '差异处理', NULL, 0, '', NULL, '3000004003', '9', '', 0, 2, 0, 'stock:take:plan:handle-diff', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004003007', '3000004003007', '', '作废盘点任务', NULL, 0, '', NULL, '3000004003', '9', '', 0, 2, 0, 'stock:take:plan:cancel', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004004', '3000004004', 'TakeStockSheet', '盘点单管理', NULL, 0, '/sc/stock/take/sheet/index', NULL, '3000004', '9', '/sheet', 0, 1, 0, 'stock:take:sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000004004001', '3000004004001', '', '新增盘点单', NULL, 0, '', NULL, '3000004004', '9', '', 0, 2, 0, 'stock:take:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004004002', '3000004004002', '', '修改盘点单', NULL, 0, '', NULL, '3000004004', '9', '', 0, 2, 0, 'stock:take:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004004003', '3000004004003', '', '删除盘点单', NULL, 0, '', NULL, '3000004004', '9', '', 0, 2, 0, 'stock:take:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004004004', '3000004004004', '', '导出盘点单', NULL, 0, '', NULL, '3000004004', '9', '', 0, 2, 0, 'stock:take:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004004005', '3000004004005', '', '审核盘点单', NULL, 0, '', NULL, '3000004004', '9', '', 0, 2, 0, 'stock:take:sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000004004006', '3000004004006', '', '取消审核盘点单', NULL, 0, '', NULL, '3000004004', '9', '', 0, 2, 0, 'stock:take:sheet:cancel-approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005', '3000005', 'StockAdjust', '库存调整', 'ant-design:thunderbolt-outlined', NULL, '', NULL, NULL, '10', '/take-adjust', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('3000005001', '3000005001', 'StockCostAdjustSheet', '库存成本调整', NULL, 0, '/sc/stock/adjust/cost/index', NULL, '3000005', '10', '/cost', 0, 1, 0, 'stock:adjust:cost:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000005001001', '3000005001001', '', '新增库存成本调整单', NULL, 0, '', NULL, '3000005001', '10', '', 0, 2, 0, 'stock:adjust:cost:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005001002', '3000005001002', '', '修改库存成本调整单', NULL, 0, '', NULL, '3000005001', '10', '', 0, 2, 0, 'stock:adjust:cost:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005001003', '3000005001003', '', '删除库存成本调整单', NULL, 0, '', NULL, '3000005001', '10', '', 0, 2, 0, 'stock:adjust:cost:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005001004', '3000005001004', '', '导出库存成本调整单', NULL, 0, '', NULL, '3000005001', '10', '', 0, 2, 0, 'stock:adjust:cost:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005001005', '3000005001005', '', '审核库存成本调整单', NULL, 0, '', NULL, '3000005001', '10', '', 0, 2, 0, 'stock:adjust:cost:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005002', '3000005002', 'StockAdjustReason', '库存调整原因', NULL, 0, '/sc/stock/adjust/stock/reason/index', NULL, '3000005', '10', '/stock/reason', 0, 1, 0, 'stock:adjust:reason:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000005002001', '3000005002001', '', '新增库存成本调整单', NULL, 0, '', NULL, '3000005002', '10', '', 0, 2, 0, 'stock:adjust:reason:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005002002', '3000005002002', '', '修改库存成本调整单', NULL, 0, '', NULL, '3000005002', '10', '', 0, 2, 0, 'stock:adjust:reason:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005003', '3000005003', 'StockAdjustSheet', '库存数量调整', NULL, 0, '/sc/stock/adjust/stock/index', NULL, '3000005', '10', '/stock', 0, 1, 0, 'stock:adjust:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000005003001', '3000005003001', '', '新增库存调整单', NULL, 0, '', NULL, '3000005003', '10', '', 0, 2, 0, 'stock:adjust:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005003002', '3000005003002', '', '修改库存调整单', NULL, 0, '', NULL, '3000005003', '10', '', 0, 2, 0, 'stock:adjust:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005003003', '3000005003003', '', '删除库存调整单', NULL, 0, '', NULL, '3000005003', '10', '', 0, 2, 0, 'stock:adjust:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005003004', '3000005003004', '', '导出库存调整单', NULL, 0, '', NULL, '3000005003', '10', '', 0, 2, 0, 'stock:adjust:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000005003005', '3000005003005', '', '审核库存调整单', NULL, 0, '', NULL, '3000005003', '10', '', 0, 2, 0, 'stock:adjust:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000006', '3000006', 'ScTransferOrder', '仓库调拨', NULL, 0, '/sc/stock/transfer/index', NULL, '3000', '8', '/transfer', 0, 1, 0, 'stock:sc-transfer:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('3000006001', '3000006001', '', '新增仓库调拨单', NULL, 0, '', NULL, '3000006', '8', '', 0, 2, 0, 'stock:sc-transfer:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000006002', '3000006002', '', '修改仓库调拨单', NULL, 0, '', NULL, '3000006', '8', '', 0, 2, 0, 'stock:sc-transfer:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000006003', '3000006003', '', '删除仓库调拨单', NULL, 0, '', NULL, '3000006', '8', '', 0, 2, 0, 'stock:sc-transfer:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000006004', '3000006004', '', '导出仓库调拨单', NULL, 0, '', NULL, '3000006', '8', '', 0, 2, 0, 'stock:sc-transfer:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000006005', '3000006005', '', '审核仓库调拨单', NULL, 0, '', NULL, '3000006', '8', '', 0, 2, 0, 'stock:sc-transfer:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('3000006006', '3000006006', '', '仓库调拨单收货', NULL, 0, '', NULL, '3000006', '8', '', 0, 2, 0, 'stock:sc-transfer:receive', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000', '4000', 'SettleManage', '结算管理', 'ant-design:credit-card-outlined', NULL, '', NULL, NULL, '11', '/settle', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('4000001', '4000001', 'SettleInItem', '收入项目', NULL, 0, '/settle/in-item/index', NULL, '4000', '11', '/in-item', 0, 1, 0, 'settle:in-item:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000001001', '4000001001', '', '新增收入项目', NULL, 0, '', NULL, '4000001', '11', '', 0, 2, 0, 'settle:in-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000001002', '4000001002', '', '修改收入项目', NULL, 0, '', NULL, '4000001', '11', '', 0, 2, 0, 'settle:in-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000001003', '4000001003', '', '导出收入项目', NULL, 0, '', NULL, '4000001', '11', '', 0, 2, 0, 'settle:in-item:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000002', '4000002', 'SettleOutItem', '支出项目', NULL, 0, '/settle/out-item/index', NULL, '4000', '11', '/out-item', 0, 1, 0, 'settle:out-item:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000002001', '4000002001', '', '新增支出项目', NULL, 0, '', NULL, '4000002', '11', '', 0, 2, 0, 'settle:out-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000002002', '4000002002', '', '修改支出项目', NULL, 0, '', NULL, '4000002', '11', '', 0, 2, 0, 'settle:out-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000002003', '4000002003', '', '导出支出项目', NULL, 0, '', NULL, '4000002', '11', '', 0, 2, 0, 'settle:out-item:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000003', '4000003', 'SettleFeeSheet', '供应商费用', NULL, 0, '/settle/fee-sheet/index', NULL, '4000007', '11', '/fee-sheet', 0, 1, 0, 'settle:fee-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000003001', '4000003001', '', '新增供应商费用单', NULL, 0, '', NULL, '4000003', '11', '', 0, 2, 0, 'settle:fee-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000003002', '4000003002', '', '修改供应商费用单', NULL, 0, '', NULL, '4000003', '11', '', 0, 2, 0, 'settle:fee-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000003003', '4000003003', '', '删除供应商费用单', NULL, 0, '', NULL, '4000003', '11', '', 0, 2, 0, 'settle:fee-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000003004', '4000003004', '', '审核供应商费用单', NULL, 0, '', NULL, '4000003', '11', '', 0, 2, 0, 'settle:fee-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000003005', '4000003005', '', '导出供应商费用单', NULL, 0, '', NULL, '4000003', '11', '', 0, 2, 0, 'settle:fee-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000004', '4000004', 'SettlePreSheet', '供应商预付款', NULL, 0, '/settle/pre-sheet/index', NULL, '4000007', '11', '/pre-sheet', 0, 1, 0, 'settle:pre-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000004001', '4000004001', '', '新增供应商预付款单', NULL, 0, '', NULL, '4000004', '11', '', 0, 2, 0, 'settle:pre-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000004002', '4000004002', '', '修改供应商预付款单', NULL, 0, '', NULL, '4000004', '11', '', 0, 2, 0, 'settle:pre-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000004003', '4000004003', '', '删除供应商预付款单', NULL, 0, '', NULL, '4000004', '11', '', 0, 2, 0, 'settle:pre-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000004004', '4000004004', '', '审核供应商预付款单', NULL, 0, '', NULL, '4000004', '11', '', 0, 2, 0, 'settle:pre-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000004005', '4000004005', '', '导出供应商预付款单', NULL, 0, '', NULL, '4000004', '11', '', 0, 2, 0, 'settle:pre-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000005', '4000005', 'SettleCheckSheet', '供应商对账', NULL, 0, '/settle/check-sheet/index', NULL, '4000007', '11', '/check-sheet', 0, 1, 0, 'settle:check-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000005001', '4000005001', '', '新增供应商对账单', NULL, 0, '', NULL, '4000005', '11', '', 0, 2, 0, 'settle:check-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000005002', '4000005002', '', '修改供应商对账单', NULL, 0, '', NULL, '4000005', '11', '', 0, 2, 0, 'settle:check-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000005003', '4000005003', '', '删除供应商对账单', NULL, 0, '', NULL, '4000005', '11', '', 0, 2, 0, 'settle:check-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000005004', '4000005004', '', '审核供应商对账单', NULL, 0, '', NULL, '4000005', '11', '', 0, 2, 0, 'settle:check-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000005005', '4000005005', '', '导出供应商对账单', NULL, 0, '', NULL, '4000005', '11', '', 0, 2, 0, 'settle:check-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000006', '4000006', 'SettleSheet', '供应商结算', NULL, 0, '/settle/sheet/index', NULL, '4000007', '11', '/sheet', 0, 1, 0, 'settle:sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000006001', '4000006001', '', '新增供应商结算单', NULL, 0, '', NULL, '4000006', '11', '', 0, 2, 0, 'settle:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000006002', '4000006002', '', '修改供应商结算单', NULL, 0, '', NULL, '4000006', '11', '', 0, 2, 0, 'settle:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000006003', '4000006003', '', '删除供应商结算单', NULL, 0, '', NULL, '4000006', '11', '', 0, 2, 0, 'settle:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000006004', '4000006004', '', '审核供应商结算单', NULL, 0, '', NULL, '4000006', '11', '', 0, 2, 0, 'settle:sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000006005', '4000006005', '', '导出供应商结算单', NULL, 0, '', NULL, '4000006', '11', '', 0, 2, 0, 'settle:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000007', '4000007', 'SupplierSettleManage', '供应商结算', NULL, NULL, '', NULL, '4000', '11', '/supplier', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('4000008', '4000008', 'CustomerSettleManage', '客户结算', NULL, NULL, '', NULL, '4000', '11', '/customer', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` VALUES ('4000009', '4000009', 'CustomerSettleFeeSheet', '客户费用', NULL, 0, '/customer-settle/fee-sheet/index', NULL, '4000008', '11', '/fee-sheet', 0, 1, 0, 'customer-settle:fee-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000009001', '4000009001', '', '新增客户费用单', NULL, 0, '', NULL, '4000009', '11', '', 0, 2, 0, 'customer-settle:fee-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000009002', '4000009002', '', '修改客户费用单', NULL, 0, '', NULL, '4000009', '11', '', 0, 2, 0, 'customer-settle:fee-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000009003', '4000009003', '', '删除客户费用单', NULL, 0, '', NULL, '4000009', '11', '', 0, 2, 0, 'customer-settle:fee-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000009004', '4000009004', '', '审核客户费用单', NULL, 0, '', NULL, '4000009', '11', '', 0, 2, 0, 'customer-settle:fee-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000009005', '4000009005', '', '导出客户费用单', NULL, 0, '', NULL, '4000009', '11', '', 0, 2, 0, 'customer-settle:fee-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000010', '4000010', 'CustomerSettlePreSheet', '客户预收款', NULL, 0, '/customer-settle/pre-sheet/index', NULL, '4000008', '11', '/pre-sheet', 0, 1, 0, 'customer-settle:pre-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000010001', '4000010001', '', '新增客户预收款单', NULL, 0, '', NULL, '4000010', '11', '', 0, 2, 0, 'customer-settle:pre-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000010002', '4000010002', '', '修改客户预收款单', NULL, 0, '', NULL, '4000010', '11', '', 0, 2, 0, 'customer-settle:pre-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000010003', '4000010003', '', '删除客户预收款单', NULL, 0, '', NULL, '4000010', '11', '', 0, 2, 0, 'customer-settle:pre-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000010004', '4000010004', '', '审核客户预收款单', NULL, 0, '', NULL, '4000010', '11', '', 0, 2, 0, 'customer-settle:pre-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000010005', '4000010005', '', '导出客户预收款单', NULL, 0, '', NULL, '4000010', '11', '', 0, 2, 0, 'customer-settle:pre-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000011', '4000011', 'CustomerSettleCheckSheet', '客户对账', NULL, 0, '/customer-settle/check-sheet/index', NULL, '4000008', '11', '/check-sheet', 0, 1, 0, 'customer-settle:check-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000011001', '4000011001', '', '新增客户对账单', NULL, 0, '', NULL, '4000011', '11', '', 0, 2, 0, 'customer-settle:check-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000011002', '4000011002', '', '修改客户对账单', NULL, 0, '', NULL, '4000011', '11', '', 0, 2, 0, 'customer-settle:check-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000011003', '4000011003', '', '删除客户对账单', NULL, 0, '', NULL, '4000011', '11', '', 0, 2, 0, 'customer-settle:check-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000011004', '4000011004', '', '审核客户对账单', NULL, 0, '', NULL, '4000011', '11', '', 0, 2, 0, 'customer-settle:check-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000011005', '4000011005', '', '导出客户对账单', NULL, 0, '', NULL, '4000011', '11', '', 0, 2, 0, 'customer-settle:check-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000012', '4000012', 'CustomerSettleSheet', '客户结算', NULL, 0, '/customer-settle/sheet/index', NULL, '4000008', '11', '/sheet', 0, 1, 0, 'customer-settle:sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` VALUES ('4000012001', '4000012001', '', '新增客户结算单', NULL, 0, '', NULL, '4000012', '11', '', 0, 2, 0, 'customer-settle:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000012002', '4000012002', '', '修改客户结算单', NULL, 0, '', NULL, '4000012', '11', '', 0, 2, 0, 'customer-settle:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000012003', '4000012003', '', '删除客户结算单', NULL, 0, '', NULL, '4000012', '11', '', 0, 2, 0, 'customer-settle:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000012004', '4000012004', '', '审核客户结算单', NULL, 0, '', NULL, '4000012', '11', '', 0, 2, 0, 'customer-settle:sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('4000012005', '4000012005', '', '导出客户结算单', NULL, 0, '', NULL, '4000012', '11', '', 0, 2, 0, 'customer-settle:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('5000', '5000', 'Logistics', '物流管理', 'ant-design:gift-outlined', NULL, '', NULL, NULL, '15', '/logistics', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('5000001', '5000001', 'LogisticsSheet', '物流单管理', NULL, 0, '/sc/logistics/sheet/index', NULL, '5000', '15', '/sheet', 0, 1, 0, 'logistics:sheet:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('5000001001', '5000001001', '', '新增物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('5000001002', '5000001002', '', '修改物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('5000001003', '5000001003', '', '删除物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('5000001004', '5000001004', '', '物流单发货', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:delivery', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('5000001005', '5000001005', '', '导入物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('5000001006', '5000001006', '', '导出物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('9000', '9000', 'Development', '开发管理', 'ant-design:tool-outlined', NULL, '', NULL, NULL, '12', '/development', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('9000001', '9000001', 'Qrtz', '定时器管理', NULL, 0, '/development/qrtz/index', NULL, '9000', '12', '/qrtz', 0, 1, 0, 'development:qrtz:manage', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('9000002', '9000002', 'DataEntity', '数据实体', NULL, 0, '/development/data/entity/index', NULL, '9000', '12', '/data/entity', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('9000003', '9000003', 'DataObj', '数据对象', NULL, 0, '/development/data/obj/index', NULL, '9000', '12', '/data/obj', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('9000004', '9000004', 'CustomList', '自定义列表', NULL, 0, '/development/custom/list/index', NULL, '9000', '12', '/custom/list', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('9000005', '9000005', 'CustomSelector', '自定义选择器', NULL, 0, '/development/custom/selector/index', NULL, '9000', '12', '/custom/selector', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('9000008', '9000008', 'CustomPage', '自定义页面', NULL, 0, '/development/custom/page/index', NULL, '9000', '12', '/custom/page', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` VALUES ('9001', '9001', 'SmartWork', '便捷办公', 'ant-design:read-outlined', NULL, '', NULL, NULL, '13', '/smart-work', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` VALUES ('9001001', '9001001', 'FileBox', '文件收纳箱', NULL, 0, '/smart-work/file-box/index', NULL, '9001', '13', '/file-box', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); + +-- ---------------------------- +-- Table structure for sys_menu_collect +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu_collect`; +CREATE TABLE `sys_menu_collect` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID', + `menu_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `user_id, menu_id`(`user_id`, `menu_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '菜单收藏' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_menu_collect +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_notice +-- ---------------------------- +DROP TABLE IF EXISTS `sys_notice`; +CREATE TABLE `sys_notice` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '内容', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `published` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否发布', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `readed_num` int(11) NOT NULL DEFAULT 0 COMMENT '已读人数', + `un_read_num` int(11) NOT NULL DEFAULT 0 COMMENT '未读人数', + `publish_time` datetime NULL DEFAULT NULL COMMENT '发布时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统通知' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_notice +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_notice_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_notice_log`; +CREATE TABLE `sys_notice_log` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `notice_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID', + `readed` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已读', + `read_time` datetime NULL DEFAULT NULL COMMENT '已读时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `notice_id`(`notice_id`, `user_id`) USING BTREE, + INDEX `user_id`(`user_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统通知记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_notice_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_parameter +-- ---------------------------- +DROP TABLE IF EXISTS `sys_parameter`; +CREATE TABLE `sys_parameter` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `pm_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键', + `pm_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '值', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `pm_key`(`pm_key`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统参数' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_parameter +-- ---------------------------- +INSERT INTO `sys_parameter` VALUES (1, 'tx-map.key', 'OLJBZ-ZFJK6-QWUSK-MB7XT-6UTN2-AWBSY', '腾讯地图Key', '系统管理员', '1', '2022-05-22 04:18:59', '系统管理员', '1', '2022-05-22 04:18:59'); +INSERT INTO `sys_parameter` VALUES (2, 'tx-map.secret', 'secret', '腾讯地图Secret', '系统管理员', '1', '2022-05-22 04:18:59', '系统管理员', '1', '2022-05-22 04:18:59'); +INSERT INTO `sys_parameter` VALUES (3, 'excel-import.max-size', '2000', 'Excel导入最大条数', '系统管理员', '1', '2022-06-10 21:39:32', '系统管理员', '1', '2022-06-10 21:39:32'); +INSERT INTO `sys_parameter` VALUES (8, 'mail', '{\n \"pass\":\"123456\",\n \"sslEnable\":true,\n \"timeOut\":30000,\n \"port\":25,\n \"host\":\"smtp.xingyun.com\",\n \"connectTimeOut\":1000,\n \"from\":\"test@xingyun.com\",\n \"user\":\"test\"\n}', '邮件配置', '系统管理员', '1', '2023-03-14 21:13:44', '系统管理员', '1', '2023-03-14 21:13:44'); +INSERT INTO `sys_parameter` VALUES (9, 'upload.type', 'LOCAL', '上传类型,分为LOCAL、OSS、COS、OBS。LOCAL:服务器本地存储。OSS:阿里云对象存储。COS:腾讯云对象存储。OBS:华为云对象存储', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 10:38:10'); +INSERT INTO `sys_parameter` VALUES (10, 'upload.oss.config', '{\"customUrl\":\"\",\"endpoint\":\"yourEndpoint\",\"internalEndPoint\":\"\",\"accessKeyId\":\"yourAccessKeyId\",\"accessKeySecret\":\"yourAccessKeySecret\",\"bucketName\":\"yourBucketName\"}', '阿里云对象存储配置信息,upload.type=OSS时生效,注意:当服务器与OSS同一地域时,建议填写internalEndPoint,此值表示内网endpoint,在上传时会优先使用内网endpoint。customUrl为自定义域名(需带协议)为空代表不使用自定义域名,示例值:https://www.lframework.com。其他参数均在阿里云控台获取。', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 10:38:10'); +INSERT INTO `sys_parameter` VALUES (11, 'upload.obs.config', '{\"customUrl\":\"\",\"endpoint\":\"yourEndpoint\",\"ak\":\"yourAccessKeyId\",\"sk\":\"yourAccessKeySecret\",\"bucketName\":\"yourBucketName\"}', '华为云对象存储配置信息,upload.type=OBS时生效。customUrl为自定义域名(需带协议)为空代表不使用自定义域名,示例值:https://www.lframework.com。其他参数均在华为云控台获取。', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 10:38:10'); +INSERT INTO `sys_parameter` VALUES (12, 'upload.cos.config', '{\"customUrl\":\"yourCustomUrl\",\"region\":\"yourRegion\",\"secretId\":\"yourSecretId\",\"secretKey\":\"yourSecretKey\",\"bucketName\":\"yourBucketName\"}', '腾讯云对象存储配置信息,upload.type=COS时生效。customUrl为下载文件时的域名,如果使用自定义域名,示例值:https://www.lframework.com,如果不使用自定义域名,那么就填写COS的访问域名。其他参数均在腾讯云控台获取。', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 14:48:02'); + +-- ---------------------------- +-- Table structure for sys_position +-- ---------------------------- +DROP TABLE IF EXISTS `sys_position`; +CREATE TABLE `sys_position` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + UNIQUE INDEX `name`(`name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '岗位' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_position +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `permission` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + UNIQUE INDEX `name`(`name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_role +-- ---------------------------- +INSERT INTO `sys_role` VALUES ('1', '001', '系统管理员', 'admin', 1, '系统管理员', '系统管理员', '1', '2021-05-08 18:04:41', '系统管理员', '1', '2021-05-08 18:04:45'); + +-- ---------------------------- +-- Table structure for sys_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role_menu`; +CREATE TABLE `sys_role_menu` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `role_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', + `menu_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `role_id, menu_id`(`role_id`, `menu_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色与菜单关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_role_menu +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_user +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '姓名', + `username` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名', + `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码', + `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱', + `telephone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `gender` tinyint(3) NOT NULL DEFAULT 0 COMMENT '性别 0-未知 1-男 2-女', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态 1-在用 0停用', + `lock_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '锁定状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + UNIQUE INDEX `username`(`username`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_user +-- ---------------------------- +INSERT INTO `sys_user` VALUES ('1', '001', '系统管理员', 'admin', '$2a$10$IJtHluhnhAYkgvM4PdKuZek5PWbtuxtjB9pB.twZdxg/qrlR4s4q6', 'xingyun@lframework.com', '17600000001', 0, 1, 0, '', '系统管理员', '1', '2021-04-22 22:00:27', '系统管理员', '1', '2023-03-09 13:30:44'); + +-- ---------------------------- +-- Table structure for sys_user_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_dept`; +CREATE TABLE `sys_user_dept` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID', + `dept_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '部门ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `user_id`(`user_id`, `dept_id`) USING BTREE, + INDEX `dept_id`(`dept_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户与部门关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_user_dept +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_user_position +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_position`; +CREATE TABLE `sys_user_position` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID', + `position_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `user_id`(`user_id`, `position_id`) USING BTREE, + INDEX `position_id`(`position_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户与岗位关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_user_position +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID', + `role_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `user_id, role_id`(`user_id`, `role_id`) USING BTREE, + INDEX `role_id`(`role_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户与角色关系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_user_role +-- ---------------------------- +INSERT INTO `sys_user_role` VALUES ('1', '1', '1'); + +-- ---------------------------- +-- Table structure for sys_user_telephone +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_telephone`; +CREATE TABLE `sys_user_telephone` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `telephone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号', + `user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `telephone`(`telephone`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户绑定手机号表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sys_user_telephone +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_logistics_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_logistics_sheet`; +CREATE TABLE `tbl_logistics_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务单据号', + `logistics_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '物流单号', + `logistics_company_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物流公司ID', + `sender_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '寄件人姓名', + `sender_telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '寄件人联系电话', + `sender_province_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '寄件人省', + `sender_city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '寄件人市', + `sender_district_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '寄件人区', + `sender_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '寄件人地址', + `receiver_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收件人姓名', + `receiver_telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收件人联系电话', + `receiver_province_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收件人省', + `receiver_city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收件人市', + `receiver_district_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收件人区', + `receiver_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收件人地址', + `total_weight` decimal(16, 2) NULL DEFAULT NULL COMMENT '总重量(kg)', + `total_volume` decimal(16, 2) NULL DEFAULT NULL COMMENT '总体积(cm3)', + `total_amount` decimal(16, 2) NULL DEFAULT NULL COMMENT '物流费', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `delivery_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货人', + `delivery_time` datetime NULL DEFAULT NULL COMMENT '发货时间', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `logistics_no`(`logistics_no`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物流单' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of tbl_logistics_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_logistics_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_logistics_sheet_detail`; +CREATE TABLE `tbl_logistics_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '物流单ID', + `biz_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务单据ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX ```biz_id```(`biz_id`, `biz_type`) USING BTREE, + INDEX `sheet_id`(`sheet_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '物流单明细' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of tbl_logistics_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_order_chart +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_order_chart`; +CREATE TABLE `tbl_order_chart` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `total_amount` decimal(24, 2) NOT NULL COMMENT '单据总金额', + `create_time` datetime NOT NULL COMMENT '创建时间', + `create_date` varchar(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建日期', + `create_hour` varchar(13) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建时间(小时)', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE, + INDEX `create_date`(`create_date`) USING BTREE, + INDEX `create_hour`(`create_hour`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单图表数据' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_order_chart +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_order_pay_type +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_order_pay_type`; +CREATE TABLE `tbl_order_pay_type` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单ID', + `pay_type_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支付方式ID', + `pay_amount` decimal(24, 2) NOT NULL COMMENT '支付金额', + `text` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付内容', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单支付方式' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_order_pay_type +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_order_time_line +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_order_time_line`; +CREATE TABLE `tbl_order_time_line` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单据ID', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '描述内容', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '单据时间轴' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_order_time_line +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_pre_take_stock_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_pre_take_stock_sheet`; +CREATE TABLE `tbl_pre_take_stock_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `take_status` tinyint(3) NOT NULL COMMENT '盘点状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存预先盘点单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_pre_take_stock_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_pre_take_stock_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_pre_take_stock_sheet_detail`; +CREATE TABLE `tbl_pre_take_stock_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '预先盘点单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `first_num` int(11) NULL DEFAULT NULL COMMENT '初盘数量', + `second_num` int(11) NULL DEFAULT NULL COMMENT '复盘数量', + `rand_num` int(11) NULL DEFAULT NULL COMMENT '抽盘数量', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存预先盘点单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_pre_take_stock_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_product_stock +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_product_stock`; +CREATE TABLE `tbl_product_stock` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL DEFAULT 0 COMMENT '库存数量', + `tax_price` decimal(24, 6) NOT NULL COMMENT '含税价格', + `tax_amount` decimal(24, 2) NOT NULL COMMENT '含税金额', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `product_id`(`product_id`, `sc_id`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品库存' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_product_stock +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_product_stock_log +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_product_stock_log`; +CREATE TABLE `tbl_product_stock_log` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `ori_tax_price` decimal(24, 6) NOT NULL COMMENT '原含税成本价', + `cur_tax_price` decimal(24, 6) NOT NULL COMMENT '现含税成本价', + `ori_stock_num` int(11) NOT NULL, + `cur_stock_num` int(11) NOT NULL, + `stock_num` int(11) NOT NULL DEFAULT 0 COMMENT '库存数量', + `tax_amount` decimal(24, 2) NOT NULL COMMENT '含税金额', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `biz_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务单据ID', + `biz_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务单据号', + `biz_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务单据明细ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品库存变动记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_product_stock_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_purchase_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_config`; +CREATE TABLE `tbl_purchase_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `receive_require_purchase` tinyint(1) NOT NULL DEFAULT 0 COMMENT '采购收货单是否关联采购订单', + `receive_multiple_relate_purchase` tinyint(1) NOT NULL DEFAULT 0 COMMENT '采购收货单是否多次关联采购订单', + `purchase_return_require_receive` tinyint(1) NOT NULL DEFAULT 0 COMMENT '采购退货单是否关联采购收货单', + `purchase_return_multiple_relate_receive` tinyint(1) NOT NULL DEFAULT 0 COMMENT '采购退货单是否多次关联采购收货单', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购参数设置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_purchase_config +-- ---------------------------- +INSERT INTO `tbl_purchase_config` VALUES ('1', 1, 1, 1, 1); + +-- ---------------------------- +-- Table structure for tbl_purchase_order +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_order`; +CREATE TABLE `tbl_purchase_order` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `supplier_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商ID', + `purchaser_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '采购员ID', + `expect_arrive_date` date NULL DEFAULT NULL COMMENT '预计到货日期', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '采购数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '采购金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `supplier_id`(`supplier_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购订单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_purchase_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_purchase_order_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_order_detail`; +CREATE TABLE `tbl_purchase_order_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '采购数量', + `tax_price` decimal(16, 2) NOT NULL COMMENT '采购价', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `receive_num` int(11) NOT NULL DEFAULT 0 COMMENT '已收货数量', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购订单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_purchase_order_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_purchase_return +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_return`; +CREATE TABLE `tbl_purchase_return` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `supplier_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商ID', + `purchaser_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '采购员ID', + `payment_date` date NULL DEFAULT NULL COMMENT '付款日期', + `receive_sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货单ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '退货金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `tx_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) NULL DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `supplier_id`(`supplier_id`) USING BTREE, + INDEX `receive_sheet_id`(`receive_sheet_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购退单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_purchase_return +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_purchase_return_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_return_detail`; +CREATE TABLE `tbl_purchase_return_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `return_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收货单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `return_num` int(11) NOT NULL COMMENT '退货数量', + `tax_price` decimal(16, 2) NOT NULL COMMENT '采购价', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `receive_sheet_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货单明细ID', + PRIMARY KEY (`id`) USING BTREE, + INDEX `return_id`(`return_id`) USING BTREE, + INDEX `receive_sheet_detail_id`(`receive_sheet_detail_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购退单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_purchase_return_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_receive_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_receive_sheet`; +CREATE TABLE `tbl_receive_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `supplier_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '供应商ID', + `purchaser_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '采购员ID', + `payment_date` date NULL DEFAULT NULL COMMENT '付款日期', + `receive_date` date NULL DEFAULT NULL COMMENT '到货日期', + `purchase_order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '采购单ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '收货金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `tx_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) NULL DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `supplier_id`(`supplier_id`) USING BTREE, + INDEX `purchase_order_id`(`purchase_order_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购收货单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_receive_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_receive_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_receive_sheet_detail`; +CREATE TABLE `tbl_receive_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收货单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '采购数量', + `tax_price` decimal(16, 2) NOT NULL COMMENT '采购价', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `purchase_order_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '采购订单明细ID', + `return_num` int(11) NOT NULL DEFAULT 0 COMMENT '已退货数量', + PRIMARY KEY (`id`) USING BTREE, + INDEX `sheet_id`(`sheet_id`) USING BTREE, + INDEX `purchase_order_detail_id`(`purchase_order_detail_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购收货单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_receive_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_retail_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_config`; +CREATE TABLE `tbl_retail_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `retail_out_sheet_require_member` tinyint(1) NOT NULL DEFAULT 1 COMMENT '零售出库单上的会员是否必填', + `retail_return_require_out_stock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '零售退货单是否关联零售出库单', + `retail_return_multiple_relate_out_stock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '零售退货单是否多次关联零售出库单', + `retail_return_require_member` tinyint(1) NOT NULL DEFAULT 1 COMMENT '零售退货单上的会员是否必填', + `retail_out_sheet_require_logistics` tinyint(1) NOT NULL DEFAULT 0 COMMENT '零售出库单是否需要发货', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '零售参数设置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_retail_config +-- ---------------------------- +INSERT INTO `tbl_retail_config` VALUES ('1', 0, 0, 1, 0, 0); + +-- ---------------------------- +-- Table structure for tbl_retail_out_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_out_sheet`; +CREATE TABLE `tbl_retail_out_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `member_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会员ID', + `saler_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售员ID', + `payment_date` date NULL DEFAULT NULL COMMENT '付款日期', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '出库金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE, + INDEX `member_id`(`member_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '零售出库单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_retail_out_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_retail_out_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_out_sheet_detail`; +CREATE TABLE `tbl_retail_out_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '出库单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `ori_price` decimal(16, 2) NOT NULL COMMENT '原价', + `tax_price` decimal(16, 2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16, 2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `return_num` int(11) NOT NULL DEFAULT 0 COMMENT '已退货数量', + `ori_bundle_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组合商品原始明细ID', + PRIMARY KEY (`id`) USING BTREE, + INDEX `sheet_id`(`sheet_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '零售出库单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_retail_out_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_retail_out_sheet_detail_bundle +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_out_sheet_detail_bundle`; +CREATE TABLE `tbl_retail_out_sheet_detail_bundle` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '出库单ID', + `detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '明细ID', + `main_product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组合商品ID', + `order_num` int(11) NOT NULL DEFAULT 0 COMMENT '组合商品数量', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单品ID', + `product_order_num` int(11) NOT NULL COMMENT '单品数量', + `product_ori_price` decimal(16, 2) NOT NULL COMMENT '单品原价', + `product_tax_price` decimal(16, 2) NOT NULL COMMENT '单品含税价格', + `product_tax_rate` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单品税率', + `product_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单品明细ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `product_detail_id`) USING BTREE, + INDEX `detail_id`(`detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '零售出库单组合商品明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_retail_out_sheet_detail_bundle +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_retail_out_sheet_detail_lot +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_out_sheet_detail_lot`; +CREATE TABLE `tbl_retail_out_sheet_detail_lot` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '明细ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `return_num` int(11) NOT NULL DEFAULT 0 COMMENT '已退货数量', + `cost_tax_amount` decimal(24, 2) NOT NULL COMMENT '含税成本金额', + `settle_status` tinyint(3) NOT NULL COMMENT '结算状态', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + INDEX `detail_id`(`detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '零售出库单批次明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_retail_out_sheet_detail_lot +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_retail_return +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_return`; +CREATE TABLE `tbl_retail_return` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `member_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会员ID', + `saler_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售员ID', + `payment_date` date NULL DEFAULT NULL COMMENT '付款日期', + `out_sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出库单ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '退货金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE, + INDEX `out_sheet_id`(`out_sheet_id`) USING BTREE, + INDEX `member_id`(`member_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '零售退单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_retail_return +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_retail_return_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_return_detail`; +CREATE TABLE `tbl_retail_return_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `return_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '退货单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `return_num` int(11) NOT NULL COMMENT '退货数量', + `ori_price` decimal(16, 2) NOT NULL COMMENT '原价', + `tax_price` decimal(16, 2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16, 2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `out_sheet_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出库单明细ID', + PRIMARY KEY (`id`) USING BTREE, + INDEX `return_id`(`return_id`) USING BTREE, + INDEX `out_sheet_detail_id`(`out_sheet_detail_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '零售退单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_retail_return_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_config`; +CREATE TABLE `tbl_sale_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `out_stock_require_sale` tinyint(1) NOT NULL DEFAULT 0 COMMENT '销售出库单是否关联销售订单', + `out_stock_multiple_relate_sale` tinyint(1) NOT NULL DEFAULT 0 COMMENT '销售出库单是否多次关联销售订单', + `sale_return_require_out_stock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '销售退货单是否关联销售出库单', + `sale_return_multiple_relate_out_stock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '销售退货单是否多次关联销售出库单', + `out_stock_require_logistics` tinyint(1) NOT NULL DEFAULT 0 COMMENT '销售出库单是否需要物流单', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售参数设置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_config +-- ---------------------------- +INSERT INTO `tbl_sale_config` VALUES ('1', 0, 0, 0, 0, 0); + +-- ---------------------------- +-- Table structure for tbl_sale_order +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_order`; +CREATE TABLE `tbl_sale_order` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `customer_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `saler_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售员ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '销售数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '销售金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE, + INDEX `customer_id`(`customer_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售订单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_order_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_order_detail`; +CREATE TABLE `tbl_sale_order_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '销售数量', + `ori_price` decimal(16, 2) NOT NULL COMMENT '原价', + `tax_price` decimal(16, 2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16, 2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `out_num` int(11) NOT NULL DEFAULT 0 COMMENT '已出库数量', + `ori_bundle_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组合商品原始明细ID', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售订单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_order_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_order_detail_bundle +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_order_detail_bundle`; +CREATE TABLE `tbl_sale_order_detail_bundle` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '销售单ID', + `detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '明细ID', + `main_product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组合商品ID', + `order_num` int(11) NOT NULL DEFAULT 0 COMMENT '组合商品数量', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单品ID', + `product_order_num` int(11) NOT NULL COMMENT '单品数量', + `product_ori_price` decimal(16, 2) NOT NULL COMMENT '单品原价', + `product_tax_price` decimal(16, 2) NOT NULL COMMENT '单品含税价格', + `product_tax_rate` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单品税率', + `product_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单品明细ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `order_id`(`order_id`, `product_detail_id`) USING BTREE, + INDEX `detail_id`(`detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售单组合商品明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_order_detail_bundle +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_out_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_out_sheet`; +CREATE TABLE `tbl_sale_out_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `customer_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `saler_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售员ID', + `payment_date` date NULL DEFAULT NULL COMMENT '付款日期', + `sale_order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售单ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '出库金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `tx_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) NULL DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE, + INDEX `customer_id`(`customer_id`) USING BTREE, + INDEX `sale_order_id`(`sale_order_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售出库单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_out_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_out_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_out_sheet_detail`; +CREATE TABLE `tbl_sale_out_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '出库单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `ori_price` decimal(16, 2) NOT NULL COMMENT '原价', + `tax_price` decimal(16, 2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16, 2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `sale_order_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售订单明细ID', + `ori_bundle_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组合商品原始明细ID', + `return_num` int(11) NOT NULL DEFAULT 0 COMMENT '已退货数量', + PRIMARY KEY (`id`) USING BTREE, + INDEX `sheet_id`(`sheet_id`) USING BTREE, + INDEX `purchase_order_detail_id`(`sale_order_detail_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售出库单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_out_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_out_sheet_detail_bundle +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_out_sheet_detail_bundle`; +CREATE TABLE `tbl_sale_out_sheet_detail_bundle` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '出库单ID', + `detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '明细ID', + `main_product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组合商品ID', + `order_num` int(11) NOT NULL DEFAULT 0 COMMENT '组合商品数量', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单品ID', + `product_order_num` int(11) NOT NULL COMMENT '单品数量', + `product_ori_price` decimal(16, 2) NOT NULL COMMENT '单品原价', + `product_tax_price` decimal(16, 2) NOT NULL COMMENT '单品含税价格', + `product_tax_rate` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单品税率', + `product_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单品明细ID', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `product_detail_id`) USING BTREE, + INDEX `detail_id`(`detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售出库单组合商品明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_out_sheet_detail_bundle +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_out_sheet_detail_lot +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_out_sheet_detail_lot`; +CREATE TABLE `tbl_sale_out_sheet_detail_lot` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '明细ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `return_num` int(11) NOT NULL DEFAULT 0 COMMENT '已退货数量', + `cost_tax_amount` decimal(24, 2) NOT NULL COMMENT '含税成本金额', + `settle_status` tinyint(3) NOT NULL COMMENT '结算状态', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + INDEX `detail_id`(`detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售出库单批次明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_out_sheet_detail_lot +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_return +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_return`; +CREATE TABLE `tbl_sale_return` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `customer_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `saler_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '销售员ID', + `payment_date` date NULL DEFAULT NULL COMMENT '付款日期', + `out_sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出库单ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT 0 COMMENT '赠品数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '退货金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `tx_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) NULL DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE, + INDEX `customer_id`(`customer_id`) USING BTREE, + INDEX `out_sheet_id`(`out_sheet_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售退单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_return +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sale_return_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_return_detail`; +CREATE TABLE `tbl_sale_return_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `return_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '退货单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `return_num` int(11) NOT NULL COMMENT '退货数量', + `ori_price` decimal(16, 2) NOT NULL COMMENT '原价', + `tax_price` decimal(16, 2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16, 2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否赠品', + `tax_rate` decimal(16, 2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '结算状态', + `out_sheet_detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出库单明细ID', + PRIMARY KEY (`id`) USING BTREE, + INDEX `return_id`(`return_id`) USING BTREE, + INDEX `out_sheet_detail_id`(`out_sheet_detail_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '销售退单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sale_return_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sc_transfer_order +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sc_transfer_order`; +CREATE TABLE `tbl_sc_transfer_order` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `source_sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '转出仓库ID', + `target_sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '转入仓库ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '调拨数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '调拨成本金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `source_sc_id`(`source_sc_id`) USING BTREE, + INDEX `target_sc_id`(`target_sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '仓库调拨单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sc_transfer_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sc_transfer_order_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sc_transfer_order_detail`; +CREATE TABLE `tbl_sc_transfer_order_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '调拨单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `transfer_num` int(11) NOT NULL COMMENT '调拨数量', + `tax_price` decimal(16, 2) NULL DEFAULT NULL COMMENT '成本价', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `receive_num` int(11) NOT NULL DEFAULT 0 COMMENT '已收货数量', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '仓库调拨单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sc_transfer_order_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_sc_transfer_order_detail_receive +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sc_transfer_order_detail_receive`; +CREATE TABLE `tbl_sc_transfer_order_detail_receive` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '调拨单ID', + `detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '明细ID', + `receive_num` int(11) NOT NULL COMMENT '收货数量', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`, `detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '仓库调拨单收货明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_sc_transfer_order_detail_receive +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_shop +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_shop`; +CREATE TABLE `tbl_shop` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `dept_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门ID', + `lng` decimal(16, 6) NULL DEFAULT NULL COMMENT '经度', + `lat` decimal(16, 6) NULL DEFAULT NULL COMMENT '纬度', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态 1-在用 0停用', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门店' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_shop +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_stock_adjust_reason +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_stock_adjust_reason`; +CREATE TABLE `tbl_stock_adjust_reason` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存调整原因' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_stock_adjust_reason +-- ---------------------------- +INSERT INTO `tbl_stock_adjust_reason` VALUES ('1', '001', '初始化数据', 1, '系统内置', '系统管理员', '1', '2023-04-18 14:04:34', '系统管理员', '1', '2023-04-18 14:04:53'); +INSERT INTO `tbl_stock_adjust_reason` VALUES ('2', '002', '损溢', 1, '系统内置', '系统管理员', '1', '2023-04-18 14:04:34', '系统管理员', '1', '2023-04-18 14:04:53'); +INSERT INTO `tbl_stock_adjust_reason` VALUES ('3', '003', '其他', 1, '系统内置', '系统管理员', '1', '2023-04-18 14:04:34', '系统管理员', '1', '2023-04-18 14:04:53'); + +-- ---------------------------- +-- Table structure for tbl_stock_adjust_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_stock_adjust_sheet`; +CREATE TABLE `tbl_stock_adjust_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `reason_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '调整原因ID', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存调整单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_stock_adjust_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_stock_adjust_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_stock_adjust_sheet_detail`; +CREATE TABLE `tbl_stock_adjust_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单据ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL COMMENT '调整库存数量', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存调整单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_stock_adjust_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_stock_cost_adjust_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_stock_cost_adjust_sheet`; +CREATE TABLE `tbl_stock_cost_adjust_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `product_num` int(11) NOT NULL COMMENT '调价品种数', + `diff_amount` decimal(24, 2) NOT NULL COMMENT '库存调价差额', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存成本调整单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_stock_cost_adjust_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_stock_cost_adjust_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_stock_cost_adjust_sheet_detail`; +CREATE TABLE `tbl_stock_cost_adjust_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单据ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL COMMENT '库存数量', + `purchase_price` decimal(16, 2) NOT NULL COMMENT '档案采购价', + `ori_price` decimal(16, 2) NOT NULL COMMENT '调整前成本价', + `price` decimal(16, 2) NOT NULL COMMENT '调整后成本价', + `diff_amount` decimal(24, 2) NOT NULL COMMENT '库存调价差额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存成本调整单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_stock_cost_adjust_sheet_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_take_stock_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_config`; +CREATE TABLE `tbl_take_stock_config` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `show_product` tinyint(1) NOT NULL DEFAULT 0 COMMENT '库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据', + `show_stock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '库存盘点单是否显示盘点任务创建时商品的系统库存数量', + `auto_change_stock` tinyint(1) NOT NULL DEFAULT 0 COMMENT '盘点差异生成时是否自动调整盘点任务中商品的系统库存数量', + `allow_change_num` tinyint(1) NOT NULL DEFAULT 0 COMMENT '盘点差异单中的盘点数量是否允许手动修改', + `cancel_hours` int(11) NOT NULL DEFAULT 24 COMMENT '盘点任务创建后多少小时内内未完成,则自动作废', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存盘点参数设置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_take_stock_config +-- ---------------------------- +INSERT INTO `tbl_take_stock_config` VALUES ('1', 1, 1, 1, 1, 168); + +-- ---------------------------- +-- Table structure for tbl_take_stock_plan +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_plan`; +CREATE TABLE `tbl_take_stock_plan` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `take_type` tinyint(3) NOT NULL COMMENT '盘点类别', + `biz_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '业务ID', + `take_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '盘点状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存盘点任务' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_take_stock_plan +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_take_stock_plan_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_plan_detail`; +CREATE TABLE `tbl_take_stock_plan_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `plan_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '盘点任务ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL COMMENT '初始库存数量', + `ori_take_num` int(11) NULL DEFAULT NULL COMMENT '盘点数量', + `take_num` int(11) NULL DEFAULT NULL COMMENT '修改后的盘点数量', + `total_out_num` int(11) NOT NULL DEFAULT 0 COMMENT '出项数量', + `total_in_num` int(11) NOT NULL DEFAULT 0 COMMENT '入项数量', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL DEFAULT 0 COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `plan_id`(`plan_id`, `product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存盘点任务明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_take_stock_plan_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_take_stock_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_sheet`; +CREATE TABLE `tbl_take_stock_sheet` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务单据号', + `plan_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '盘点任务ID', + `pre_sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预先盘点单ID', + `sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '仓库ID', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `plan_id`(`plan_id`) USING BTREE, + INDEX `sc_id`(`sc_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存盘点单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_take_stock_sheet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tbl_take_stock_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_sheet_detail`; +CREATE TABLE `tbl_take_stock_sheet_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '盘点单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `take_num` int(11) NOT NULL COMMENT '盘点数量', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sheet_id`(`sheet_id`, `product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存盘点单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tbl_take_stock_sheet_detail +-- ---------------------------- + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/xingyun-api/src/main/resources/db/migration/platform/V1.0__init.sql b/xingyun-api/src/main/resources/db/migration/platform/V1.0__init.sql new file mode 100644 index 0000000..8fa0426 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/platform/V1.0__init.sql @@ -0,0 +1,313 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for qrtz_blob_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_blob_triggers`; +CREATE TABLE `qrtz_blob_triggers` ( + `SCHED_NAME` varchar(120) NOT NULL, + `TRIGGER_NAME` varchar(190) NOT NULL, + `TRIGGER_GROUP` varchar(190) NOT NULL, + `BLOB_DATA` blob, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), + KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_blob_triggers +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_calendars +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_calendars`; +CREATE TABLE `qrtz_calendars` ( + `SCHED_NAME` varchar(120) NOT NULL, + `CALENDAR_NAME` varchar(190) NOT NULL, + `CALENDAR` blob NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_calendars +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_cron_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_cron_triggers`; +CREATE TABLE `qrtz_cron_triggers` ( + `SCHED_NAME` varchar(120) NOT NULL, + `TRIGGER_NAME` varchar(190) NOT NULL, + `TRIGGER_GROUP` varchar(190) NOT NULL, + `CRON_EXPRESSION` varchar(120) NOT NULL, + `TIME_ZONE_ID` varchar(80) DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_cron_triggers +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_fired_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_fired_triggers`; +CREATE TABLE `qrtz_fired_triggers` ( + `SCHED_NAME` varchar(120) NOT NULL, + `ENTRY_ID` varchar(95) NOT NULL, + `TRIGGER_NAME` varchar(190) NOT NULL, + `TRIGGER_GROUP` varchar(190) NOT NULL, + `INSTANCE_NAME` varchar(190) NOT NULL, + `FIRED_TIME` bigint(13) NOT NULL, + `SCHED_TIME` bigint(13) NOT NULL, + `PRIORITY` int(11) NOT NULL, + `STATE` varchar(16) NOT NULL, + `JOB_NAME` varchar(190) DEFAULT NULL, + `JOB_GROUP` varchar(190) DEFAULT NULL, + `IS_NONCONCURRENT` varchar(1) DEFAULT NULL, + `REQUESTS_RECOVERY` varchar(1) DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`), + KEY `IDX_QRTZ_FT_TRIG_INST_NAME` (`SCHED_NAME`,`INSTANCE_NAME`), + KEY `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY` (`SCHED_NAME`,`INSTANCE_NAME`,`REQUESTS_RECOVERY`), + KEY `IDX_QRTZ_FT_J_G` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`), + KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`), + KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), + KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_fired_triggers +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_job_details +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_job_details`; +CREATE TABLE `qrtz_job_details` ( + `SCHED_NAME` varchar(120) NOT NULL, + `JOB_NAME` varchar(190) NOT NULL, + `JOB_GROUP` varchar(190) NOT NULL, + `DESCRIPTION` varchar(250) DEFAULT NULL, + `JOB_CLASS_NAME` varchar(250) NOT NULL, + `IS_DURABLE` varchar(1) NOT NULL, + `IS_NONCONCURRENT` varchar(1) NOT NULL, + `IS_UPDATE_DATA` varchar(1) NOT NULL, + `REQUESTS_RECOVERY` varchar(1) NOT NULL, + `JOB_DATA` blob, + PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`), + KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`), + KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_job_details +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_locks +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_locks`; +CREATE TABLE `qrtz_locks` ( + `SCHED_NAME` varchar(120) NOT NULL, + `LOCK_NAME` varchar(40) NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_locks +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_paused_trigger_grps +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`; +CREATE TABLE `qrtz_paused_trigger_grps` ( + `SCHED_NAME` varchar(120) NOT NULL, + `TRIGGER_GROUP` varchar(190) NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_paused_trigger_grps +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_scheduler_state +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_scheduler_state`; +CREATE TABLE `qrtz_scheduler_state` ( + `SCHED_NAME` varchar(120) NOT NULL, + `INSTANCE_NAME` varchar(190) NOT NULL, + `LAST_CHECKIN_TIME` bigint(13) NOT NULL, + `CHECKIN_INTERVAL` bigint(13) NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_scheduler_state +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_simple_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simple_triggers`; +CREATE TABLE `qrtz_simple_triggers` ( + `SCHED_NAME` varchar(120) NOT NULL, + `TRIGGER_NAME` varchar(190) NOT NULL, + `TRIGGER_GROUP` varchar(190) NOT NULL, + `REPEAT_COUNT` bigint(7) NOT NULL, + `REPEAT_INTERVAL` bigint(12) NOT NULL, + `TIMES_TRIGGERED` bigint(10) NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_simple_triggers +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_simprop_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simprop_triggers`; +CREATE TABLE `qrtz_simprop_triggers` ( + `SCHED_NAME` varchar(120) NOT NULL, + `TRIGGER_NAME` varchar(190) NOT NULL, + `TRIGGER_GROUP` varchar(190) NOT NULL, + `STR_PROP_1` varchar(512) DEFAULT NULL, + `STR_PROP_2` varchar(512) DEFAULT NULL, + `STR_PROP_3` varchar(512) DEFAULT NULL, + `INT_PROP_1` int(11) DEFAULT NULL, + `INT_PROP_2` int(11) DEFAULT NULL, + `LONG_PROP_1` bigint(20) DEFAULT NULL, + `LONG_PROP_2` bigint(20) DEFAULT NULL, + `DEC_PROP_1` decimal(13,4) DEFAULT NULL, + `DEC_PROP_2` decimal(13,4) DEFAULT NULL, + `BOOL_PROP_1` varchar(1) DEFAULT NULL, + `BOOL_PROP_2` varchar(1) DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_simprop_triggers +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for qrtz_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_triggers`; +CREATE TABLE `qrtz_triggers` ( + `SCHED_NAME` varchar(120) NOT NULL, + `TRIGGER_NAME` varchar(190) NOT NULL, + `TRIGGER_GROUP` varchar(190) NOT NULL, + `JOB_NAME` varchar(190) NOT NULL, + `JOB_GROUP` varchar(190) NOT NULL, + `DESCRIPTION` varchar(250) DEFAULT NULL, + `NEXT_FIRE_TIME` bigint(13) DEFAULT NULL, + `PREV_FIRE_TIME` bigint(13) DEFAULT NULL, + `PRIORITY` int(11) DEFAULT NULL, + `TRIGGER_STATE` varchar(16) NOT NULL, + `TRIGGER_TYPE` varchar(8) NOT NULL, + `START_TIME` bigint(13) NOT NULL, + `END_TIME` bigint(13) DEFAULT NULL, + `CALENDAR_NAME` varchar(190) DEFAULT NULL, + `MISFIRE_INSTR` smallint(2) DEFAULT NULL, + `JOB_DATA` blob, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), + KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`), + KEY `IDX_QRTZ_T_JG` (`SCHED_NAME`,`JOB_GROUP`), + KEY `IDX_QRTZ_T_C` (`SCHED_NAME`,`CALENDAR_NAME`), + KEY `IDX_QRTZ_T_G` (`SCHED_NAME`,`TRIGGER_GROUP`), + KEY `IDX_QRTZ_T_STATE` (`SCHED_NAME`,`TRIGGER_STATE`), + KEY `IDX_QRTZ_T_N_STATE` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`), + KEY `IDX_QRTZ_T_N_G_STATE` (`SCHED_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`), + KEY `IDX_QRTZ_T_NEXT_FIRE_TIME` (`SCHED_NAME`,`NEXT_FIRE_TIME`), + KEY `IDX_QRTZ_T_NFT_ST` (`SCHED_NAME`,`TRIGGER_STATE`,`NEXT_FIRE_TIME`), + KEY `IDX_QRTZ_T_NFT_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`), + KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`), + KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`), + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of qrtz_triggers +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_open_domain +-- ---------------------------- +DROP TABLE IF EXISTS `sys_open_domain`; +CREATE TABLE `sys_open_domain` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) NOT NULL COMMENT '名称', + `api_secret` varchar(100) NOT NULL COMMENT 'API秘钥', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `tenant_id` int(11) DEFAULT NULL COMMENT '租户ID', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开放域'; + +-- ---------------------------- +-- Records of sys_open_domain +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tenant +-- ---------------------------- +DROP TABLE IF EXISTS `tenant`; +CREATE TABLE `tenant` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(200) NOT NULL COMMENT '名称', + `jdbc_url` varchar(400) NOT NULL COMMENT 'JDBC连接地址', + `jdbc_username` varchar(200) NOT NULL COMMENT 'JDBC用户名', + `jdbc_password` varchar(200) NOT NULL COMMENT 'JDBC密码', + `available` tinyint(1) NOT NULL COMMENT '状态', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1003 DEFAULT CHARSET=utf8mb4 COMMENT='租户'; + +-- ---------------------------- +-- Records of tenant +-- ---------------------------- +BEGIN; +INSERT INTO `tenant` (`id`, `name`, `jdbc_url`, `jdbc_username`, `jdbc_password`, `available`, `create_time`, `update_time`) VALUES (1000, '测试租户', 'jdbc:mysql://127.0.0.1:3306/xingyun', 'root', '123456', 1, '2022-12-31 22:59:21', '2023-03-13 22:14:07'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/xingyun-api/src/main/resources/db/migration/platform/V1.1__sys_module.sql b/xingyun-api/src/main/resources/db/migration/platform/V1.1__sys_module.sql new file mode 100644 index 0000000..f569d31 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/platform/V1.1__sys_module.sql @@ -0,0 +1,61 @@ +DROP TABLE IF EXISTS `sys_module`; +CREATE TABLE `sys_module` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统模块' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_module +-- ---------------------------- +INSERT INTO `sys_module` VALUES (1, '平台管理', '系统平台的核心模块。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (2, '系统管理', '维护企业、系统基础数据,包括部门、岗位、角色、系统菜单和参数等。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (3, '基础信息管理', '维护基础业务数据,包括仓库、客户、供应商、会员等。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (4, '商品中心', '管理商品核心数据。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (5, '采购业务', '管理供应商与企业的采购业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (6, '销售业务', '管理企业与TOB端大客户的销售业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (7, '零售业务', '管理企业与TOC端会员的零售业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (8, '库存管理及调拨', '查询商品库存和进行商品调拨。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (9, '库存盘点', '库存商品盘点。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (10, '库存调整', '商品库存数量和成本调整。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (11, '结算管理', '企业与供应商、客户进行结算。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (12, '开发管理', '系统快捷开发,如管理定时器、数据实体、数据对象、表单生成等。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (13, '便捷办公', '支持文件收纳和在线Excel。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (14, '开放平台', '系统开放平台管理。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); +INSERT INTO `sys_module` VALUES (15, '物流发货', '管理企业物流业务。', '系统管理员', '1', '2023-06-06 10:26:30', '系统管理员', '1', '2023-06-06 10:26:41'); + +DROP TABLE IF EXISTS `sys_module_tenant`; +CREATE TABLE `sys_module_tenant` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `module_id` int(11) NOT NULL COMMENT '模块ID', + `tenant_id` int(11) NOT NULL COMMENT '租户ID', + `expire_time` datetime NOT NULL COMMENT '过期时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `name`(`tenant_id`, `module_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租户和系统模块关系表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_module_tenant +-- ---------------------------- +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875135', 1, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875136', 2, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875137', 3, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875138', 4, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875139', 5, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875140', 6, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875141', 7, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875142', 8, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875143', 9, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875144', 10, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875145', 11, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875146', 12, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875147', 13, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875148', 14, 1000, '2099-01-01 00:00:00'); +INSERT INTO `sys_module_tenant` VALUES ('1666286094246875149', 15, 1000, '2099-01-01 00:00:00'); \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/platform/V1.2__dynamic_api.sql b/xingyun-api/src/main/resources/db/migration/platform/V1.2__dynamic_api.sql new file mode 100644 index 0000000..479c2db --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/platform/V1.2__dynamic_api.sql @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS `magic_api_file`; +CREATE TABLE `magic_api_file` ( + `file_path` varchar(512) NOT NULL, + `file_content` mediumtext, + PRIMARY KEY (`file_path`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +DROP TABLE IF EXISTS `magic_api_file_backup`; +CREATE TABLE `magic_api_file_backup` ( + `id` varchar(32) NOT NULL COMMENT '原对象ID', + `create_date` bigint(13) NOT NULL COMMENT '备份时间', + `tag` varchar(32) DEFAULT NULL COMMENT '标签', + `type` varchar(32) DEFAULT NULL COMMENT '类型', + `name` varchar(64) DEFAULT NULL COMMENT '原名称', + `content` blob COMMENT '备份内容', + `create_by` varchar(64) DEFAULT NULL COMMENT '操作人', + PRIMARY KEY (`id`,`create_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/platform/V1.3__update_qrtz_details.sql b/xingyun-api/src/main/resources/db/migration/platform/V1.3__update_qrtz_details.sql new file mode 100644 index 0000000..f54b633 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/platform/V1.3__update_qrtz_details.sql @@ -0,0 +1 @@ +UPDATE `qrtz_job_details` SET `JOB_CLASS_NAME` = 'com.lframework.xingyun.template.inner.config.OpLogTimerConfiguration$OpLogClearJob' WHERE `qrtz_job_details`.`SCHED_NAME` = 'quartzScheduler' AND `qrtz_job_details`.`JOB_NAME` = 'OP_LOG_TIMER' AND `qrtz_job_details`.`JOB_GROUP` = 'OP_LOG_TIMER_GROUP'; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/platform/V1.4__v3.sql b/xingyun-api/src/main/resources/db/migration/platform/V1.4__v3.sql new file mode 100644 index 0000000..f598d81 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/platform/V1.4__v3.sql @@ -0,0 +1 @@ +UPDATE `tenant` SET jdbc_password = '24590d72bfb4d71ccbc533570aa9627b' WHERE jdbc_password = '123456'; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.0__init.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.0__init.sql new file mode 100644 index 0000000..4250d19 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.0__init.sql @@ -0,0 +1,6806 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for base_data_customer +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_customer`; +CREATE TABLE `base_data_customer` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `mnemonic_code` varchar(20) NOT NULL COMMENT '助记码', + `contact` varchar(100) DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) DEFAULT NULL COMMENT '联系电话', + `email` varchar(100) DEFAULT NULL COMMENT '电子邮箱', + `zip_code` varchar(20) DEFAULT NULL COMMENT '邮编', + `fax` varchar(100) DEFAULT NULL COMMENT '传真', + `city_id` varchar(32) DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) DEFAULT NULL COMMENT '地址', + `receiver` varchar(100) DEFAULT NULL COMMENT '收货人', + `receive_telephone` varchar(20) DEFAULT NULL COMMENT '收货手机号', + `receive_address` varchar(200) DEFAULT NULL COMMENT '收货地址', + `settle_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '结算方式', + `credit_code` varchar(100) DEFAULT NULL COMMENT '统一社会信用代码', + `tax_identify_no` varchar(100) DEFAULT NULL COMMENT '纳税人识别号', + `bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行', + `account_name` varchar(100) DEFAULT NULL COMMENT '户名', + `account_no` varchar(100) DEFAULT NULL COMMENT '银行账号', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户'; + +-- ---------------------------- +-- Records of base_data_customer +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_member +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_member`; +CREATE TABLE `base_data_member` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `gender` tinyint(3) NOT NULL DEFAULT '0' COMMENT '性别', + `telephone` varchar(20) DEFAULT NULL COMMENT '联系电话', + `email` varchar(100) DEFAULT NULL COMMENT '电子邮箱', + `birthday` date DEFAULT NULL COMMENT '出生日期', + `join_day` date NOT NULL COMMENT '入会日期', + `shop_id` varchar(32) DEFAULT NULL COMMENT '所属门店', + `guider_id` varchar(32) DEFAULT NULL COMMENT '所属导购', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + UNIQUE KEY `telephone` (`telephone`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员'; + +-- ---------------------------- +-- Records of base_data_member +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product`; +CREATE TABLE `base_data_product` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(100) NOT NULL COMMENT '名称', + `short_name` varchar(100) DEFAULT NULL COMMENT '简称', + `sku_code` varchar(100) NOT NULL COMMENT 'SKU', + `external_code` varchar(100) DEFAULT NULL COMMENT '外部编号', + `category_id` varchar(32) NOT NULL COMMENT '类目ID', + `brand_id` varchar(32) NOT NULL COMMENT '品牌ID', + `tax_rate` decimal(16,2) NOT NULL COMMENT '进项税率(%)', + `sale_tax_rate` decimal(16,2) NOT NULL COMMENT '销项税率', + `spec` varchar(20) DEFAULT NULL COMMENT '规格', + `unit` varchar(20) DEFAULT NULL COMMENT '单位', + `available` tinyint(1) NOT NULL COMMENT '状态', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) USING BTREE, + UNIQUE KEY `sku_code` (`sku_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品'; + +-- ---------------------------- +-- Records of base_data_product +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_brand +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_brand`; +CREATE TABLE `base_data_product_brand` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `short_name` varchar(20) DEFAULT '' COMMENT '简称', + `logo` longtext COMMENT 'logo', + `introduction` varchar(400) NOT NULL DEFAULT '' COMMENT '简介', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品品牌'; + +-- ---------------------------- +-- Records of base_data_product_brand +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_category +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_category`; +CREATE TABLE `base_data_product_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(100) NOT NULL COMMENT '名称', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父级ID', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品类目'; + +-- ---------------------------- +-- Records of base_data_product_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_category_property +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_category_property`; +CREATE TABLE `base_data_product_category_property` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `property_id` varchar(32) NOT NULL COMMENT '商品属性ID', + `category_id` varchar(32) NOT NULL COMMENT '商品类目ID', + PRIMARY KEY (`id`), + UNIQUE KEY `property_id` (`property_id`,`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品类目和商品属性关系表'; + +-- ---------------------------- +-- Records of base_data_product_category_property +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_property +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_property`; +CREATE TABLE `base_data_product_property` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `is_required` tinyint(1) NOT NULL COMMENT '是否必填', + `column_type` tinyint(3) NOT NULL COMMENT '录入类型', + `column_data_type` tinyint(3) DEFAULT NULL COMMENT '数据类型', + `property_type` tinyint(3) NOT NULL COMMENT '属性类别', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品属性'; + +-- ---------------------------- +-- Records of base_data_product_property +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_property_item +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_property_item`; +CREATE TABLE `base_data_product_property_item` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `property_id` varchar(32) NOT NULL COMMENT '属性ID', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `property_id` (`property_id`,`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品属性值'; + +-- ---------------------------- +-- Records of base_data_product_property_item +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_property_relation +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_property_relation`; +CREATE TABLE `base_data_product_property_relation` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `property_id` varchar(32) NOT NULL COMMENT '商品属性ID', + `property_item_id` varchar(32) DEFAULT NULL COMMENT '属性值ID', + `property_text` varchar(100) DEFAULT NULL COMMENT '商品属性值', + PRIMARY KEY (`id`), + KEY `product_id` (`product_id`,`property_id`,`property_item_id`) USING BTREE, + KEY `property_id` (`property_id`,`property_item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品和商品属性关系表'; + +-- ---------------------------- +-- Records of base_data_product_property_relation +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_purchase +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_purchase`; +CREATE TABLE `base_data_product_purchase` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `price` decimal(24,2) NOT NULL COMMENT '采购价', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品采购价'; + +-- ---------------------------- +-- Records of base_data_product_purchase +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_retail +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_retail`; +CREATE TABLE `base_data_product_retail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `price` decimal(24,2) NOT NULL COMMENT '零售价', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品零售价'; + +-- ---------------------------- +-- Records of base_data_product_retail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_product_sale +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_product_sale`; +CREATE TABLE `base_data_product_sale` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `price` decimal(24,2) NOT NULL COMMENT '销售价', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品销售价'; + +-- ---------------------------- +-- Records of base_data_product_sale +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_store_center +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_store_center`; +CREATE TABLE `base_data_store_center` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `contact` varchar(100) DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) DEFAULT NULL COMMENT '联系人手机号码', + `city_id` varchar(32) DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) DEFAULT NULL COMMENT '地址', + `people_num` int(11) DEFAULT NULL COMMENT '仓库人数', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='仓库'; + +-- ---------------------------- +-- Records of base_data_store_center +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for base_data_supplier +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_supplier`; +CREATE TABLE `base_data_supplier` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `mnemonic_code` varchar(20) NOT NULL COMMENT '助记码', + `contact` varchar(100) DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) DEFAULT NULL COMMENT '联系电话', + `email` varchar(100) DEFAULT NULL COMMENT '电子邮箱', + `zip_code` varchar(20) DEFAULT NULL COMMENT '邮编', + `fax` varchar(100) DEFAULT NULL COMMENT '传真', + `city_id` varchar(32) DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) DEFAULT NULL COMMENT '地址', + `delivery_address` varchar(200) DEFAULT NULL COMMENT '发货地址', + `delivery_cycle` int(11) DEFAULT NULL COMMENT '发货周期(天)', + `manage_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '经营方式', + `settle_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '结算方式', + `credit_code` varchar(100) DEFAULT NULL COMMENT '统一社会信用代码', + `tax_identify_no` varchar(100) DEFAULT NULL COMMENT '纳税人识别号', + `bank_name` varchar(100) DEFAULT NULL COMMENT '开户银行', + `account_name` varchar(100) DEFAULT NULL COMMENT '户名', + `account_no` varchar(100) DEFAULT NULL COMMENT '银行账号', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商'; + +-- ---------------------------- +-- Records of base_data_supplier +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_check_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_check_sheet`; +CREATE TABLE `customer_settle_check_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `customer_id` varchar(32) NOT NULL COMMENT '客户ID', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `total_pay_amount` decimal(24,2) NOT NULL COMMENT '应付金额', + `total_payed_amount` decimal(24,2) NOT NULL COMMENT '已付金额', + `total_discount_amount` decimal(24,2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `customer_id` (`customer_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户对账单'; + +-- ---------------------------- +-- Records of customer_settle_check_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_check_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_check_sheet_detail`; +CREATE TABLE `customer_settle_check_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '对账单ID', + `biz_id` varchar(32) NOT NULL COMMENT '单据ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `calc_type` tinyint(3) NOT NULL COMMENT '计算类型', + `pay_amount` decimal(24,2) NOT NULL COMMENT '应付金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `sheet_id` (`sheet_id`,`biz_id`) USING BTREE, + KEY `biz_id` (`biz_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户对账单明细'; + +-- ---------------------------- +-- Records of customer_settle_check_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_fee_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_fee_sheet`; +CREATE TABLE `customer_settle_fee_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `customer_id` varchar(32) NOT NULL COMMENT '客户ID', + `sheet_type` tinyint(3) NOT NULL COMMENT '单据类型', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `customer_id` (`customer_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户费用单'; + +-- ---------------------------- +-- Records of customer_settle_fee_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_fee_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_fee_sheet_detail`; +CREATE TABLE `customer_settle_fee_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '费用单ID', + `item_id` varchar(32) NOT NULL COMMENT '项目ID', + `amount` decimal(24,2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `sheet_id` (`sheet_id`,`item_id`) USING BTREE, + KEY `item_id` (`item_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户费用单明细'; + +-- ---------------------------- +-- Records of customer_settle_fee_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_pre_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_pre_sheet`; +CREATE TABLE `customer_settle_pre_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `customer_id` varchar(32) NOT NULL COMMENT '客户ID', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `customer_id` (`customer_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户预付款单'; + +-- ---------------------------- +-- Records of customer_settle_pre_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_pre_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_pre_sheet_detail`; +CREATE TABLE `customer_settle_pre_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '预付款单ID', + `item_id` varchar(32) NOT NULL COMMENT '项目ID', + `amount` decimal(24,2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `sheet_id` (`sheet_id`,`item_id`) USING BTREE, + KEY `item_id` (`item_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户预付款单明细'; + +-- ---------------------------- +-- Records of customer_settle_pre_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_sheet`; +CREATE TABLE `customer_settle_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `customer_id` varchar(32) NOT NULL COMMENT '客户ID', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `total_discount_amount` decimal(24,2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `customer_id` (`customer_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户结算单'; + +-- ---------------------------- +-- Records of customer_settle_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for customer_settle_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `customer_settle_sheet_detail`; +CREATE TABLE `customer_settle_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '结算单ID', + `biz_id` varchar(32) NOT NULL COMMENT '单据ID', + `pay_amount` decimal(24,2) NOT NULL COMMENT '实付金额', + `discount_amount` decimal(24,2) NOT NULL COMMENT '优惠金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `sheet_id` (`sheet_id`,`biz_id`) USING BTREE, + KEY `biz_id` (`biz_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户结算单明细'; + +-- ---------------------------- +-- Records of customer_settle_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for dic_city +-- ---------------------------- +DROP TABLE IF EXISTS `dic_city`; +CREATE TABLE `dic_city` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父级ID', + `level` int(11) NOT NULL COMMENT '层级', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `parent_id` (`parent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='地区字典表'; + +-- ---------------------------- +-- Records of dic_city +-- ---------------------------- +BEGIN; +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('11', '11', '北京市', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1101', '1101', '市辖区', '11', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110101', '110101', '东城区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110102', '110102', '西城区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110105', '110105', '朝阳区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110106', '110106', '丰台区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110107', '110107', '石景山区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110108', '110108', '海淀区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110109', '110109', '门头沟区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110111', '110111', '房山区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110112', '110112', '通州区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110113', '110113', '顺义区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110114', '110114', '昌平区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110115', '110115', '大兴区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110116', '110116', '怀柔区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110117', '110117', '平谷区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110118', '110118', '密云区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('110119', '110119', '延庆区', '1101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('12', '12', '天津市', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1201', '1201', '市辖区', '12', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120101', '120101', '和平区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120102', '120102', '河东区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120103', '120103', '河西区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120104', '120104', '南开区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120105', '120105', '河北区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120106', '120106', '红桥区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120110', '120110', '东丽区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120111', '120111', '西青区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120112', '120112', '津南区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120113', '120113', '北辰区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120114', '120114', '武清区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120115', '120115', '宝坻区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120116', '120116', '滨海新区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120117', '120117', '宁河区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120118', '120118', '静海区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('120119', '120119', '蓟州区', '1201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('13', '13', '河北省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1301', '1301', '石家庄市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130102', '130102', '长安区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130104', '130104', '桥西区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130105', '130105', '新华区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130107', '130107', '井陉矿区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130108', '130108', '裕华区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130109', '130109', '藁城区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130110', '130110', '鹿泉区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130111', '130111', '栾城区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130121', '130121', '井陉县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130123', '130123', '正定县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130125', '130125', '行唐县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130126', '130126', '灵寿县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130127', '130127', '高邑县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130128', '130128', '深泽县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130129', '130129', '赞皇县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130130', '130130', '无极县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130131', '130131', '平山县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130132', '130132', '元氏县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130133', '130133', '赵县', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130171', '130171', '石家庄高新技术产业开发区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130172', '130172', '石家庄循环化工园区', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130181', '130181', '辛集市', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130183', '130183', '晋州市', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130184', '130184', '新乐市', '1301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1302', '1302', '唐山市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130202', '130202', '路南区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130203', '130203', '路北区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130204', '130204', '古冶区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130205', '130205', '开平区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130207', '130207', '丰南区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130208', '130208', '丰润区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130209', '130209', '曹妃甸区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130224', '130224', '滦南县', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130225', '130225', '乐亭县', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130227', '130227', '迁西县', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130229', '130229', '玉田县', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130271', '130271', '河北唐山芦台经济开发区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130272', '130272', '唐山市汉沽管理区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130273', '130273', '唐山高新技术产业开发区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130274', '130274', '河北唐山海港经济开发区', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130281', '130281', '遵化市', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130283', '130283', '迁安市', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130284', '130284', '滦州市', '1302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1303', '1303', '秦皇岛市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130302', '130302', '海港区', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130303', '130303', '山海关区', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130304', '130304', '北戴河区', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130306', '130306', '抚宁区', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130321', '130321', '青龙满族自治县', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130322', '130322', '昌黎县', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130324', '130324', '卢龙县', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130371', '130371', '秦皇岛市经济技术开发区', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130372', '130372', '北戴河新区', '1303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1304', '1304', '邯郸市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130402', '130402', '邯山区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130403', '130403', '丛台区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130404', '130404', '复兴区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130406', '130406', '峰峰矿区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130407', '130407', '肥乡区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130408', '130408', '永年区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130423', '130423', '临漳县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130424', '130424', '成安县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130425', '130425', '大名县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130426', '130426', '涉县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130427', '130427', '磁县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130430', '130430', '邱县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130431', '130431', '鸡泽县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130432', '130432', '广平县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130433', '130433', '馆陶县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130434', '130434', '魏县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130435', '130435', '曲周县', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130471', '130471', '邯郸经济技术开发区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130473', '130473', '邯郸冀南新区', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130481', '130481', '武安市', '1304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1305', '1305', '邢台市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130502', '130502', '襄都区', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130503', '130503', '信都区', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130505', '130505', '任泽区', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130506', '130506', '南和区', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130522', '130522', '临城县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130523', '130523', '内丘县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130524', '130524', '柏乡县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130525', '130525', '隆尧县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130528', '130528', '宁晋县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130529', '130529', '巨鹿县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130530', '130530', '新河县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130531', '130531', '广宗县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130532', '130532', '平乡县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130533', '130533', '威县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130534', '130534', '清河县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130535', '130535', '临西县', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130571', '130571', '河北邢台经济开发区', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130581', '130581', '南宫市', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130582', '130582', '沙河市', '1305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1306', '1306', '保定市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130602', '130602', '竞秀区', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130606', '130606', '莲池区', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130607', '130607', '满城区', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130608', '130608', '清苑区', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130609', '130609', '徐水区', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130623', '130623', '涞水县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130624', '130624', '阜平县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130626', '130626', '定兴县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130627', '130627', '唐县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130628', '130628', '高阳县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130629', '130629', '容城县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130630', '130630', '涞源县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130631', '130631', '望都县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130632', '130632', '安新县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130633', '130633', '易县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130634', '130634', '曲阳县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130635', '130635', '蠡县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130636', '130636', '顺平县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130637', '130637', '博野县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130638', '130638', '雄县', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130671', '130671', '保定高新技术产业开发区', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130672', '130672', '保定白沟新城', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130681', '130681', '涿州市', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130682', '130682', '定州市', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130683', '130683', '安国市', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130684', '130684', '高碑店市', '1306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1307', '1307', '张家口市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130702', '130702', '桥东区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130703', '130703', '桥西区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130705', '130705', '宣化区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130706', '130706', '下花园区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130708', '130708', '万全区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130709', '130709', '崇礼区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130722', '130722', '张北县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130723', '130723', '康保县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130724', '130724', '沽源县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130725', '130725', '尚义县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130726', '130726', '蔚县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130727', '130727', '阳原县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130728', '130728', '怀安县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130730', '130730', '怀来县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130731', '130731', '涿鹿县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130732', '130732', '赤城县', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130771', '130771', '张家口经济开发区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130772', '130772', '张家口市察北管理区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130773', '130773', '张家口市塞北管理区', '1307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1308', '1308', '承德市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130802', '130802', '双桥区', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130803', '130803', '双滦区', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130804', '130804', '鹰手营子矿区', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130821', '130821', '承德县', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130822', '130822', '兴隆县', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130824', '130824', '滦平县', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130825', '130825', '隆化县', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130826', '130826', '丰宁满族自治县', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130827', '130827', '宽城满族自治县', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130828', '130828', '围场满族蒙古族自治县', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130871', '130871', '承德高新技术产业开发区', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130881', '130881', '平泉市', '1308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1309', '1309', '沧州市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130902', '130902', '新华区', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130903', '130903', '运河区', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130921', '130921', '沧县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130922', '130922', '青县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130923', '130923', '东光县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130924', '130924', '海兴县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130925', '130925', '盐山县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130926', '130926', '肃宁县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130927', '130927', '南皮县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130928', '130928', '吴桥县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130929', '130929', '献县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130930', '130930', '孟村回族自治县', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130971', '130971', '河北沧州经济开发区', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130972', '130972', '沧州高新技术产业开发区', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130973', '130973', '沧州渤海新区', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130981', '130981', '泊头市', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130982', '130982', '任丘市', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130983', '130983', '黄骅市', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('130984', '130984', '河间市', '1309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1310', '1310', '廊坊市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131002', '131002', '安次区', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131003', '131003', '广阳区', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131022', '131022', '固安县', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131023', '131023', '永清县', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131024', '131024', '香河县', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131025', '131025', '大城县', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131026', '131026', '文安县', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131028', '131028', '大厂回族自治县', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131071', '131071', '廊坊经济技术开发区', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131081', '131081', '霸州市', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131082', '131082', '三河市', '1310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1311', '1311', '衡水市', '13', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131102', '131102', '桃城区', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131103', '131103', '冀州区', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131121', '131121', '枣强县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131122', '131122', '武邑县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131123', '131123', '武强县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131124', '131124', '饶阳县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131125', '131125', '安平县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131126', '131126', '故城县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131127', '131127', '景县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131128', '131128', '阜城县', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131171', '131171', '河北衡水高新技术产业开发区', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131172', '131172', '衡水滨湖新区', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('131182', '131182', '深州市', '1311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('14', '14', '山西省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1401', '1401', '太原市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140105', '140105', '小店区', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140106', '140106', '迎泽区', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140107', '140107', '杏花岭区', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140108', '140108', '尖草坪区', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140109', '140109', '万柏林区', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140110', '140110', '晋源区', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140121', '140121', '清徐县', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140122', '140122', '阳曲县', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140123', '140123', '娄烦县', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140171', '140171', '山西转型综合改革示范区', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140181', '140181', '古交市', '1401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1402', '1402', '大同市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140212', '140212', '新荣区', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140213', '140213', '平城区', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140214', '140214', '云冈区', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140215', '140215', '云州区', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140221', '140221', '阳高县', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140222', '140222', '天镇县', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140223', '140223', '广灵县', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140224', '140224', '灵丘县', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140225', '140225', '浑源县', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140226', '140226', '左云县', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140271', '140271', '山西大同经济开发区', '1402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1403', '1403', '阳泉市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140302', '140302', '城区', '1403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140303', '140303', '矿区', '1403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140311', '140311', '郊区', '1403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140321', '140321', '平定县', '1403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140322', '140322', '盂县', '1403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1404', '1404', '长治市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140403', '140403', '潞州区', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140404', '140404', '上党区', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140405', '140405', '屯留区', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140406', '140406', '潞城区', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140423', '140423', '襄垣县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140425', '140425', '平顺县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140426', '140426', '黎城县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140427', '140427', '壶关县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140428', '140428', '长子县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140429', '140429', '武乡县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140430', '140430', '沁县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140431', '140431', '沁源县', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140471', '140471', '山西长治高新技术产业园区', '1404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1405', '1405', '晋城市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140502', '140502', '城区', '1405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140521', '140521', '沁水县', '1405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140522', '140522', '阳城县', '1405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140524', '140524', '陵川县', '1405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140525', '140525', '泽州县', '1405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140581', '140581', '高平市', '1405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1406', '1406', '朔州市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140602', '140602', '朔城区', '1406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140603', '140603', '平鲁区', '1406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140621', '140621', '山阴县', '1406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140622', '140622', '应县', '1406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140623', '140623', '右玉县', '1406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140671', '140671', '山西朔州经济开发区', '1406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140681', '140681', '怀仁市', '1406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1407', '1407', '晋中市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140702', '140702', '榆次区', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140703', '140703', '太谷区', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140721', '140721', '榆社县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140722', '140722', '左权县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140723', '140723', '和顺县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140724', '140724', '昔阳县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140725', '140725', '寿阳县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140727', '140727', '祁县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140728', '140728', '平遥县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140729', '140729', '灵石县', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140781', '140781', '介休市', '1407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1408', '1408', '运城市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140802', '140802', '盐湖区', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140821', '140821', '临猗县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140822', '140822', '万荣县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140823', '140823', '闻喜县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140824', '140824', '稷山县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140825', '140825', '新绛县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140826', '140826', '绛县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140827', '140827', '垣曲县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140828', '140828', '夏县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140829', '140829', '平陆县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140830', '140830', '芮城县', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140881', '140881', '永济市', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140882', '140882', '河津市', '1408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1409', '1409', '忻州市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140902', '140902', '忻府区', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140921', '140921', '定襄县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140922', '140922', '五台县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140923', '140923', '代县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140924', '140924', '繁峙县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140925', '140925', '宁武县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140926', '140926', '静乐县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140927', '140927', '神池县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140928', '140928', '五寨县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140929', '140929', '岢岚县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140930', '140930', '河曲县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140931', '140931', '保德县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140932', '140932', '偏关县', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140971', '140971', '五台山风景名胜区', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('140981', '140981', '原平市', '1409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1410', '1410', '临汾市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141002', '141002', '尧都区', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141021', '141021', '曲沃县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141022', '141022', '翼城县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141023', '141023', '襄汾县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141024', '141024', '洪洞县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141025', '141025', '古县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141026', '141026', '安泽县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141027', '141027', '浮山县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141028', '141028', '吉县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141029', '141029', '乡宁县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141030', '141030', '大宁县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141031', '141031', '隰县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141032', '141032', '永和县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141033', '141033', '蒲县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141034', '141034', '汾西县', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141081', '141081', '侯马市', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141082', '141082', '霍州市', '1410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1411', '1411', '吕梁市', '14', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141102', '141102', '离石区', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141121', '141121', '文水县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141122', '141122', '交城县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141123', '141123', '兴县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141124', '141124', '临县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141125', '141125', '柳林县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141126', '141126', '石楼县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141127', '141127', '岚县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141128', '141128', '方山县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141129', '141129', '中阳县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141130', '141130', '交口县', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141181', '141181', '孝义市', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('141182', '141182', '汾阳市', '1411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('15', '15', '内蒙古自治区', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1501', '1501', '呼和浩特市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150102', '150102', '新城区', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150103', '150103', '回民区', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150104', '150104', '玉泉区', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150105', '150105', '赛罕区', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150121', '150121', '土默特左旗', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150122', '150122', '托克托县', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150123', '150123', '和林格尔县', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150124', '150124', '清水河县', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150125', '150125', '武川县', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150172', '150172', '呼和浩特经济技术开发区', '1501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1502', '1502', '包头市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150202', '150202', '东河区', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150203', '150203', '昆都仑区', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150204', '150204', '青山区', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150205', '150205', '石拐区', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150206', '150206', '白云鄂博矿区', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150207', '150207', '九原区', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150221', '150221', '土默特右旗', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150222', '150222', '固阳县', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150223', '150223', '达尔罕茂明安联合旗', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150271', '150271', '包头稀土高新技术产业开发区', '1502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1503', '1503', '乌海市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150302', '150302', '海勃湾区', '1503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150303', '150303', '海南区', '1503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150304', '150304', '乌达区', '1503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1504', '1504', '赤峰市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150402', '150402', '红山区', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150403', '150403', '元宝山区', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150404', '150404', '松山区', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150421', '150421', '阿鲁科尔沁旗', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150422', '150422', '巴林左旗', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150423', '150423', '巴林右旗', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150424', '150424', '林西县', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150425', '150425', '克什克腾旗', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150426', '150426', '翁牛特旗', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150428', '150428', '喀喇沁旗', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150429', '150429', '宁城县', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150430', '150430', '敖汉旗', '1504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1505', '1505', '通辽市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150502', '150502', '科尔沁区', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150521', '150521', '科尔沁左翼中旗', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150522', '150522', '科尔沁左翼后旗', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150523', '150523', '开鲁县', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150524', '150524', '库伦旗', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150525', '150525', '奈曼旗', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150526', '150526', '扎鲁特旗', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150571', '150571', '通辽经济技术开发区', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150581', '150581', '霍林郭勒市', '1505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1506', '1506', '鄂尔多斯市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150602', '150602', '东胜区', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150603', '150603', '康巴什区', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150621', '150621', '达拉特旗', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150622', '150622', '准格尔旗', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150623', '150623', '鄂托克前旗', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150624', '150624', '鄂托克旗', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150625', '150625', '杭锦旗', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150626', '150626', '乌审旗', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150627', '150627', '伊金霍洛旗', '1506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1507', '1507', '呼伦贝尔市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150702', '150702', '海拉尔区', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150703', '150703', '扎赉诺尔区', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150721', '150721', '阿荣旗', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150722', '150722', '莫力达瓦达斡尔族自治旗', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150723', '150723', '鄂伦春自治旗', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150724', '150724', '鄂温克族自治旗', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150725', '150725', '陈巴尔虎旗', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150726', '150726', '新巴尔虎左旗', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150727', '150727', '新巴尔虎右旗', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150781', '150781', '满洲里市', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150782', '150782', '牙克石市', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150783', '150783', '扎兰屯市', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150784', '150784', '额尔古纳市', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150785', '150785', '根河市', '1507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1508', '1508', '巴彦淖尔市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150802', '150802', '临河区', '1508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150821', '150821', '五原县', '1508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150822', '150822', '磴口县', '1508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150823', '150823', '乌拉特前旗', '1508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150824', '150824', '乌拉特中旗', '1508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150825', '150825', '乌拉特后旗', '1508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150826', '150826', '杭锦后旗', '1508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1509', '1509', '乌兰察布市', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150902', '150902', '集宁区', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150921', '150921', '卓资县', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150922', '150922', '化德县', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150923', '150923', '商都县', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150924', '150924', '兴和县', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150925', '150925', '凉城县', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150926', '150926', '察哈尔右翼前旗', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150927', '150927', '察哈尔右翼中旗', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150928', '150928', '察哈尔右翼后旗', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150929', '150929', '四子王旗', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('150981', '150981', '丰镇市', '1509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1522', '1522', '兴安盟', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152201', '152201', '乌兰浩特市', '1522', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152202', '152202', '阿尔山市', '1522', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152221', '152221', '科尔沁右翼前旗', '1522', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152222', '152222', '科尔沁右翼中旗', '1522', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152223', '152223', '扎赉特旗', '1522', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152224', '152224', '突泉县', '1522', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1525', '1525', '锡林郭勒盟', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152501', '152501', '二连浩特市', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152502', '152502', '锡林浩特市', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152522', '152522', '阿巴嘎旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152523', '152523', '苏尼特左旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152524', '152524', '苏尼特右旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152525', '152525', '东乌珠穆沁旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152526', '152526', '西乌珠穆沁旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152527', '152527', '太仆寺旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152528', '152528', '镶黄旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152529', '152529', '正镶白旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152530', '152530', '正蓝旗', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152531', '152531', '多伦县', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152571', '152571', '乌拉盖管委会', '1525', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('1529', '1529', '阿拉善盟', '15', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152921', '152921', '阿拉善左旗', '1529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152922', '152922', '阿拉善右旗', '1529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152923', '152923', '额济纳旗', '1529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('152971', '152971', '内蒙古阿拉善经济开发区', '1529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('21', '21', '辽宁省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2101', '2101', '沈阳市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210102', '210102', '和平区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210103', '210103', '沈河区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210104', '210104', '大东区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210105', '210105', '皇姑区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210106', '210106', '铁西区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210111', '210111', '苏家屯区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210112', '210112', '浑南区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210113', '210113', '沈北新区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210114', '210114', '于洪区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210115', '210115', '辽中区', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210123', '210123', '康平县', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210124', '210124', '法库县', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210181', '210181', '新民市', '2101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2102', '2102', '大连市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210202', '210202', '中山区', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210203', '210203', '西岗区', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210204', '210204', '沙河口区', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210211', '210211', '甘井子区', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210212', '210212', '旅顺口区', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210213', '210213', '金州区', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210214', '210214', '普兰店区', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210224', '210224', '长海县', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210281', '210281', '瓦房店市', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210283', '210283', '庄河市', '2102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2103', '2103', '鞍山市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210302', '210302', '铁东区', '2103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210303', '210303', '铁西区', '2103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210304', '210304', '立山区', '2103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210311', '210311', '千山区', '2103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210321', '210321', '台安县', '2103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210323', '210323', '岫岩满族自治县', '2103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210381', '210381', '海城市', '2103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2104', '2104', '抚顺市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210402', '210402', '新抚区', '2104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210403', '210403', '东洲区', '2104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210404', '210404', '望花区', '2104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210411', '210411', '顺城区', '2104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210421', '210421', '抚顺县', '2104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210422', '210422', '新宾满族自治县', '2104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210423', '210423', '清原满族自治县', '2104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2105', '2105', '本溪市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210502', '210502', '平山区', '2105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210503', '210503', '溪湖区', '2105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210504', '210504', '明山区', '2105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210505', '210505', '南芬区', '2105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210521', '210521', '本溪满族自治县', '2105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210522', '210522', '桓仁满族自治县', '2105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2106', '2106', '丹东市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210602', '210602', '元宝区', '2106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210603', '210603', '振兴区', '2106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210604', '210604', '振安区', '2106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210624', '210624', '宽甸满族自治县', '2106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210681', '210681', '东港市', '2106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210682', '210682', '凤城市', '2106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2107', '2107', '锦州市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210702', '210702', '古塔区', '2107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210703', '210703', '凌河区', '2107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210711', '210711', '太和区', '2107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210726', '210726', '黑山县', '2107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210727', '210727', '义县', '2107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210781', '210781', '凌海市', '2107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210782', '210782', '北镇市', '2107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2108', '2108', '营口市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210802', '210802', '站前区', '2108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210803', '210803', '西市区', '2108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210804', '210804', '鲅鱼圈区', '2108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210811', '210811', '老边区', '2108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210881', '210881', '盖州市', '2108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210882', '210882', '大石桥市', '2108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2109', '2109', '阜新市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210902', '210902', '海州区', '2109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210903', '210903', '新邱区', '2109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210904', '210904', '太平区', '2109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210905', '210905', '清河门区', '2109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210911', '210911', '细河区', '2109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210921', '210921', '阜新蒙古族自治县', '2109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('210922', '210922', '彰武县', '2109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2110', '2110', '辽阳市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211002', '211002', '白塔区', '2110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211003', '211003', '文圣区', '2110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211004', '211004', '宏伟区', '2110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211005', '211005', '弓长岭区', '2110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211011', '211011', '太子河区', '2110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211021', '211021', '辽阳县', '2110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211081', '211081', '灯塔市', '2110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2111', '2111', '盘锦市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211102', '211102', '双台子区', '2111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211103', '211103', '兴隆台区', '2111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211104', '211104', '大洼区', '2111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211122', '211122', '盘山县', '2111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2112', '2112', '铁岭市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211202', '211202', '银州区', '2112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211204', '211204', '清河区', '2112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211221', '211221', '铁岭县', '2112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211223', '211223', '西丰县', '2112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211224', '211224', '昌图县', '2112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211281', '211281', '调兵山市', '2112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211282', '211282', '开原市', '2112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2113', '2113', '朝阳市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211302', '211302', '双塔区', '2113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211303', '211303', '龙城区', '2113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211321', '211321', '朝阳县', '2113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211322', '211322', '建平县', '2113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211324', '211324', '喀喇沁左翼蒙古族自治县', '2113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211381', '211381', '北票市', '2113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211382', '211382', '凌源市', '2113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2114', '2114', '葫芦岛市', '21', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211402', '211402', '连山区', '2114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211403', '211403', '龙港区', '2114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211404', '211404', '南票区', '2114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211421', '211421', '绥中县', '2114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211422', '211422', '建昌县', '2114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('211481', '211481', '兴城市', '2114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('22', '22', '吉林省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2201', '2201', '长春市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220102', '220102', '南关区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220103', '220103', '宽城区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220104', '220104', '朝阳区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220105', '220105', '二道区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220106', '220106', '绿园区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220112', '220112', '双阳区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220113', '220113', '九台区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220122', '220122', '农安县', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220171', '220171', '长春经济技术开发区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220172', '220172', '长春净月高新技术产业开发区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220173', '220173', '长春高新技术产业开发区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220174', '220174', '长春汽车经济技术开发区', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220182', '220182', '榆树市', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220183', '220183', '德惠市', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220184', '220184', '公主岭市', '2201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2202', '2202', '吉林市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220202', '220202', '昌邑区', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220203', '220203', '龙潭区', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220204', '220204', '船营区', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220211', '220211', '丰满区', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220221', '220221', '永吉县', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220271', '220271', '吉林经济开发区', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220272', '220272', '吉林高新技术产业开发区', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220273', '220273', '吉林中国新加坡食品区', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220281', '220281', '蛟河市', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220282', '220282', '桦甸市', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220283', '220283', '舒兰市', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220284', '220284', '磐石市', '2202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2203', '2203', '四平市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220302', '220302', '铁西区', '2203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220303', '220303', '铁东区', '2203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220322', '220322', '梨树县', '2203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220323', '220323', '伊通满族自治县', '2203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220382', '220382', '双辽市', '2203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2204', '2204', '辽源市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220402', '220402', '龙山区', '2204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220403', '220403', '西安区', '2204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220421', '220421', '东丰县', '2204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220422', '220422', '东辽县', '2204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2205', '2205', '通化市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220502', '220502', '东昌区', '2205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220503', '220503', '二道江区', '2205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220521', '220521', '通化县', '2205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220523', '220523', '辉南县', '2205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220524', '220524', '柳河县', '2205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220581', '220581', '梅河口市', '2205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220582', '220582', '集安市', '2205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2206', '2206', '白山市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220602', '220602', '浑江区', '2206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220605', '220605', '江源区', '2206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220621', '220621', '抚松县', '2206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220622', '220622', '靖宇县', '2206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220623', '220623', '长白朝鲜族自治县', '2206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220681', '220681', '临江市', '2206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2207', '2207', '松原市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220702', '220702', '宁江区', '2207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220721', '220721', '前郭尔罗斯蒙古族自治县', '2207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220722', '220722', '长岭县', '2207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220723', '220723', '乾安县', '2207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220771', '220771', '吉林松原经济开发区', '2207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220781', '220781', '扶余市', '2207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2208', '2208', '白城市', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220802', '220802', '洮北区', '2208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220821', '220821', '镇赉县', '2208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220822', '220822', '通榆县', '2208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220871', '220871', '吉林白城经济开发区', '2208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220881', '220881', '洮南市', '2208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('220882', '220882', '大安市', '2208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2224', '2224', '延边朝鲜族自治州', '22', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222401', '222401', '延吉市', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222402', '222402', '图们市', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222403', '222403', '敦化市', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222404', '222404', '珲春市', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222405', '222405', '龙井市', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222406', '222406', '和龙市', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222424', '222424', '汪清县', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('222426', '222426', '安图县', '2224', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('23', '23', '黑龙江省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2301', '2301', '哈尔滨市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230102', '230102', '道里区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230103', '230103', '南岗区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230104', '230104', '道外区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230108', '230108', '平房区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230109', '230109', '松北区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230110', '230110', '香坊区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230111', '230111', '呼兰区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230112', '230112', '阿城区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230113', '230113', '双城区', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230123', '230123', '依兰县', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230124', '230124', '方正县', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230125', '230125', '宾县', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230126', '230126', '巴彦县', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230127', '230127', '木兰县', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230128', '230128', '通河县', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230129', '230129', '延寿县', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230183', '230183', '尚志市', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230184', '230184', '五常市', '2301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2302', '2302', '齐齐哈尔市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230202', '230202', '龙沙区', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230203', '230203', '建华区', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230204', '230204', '铁锋区', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230205', '230205', '昂昂溪区', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230206', '230206', '富拉尔基区', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230207', '230207', '碾子山区', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230208', '230208', '梅里斯达斡尔族区', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230221', '230221', '龙江县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230223', '230223', '依安县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230224', '230224', '泰来县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230225', '230225', '甘南县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230227', '230227', '富裕县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230229', '230229', '克山县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230230', '230230', '克东县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230231', '230231', '拜泉县', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230281', '230281', '讷河市', '2302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2303', '2303', '鸡西市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230302', '230302', '鸡冠区', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230303', '230303', '恒山区', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230304', '230304', '滴道区', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230305', '230305', '梨树区', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230306', '230306', '城子河区', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230307', '230307', '麻山区', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230321', '230321', '鸡东县', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230381', '230381', '虎林市', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230382', '230382', '密山市', '2303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2304', '2304', '鹤岗市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230402', '230402', '向阳区', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230403', '230403', '工农区', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230404', '230404', '南山区', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230405', '230405', '兴安区', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230406', '230406', '东山区', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230407', '230407', '兴山区', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230421', '230421', '萝北县', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230422', '230422', '绥滨县', '2304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2305', '2305', '双鸭山市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230502', '230502', '尖山区', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230503', '230503', '岭东区', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230505', '230505', '四方台区', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230506', '230506', '宝山区', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230521', '230521', '集贤县', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230522', '230522', '友谊县', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230523', '230523', '宝清县', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230524', '230524', '饶河县', '2305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2306', '2306', '大庆市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230602', '230602', '萨尔图区', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230603', '230603', '龙凤区', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230604', '230604', '让胡路区', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230605', '230605', '红岗区', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230606', '230606', '大同区', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230621', '230621', '肇州县', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230622', '230622', '肇源县', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230623', '230623', '林甸县', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230624', '230624', '杜尔伯特蒙古族自治县', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230671', '230671', '大庆高新技术产业开发区', '2306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2307', '2307', '伊春市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230717', '230717', '伊美区', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230718', '230718', '乌翠区', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230719', '230719', '友好区', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230722', '230722', '嘉荫县', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230723', '230723', '汤旺县', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230724', '230724', '丰林县', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230725', '230725', '大箐山县', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230726', '230726', '南岔县', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230751', '230751', '金林区', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230781', '230781', '铁力市', '2307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2308', '2308', '佳木斯市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230803', '230803', '向阳区', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230804', '230804', '前进区', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230805', '230805', '东风区', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230811', '230811', '郊区', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230822', '230822', '桦南县', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230826', '230826', '桦川县', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230828', '230828', '汤原县', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230881', '230881', '同江市', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230882', '230882', '富锦市', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230883', '230883', '抚远市', '2308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2309', '2309', '七台河市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230902', '230902', '新兴区', '2309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230903', '230903', '桃山区', '2309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230904', '230904', '茄子河区', '2309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('230921', '230921', '勃利县', '2309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2310', '2310', '牡丹江市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231002', '231002', '东安区', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231003', '231003', '阳明区', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231004', '231004', '爱民区', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231005', '231005', '西安区', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231025', '231025', '林口县', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231071', '231071', '牡丹江经济技术开发区', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231081', '231081', '绥芬河市', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231083', '231083', '海林市', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231084', '231084', '宁安市', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231085', '231085', '穆棱市', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231086', '231086', '东宁市', '2310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2311', '2311', '黑河市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231102', '231102', '爱辉区', '2311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231123', '231123', '逊克县', '2311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231124', '231124', '孙吴县', '2311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231181', '231181', '北安市', '2311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231182', '231182', '五大连池市', '2311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231183', '231183', '嫩江市', '2311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2312', '2312', '绥化市', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231202', '231202', '北林区', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231221', '231221', '望奎县', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231222', '231222', '兰西县', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231223', '231223', '青冈县', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231224', '231224', '庆安县', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231225', '231225', '明水县', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231226', '231226', '绥棱县', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231281', '231281', '安达市', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231282', '231282', '肇东市', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('231283', '231283', '海伦市', '2312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('2327', '2327', '大兴安岭地区', '23', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('232701', '232701', '漠河市', '2327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('232721', '232721', '呼玛县', '2327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('232722', '232722', '塔河县', '2327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('232761', '232761', '加格达奇区', '2327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('232762', '232762', '松岭区', '2327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('232763', '232763', '新林区', '2327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('232764', '232764', '呼中区', '2327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('31', '31', '上海市', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3101', '3101', '市辖区', '31', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310101', '310101', '黄浦区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310104', '310104', '徐汇区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310105', '310105', '长宁区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310106', '310106', '静安区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310107', '310107', '普陀区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310109', '310109', '虹口区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310110', '310110', '杨浦区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310112', '310112', '闵行区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310113', '310113', '宝山区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310114', '310114', '嘉定区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310115', '310115', '浦东新区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310116', '310116', '金山区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310117', '310117', '松江区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310118', '310118', '青浦区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310120', '310120', '奉贤区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('310151', '310151', '崇明区', '3101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('32', '32', '江苏省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3201', '3201', '南京市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320102', '320102', '玄武区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320104', '320104', '秦淮区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320105', '320105', '建邺区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320106', '320106', '鼓楼区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320111', '320111', '浦口区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320113', '320113', '栖霞区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320114', '320114', '雨花台区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320115', '320115', '江宁区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320116', '320116', '六合区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320117', '320117', '溧水区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320118', '320118', '高淳区', '3201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3202', '3202', '无锡市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320205', '320205', '锡山区', '3202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320206', '320206', '惠山区', '3202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320211', '320211', '滨湖区', '3202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320213', '320213', '梁溪区', '3202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320214', '320214', '新吴区', '3202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320281', '320281', '江阴市', '3202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320282', '320282', '宜兴市', '3202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3203', '3203', '徐州市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320302', '320302', '鼓楼区', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320303', '320303', '云龙区', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320305', '320305', '贾汪区', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320311', '320311', '泉山区', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320312', '320312', '铜山区', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320321', '320321', '丰县', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320322', '320322', '沛县', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320324', '320324', '睢宁县', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320371', '320371', '徐州经济技术开发区', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320381', '320381', '新沂市', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320382', '320382', '邳州市', '3203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3204', '3204', '常州市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320402', '320402', '天宁区', '3204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320404', '320404', '钟楼区', '3204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320411', '320411', '新北区', '3204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320412', '320412', '武进区', '3204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320413', '320413', '金坛区', '3204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320481', '320481', '溧阳市', '3204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3205', '3205', '苏州市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320505', '320505', '虎丘区', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320506', '320506', '吴中区', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320507', '320507', '相城区', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320508', '320508', '姑苏区', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320509', '320509', '吴江区', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320571', '320571', '苏州工业园区', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320581', '320581', '常熟市', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320582', '320582', '张家港市', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320583', '320583', '昆山市', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320585', '320585', '太仓市', '3205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3206', '3206', '南通市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320602', '320602', '崇川区', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320611', '320611', '港闸区', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320612', '320612', '通州区', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320623', '320623', '如东县', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320671', '320671', '南通经济技术开发区', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320681', '320681', '启东市', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320682', '320682', '如皋市', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320684', '320684', '海门市', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320685', '320685', '海安市', '3206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3207', '3207', '连云港市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320703', '320703', '连云区', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320706', '320706', '海州区', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320707', '320707', '赣榆区', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320722', '320722', '东海县', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320723', '320723', '灌云县', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320724', '320724', '灌南县', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320771', '320771', '连云港经济技术开发区', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320772', '320772', '连云港高新技术产业开发区', '3207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3208', '3208', '淮安市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320803', '320803', '淮安区', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320804', '320804', '淮阴区', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320812', '320812', '清江浦区', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320813', '320813', '洪泽区', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320826', '320826', '涟水县', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320830', '320830', '盱眙县', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320831', '320831', '金湖县', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320871', '320871', '淮安经济技术开发区', '3208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3209', '3209', '盐城市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320902', '320902', '亭湖区', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320903', '320903', '盐都区', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320904', '320904', '大丰区', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320921', '320921', '响水县', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320922', '320922', '滨海县', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320923', '320923', '阜宁县', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320924', '320924', '射阳县', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320925', '320925', '建湖县', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320971', '320971', '盐城经济技术开发区', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('320981', '320981', '东台市', '3209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3210', '3210', '扬州市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321002', '321002', '广陵区', '3210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321003', '321003', '邗江区', '3210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321012', '321012', '江都区', '3210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321023', '321023', '宝应县', '3210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321071', '321071', '扬州经济技术开发区', '3210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321081', '321081', '仪征市', '3210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321084', '321084', '高邮市', '3210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3211', '3211', '镇江市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321102', '321102', '京口区', '3211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321111', '321111', '润州区', '3211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321112', '321112', '丹徒区', '3211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321171', '321171', '镇江新区', '3211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321181', '321181', '丹阳市', '3211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321182', '321182', '扬中市', '3211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321183', '321183', '句容市', '3211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3212', '3212', '泰州市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321202', '321202', '海陵区', '3212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321203', '321203', '高港区', '3212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321204', '321204', '姜堰区', '3212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321271', '321271', '泰州医药高新技术产业开发区', '3212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321281', '321281', '兴化市', '3212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321282', '321282', '靖江市', '3212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321283', '321283', '泰兴市', '3212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3213', '3213', '宿迁市', '32', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321302', '321302', '宿城区', '3213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321311', '321311', '宿豫区', '3213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321322', '321322', '沭阳县', '3213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321323', '321323', '泗阳县', '3213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321324', '321324', '泗洪县', '3213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('321371', '321371', '宿迁经济技术开发区', '3213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('33', '33', '浙江省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3301', '3301', '杭州市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330102', '330102', '上城区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330103', '330103', '下城区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330104', '330104', '江干区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330105', '330105', '拱墅区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330106', '330106', '西湖区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330108', '330108', '滨江区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330109', '330109', '萧山区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330110', '330110', '余杭区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330111', '330111', '富阳区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330112', '330112', '临安区', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330122', '330122', '桐庐县', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330127', '330127', '淳安县', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330182', '330182', '建德市', '3301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3302', '3302', '宁波市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330203', '330203', '海曙区', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330205', '330205', '江北区', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330206', '330206', '北仑区', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330211', '330211', '镇海区', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330212', '330212', '鄞州区', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330213', '330213', '奉化区', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330225', '330225', '象山县', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330226', '330226', '宁海县', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330281', '330281', '余姚市', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330282', '330282', '慈溪市', '3302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3303', '3303', '温州市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330302', '330302', '鹿城区', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330303', '330303', '龙湾区', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330304', '330304', '瓯海区', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330305', '330305', '洞头区', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330324', '330324', '永嘉县', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330326', '330326', '平阳县', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330327', '330327', '苍南县', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330328', '330328', '文成县', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330329', '330329', '泰顺县', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330371', '330371', '温州经济技术开发区', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330381', '330381', '瑞安市', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330382', '330382', '乐清市', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330383', '330383', '龙港市', '3303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3304', '3304', '嘉兴市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330402', '330402', '南湖区', '3304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330411', '330411', '秀洲区', '3304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330421', '330421', '嘉善县', '3304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330424', '330424', '海盐县', '3304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330481', '330481', '海宁市', '3304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330482', '330482', '平湖市', '3304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330483', '330483', '桐乡市', '3304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3305', '3305', '湖州市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330502', '330502', '吴兴区', '3305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330503', '330503', '南浔区', '3305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330521', '330521', '德清县', '3305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330522', '330522', '长兴县', '3305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330523', '330523', '安吉县', '3305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3306', '3306', '绍兴市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330602', '330602', '越城区', '3306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330603', '330603', '柯桥区', '3306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330604', '330604', '上虞区', '3306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330624', '330624', '新昌县', '3306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330681', '330681', '诸暨市', '3306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330683', '330683', '嵊州市', '3306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3307', '3307', '金华市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330702', '330702', '婺城区', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330703', '330703', '金东区', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330723', '330723', '武义县', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330726', '330726', '浦江县', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330727', '330727', '磐安县', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330781', '330781', '兰溪市', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330782', '330782', '义乌市', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330783', '330783', '东阳市', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330784', '330784', '永康市', '3307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3308', '3308', '衢州市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330802', '330802', '柯城区', '3308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330803', '330803', '衢江区', '3308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330822', '330822', '常山县', '3308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330824', '330824', '开化县', '3308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330825', '330825', '龙游县', '3308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330881', '330881', '江山市', '3308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3309', '3309', '舟山市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330902', '330902', '定海区', '3309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330903', '330903', '普陀区', '3309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330921', '330921', '岱山县', '3309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('330922', '330922', '嵊泗县', '3309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3310', '3310', '台州市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331002', '331002', '椒江区', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331003', '331003', '黄岩区', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331004', '331004', '路桥区', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331022', '331022', '三门县', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331023', '331023', '天台县', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331024', '331024', '仙居县', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331081', '331081', '温岭市', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331082', '331082', '临海市', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331083', '331083', '玉环市', '3310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3311', '3311', '丽水市', '33', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331102', '331102', '莲都区', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331121', '331121', '青田县', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331122', '331122', '缙云县', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331123', '331123', '遂昌县', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331124', '331124', '松阳县', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331125', '331125', '云和县', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331126', '331126', '庆元县', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331127', '331127', '景宁畲族自治县', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('331181', '331181', '龙泉市', '3311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('34', '34', '安徽省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3401', '3401', '合肥市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340102', '340102', '瑶海区', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340103', '340103', '庐阳区', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340104', '340104', '蜀山区', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340111', '340111', '包河区', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340121', '340121', '长丰县', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340122', '340122', '肥东县', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340123', '340123', '肥西县', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340124', '340124', '庐江县', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340171', '340171', '合肥高新技术产业开发区', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340172', '340172', '合肥经济技术开发区', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340173', '340173', '合肥新站高新技术产业开发区', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340181', '340181', '巢湖市', '3401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3402', '3402', '芜湖市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340202', '340202', '镜湖区', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340203', '340203', '弋江区', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340207', '340207', '鸠江区', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340208', '340208', '三山区', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340221', '340221', '芜湖县', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340222', '340222', '繁昌县', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340223', '340223', '南陵县', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340271', '340271', '芜湖经济技术开发区', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340272', '340272', '安徽芜湖长江大桥经济开发区', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340281', '340281', '无为市', '3402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3403', '3403', '蚌埠市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340302', '340302', '龙子湖区', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340303', '340303', '蚌山区', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340304', '340304', '禹会区', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340311', '340311', '淮上区', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340321', '340321', '怀远县', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340322', '340322', '五河县', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340323', '340323', '固镇县', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340371', '340371', '蚌埠市高新技术开发区', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340372', '340372', '蚌埠市经济开发区', '3403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3404', '3404', '淮南市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340402', '340402', '大通区', '3404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340403', '340403', '田家庵区', '3404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340404', '340404', '谢家集区', '3404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340405', '340405', '八公山区', '3404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340406', '340406', '潘集区', '3404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340421', '340421', '凤台县', '3404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340422', '340422', '寿县', '3404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3405', '3405', '马鞍山市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340503', '340503', '花山区', '3405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340504', '340504', '雨山区', '3405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340506', '340506', '博望区', '3405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340521', '340521', '当涂县', '3405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340522', '340522', '含山县', '3405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340523', '340523', '和县', '3405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3406', '3406', '淮北市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340602', '340602', '杜集区', '3406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340603', '340603', '相山区', '3406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340604', '340604', '烈山区', '3406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340621', '340621', '濉溪县', '3406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3407', '3407', '铜陵市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340705', '340705', '铜官区', '3407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340706', '340706', '义安区', '3407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340711', '340711', '郊区', '3407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340722', '340722', '枞阳县', '3407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3408', '3408', '安庆市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340802', '340802', '迎江区', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340803', '340803', '大观区', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340811', '340811', '宜秀区', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340822', '340822', '怀宁县', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340825', '340825', '太湖县', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340826', '340826', '宿松县', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340827', '340827', '望江县', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340828', '340828', '岳西县', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340871', '340871', '安徽安庆经济开发区', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340881', '340881', '桐城市', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('340882', '340882', '潜山市', '3408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3410', '3410', '黄山市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341002', '341002', '屯溪区', '3410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341003', '341003', '黄山区', '3410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341004', '341004', '徽州区', '3410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341021', '341021', '歙县', '3410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341022', '341022', '休宁县', '3410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341023', '341023', '黟县', '3410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341024', '341024', '祁门县', '3410', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3411', '3411', '滁州市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341102', '341102', '琅琊区', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341103', '341103', '南谯区', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341122', '341122', '来安县', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341124', '341124', '全椒县', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341125', '341125', '定远县', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341126', '341126', '凤阳县', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341171', '341171', '苏滁现代产业园', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341172', '341172', '滁州经济技术开发区', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341181', '341181', '天长市', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341182', '341182', '明光市', '3411', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3412', '3412', '阜阳市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341202', '341202', '颍州区', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341203', '341203', '颍东区', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341204', '341204', '颍泉区', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341221', '341221', '临泉县', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341222', '341222', '太和县', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341225', '341225', '阜南县', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341226', '341226', '颍上县', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341271', '341271', '阜阳合肥现代产业园区', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341272', '341272', '阜阳经济技术开发区', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341282', '341282', '界首市', '3412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3413', '3413', '宿州市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341302', '341302', '埇桥区', '3413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341321', '341321', '砀山县', '3413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341322', '341322', '萧县', '3413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341323', '341323', '灵璧县', '3413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341324', '341324', '泗县', '3413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341371', '341371', '宿州马鞍山现代产业园区', '3413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341372', '341372', '宿州经济技术开发区', '3413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3415', '3415', '六安市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341502', '341502', '金安区', '3415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341503', '341503', '裕安区', '3415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341504', '341504', '叶集区', '3415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341522', '341522', '霍邱县', '3415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341523', '341523', '舒城县', '3415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341524', '341524', '金寨县', '3415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341525', '341525', '霍山县', '3415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3416', '3416', '亳州市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341602', '341602', '谯城区', '3416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341621', '341621', '涡阳县', '3416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341622', '341622', '蒙城县', '3416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341623', '341623', '利辛县', '3416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3417', '3417', '池州市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341702', '341702', '贵池区', '3417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341721', '341721', '东至县', '3417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341722', '341722', '石台县', '3417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341723', '341723', '青阳县', '3417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3418', '3418', '宣城市', '34', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341802', '341802', '宣州区', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341821', '341821', '郎溪县', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341823', '341823', '泾县', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341824', '341824', '绩溪县', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341825', '341825', '旌德县', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341871', '341871', '宣城市经济开发区', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341881', '341881', '宁国市', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('341882', '341882', '广德市', '3418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('35', '35', '福建省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3501', '3501', '福州市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350102', '350102', '鼓楼区', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350103', '350103', '台江区', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350104', '350104', '仓山区', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350105', '350105', '马尾区', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350111', '350111', '晋安区', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350112', '350112', '长乐区', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350121', '350121', '闽侯县', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350122', '350122', '连江县', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350123', '350123', '罗源县', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350124', '350124', '闽清县', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350125', '350125', '永泰县', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350128', '350128', '平潭县', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350181', '350181', '福清市', '3501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3502', '3502', '厦门市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350203', '350203', '思明区', '3502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350205', '350205', '海沧区', '3502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350206', '350206', '湖里区', '3502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350211', '350211', '集美区', '3502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350212', '350212', '同安区', '3502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350213', '350213', '翔安区', '3502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3503', '3503', '莆田市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350302', '350302', '城厢区', '3503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350303', '350303', '涵江区', '3503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350304', '350304', '荔城区', '3503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350305', '350305', '秀屿区', '3503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350322', '350322', '仙游县', '3503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3504', '3504', '三明市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350402', '350402', '梅列区', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350403', '350403', '三元区', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350421', '350421', '明溪县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350423', '350423', '清流县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350424', '350424', '宁化县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350425', '350425', '大田县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350426', '350426', '尤溪县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350427', '350427', '沙县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350428', '350428', '将乐县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350429', '350429', '泰宁县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350430', '350430', '建宁县', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350481', '350481', '永安市', '3504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3505', '3505', '泉州市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350502', '350502', '鲤城区', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350503', '350503', '丰泽区', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350504', '350504', '洛江区', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350505', '350505', '泉港区', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350521', '350521', '惠安县', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350524', '350524', '安溪县', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350525', '350525', '永春县', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350526', '350526', '德化县', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350527', '350527', '金门县', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350581', '350581', '石狮市', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350582', '350582', '晋江市', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350583', '350583', '南安市', '3505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3506', '3506', '漳州市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350602', '350602', '芗城区', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350603', '350603', '龙文区', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350622', '350622', '云霄县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350623', '350623', '漳浦县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350624', '350624', '诏安县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350625', '350625', '长泰县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350626', '350626', '东山县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350627', '350627', '南靖县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350628', '350628', '平和县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350629', '350629', '华安县', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350681', '350681', '龙海市', '3506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3507', '3507', '南平市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350702', '350702', '延平区', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350703', '350703', '建阳区', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350721', '350721', '顺昌县', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350722', '350722', '浦城县', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350723', '350723', '光泽县', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350724', '350724', '松溪县', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350725', '350725', '政和县', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350781', '350781', '邵武市', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350782', '350782', '武夷山市', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350783', '350783', '建瓯市', '3507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3508', '3508', '龙岩市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350802', '350802', '新罗区', '3508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350803', '350803', '永定区', '3508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350821', '350821', '长汀县', '3508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350823', '350823', '上杭县', '3508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350824', '350824', '武平县', '3508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350825', '350825', '连城县', '3508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350881', '350881', '漳平市', '3508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3509', '3509', '宁德市', '35', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350902', '350902', '蕉城区', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350921', '350921', '霞浦县', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350922', '350922', '古田县', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350923', '350923', '屏南县', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350924', '350924', '寿宁县', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350925', '350925', '周宁县', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350926', '350926', '柘荣县', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350981', '350981', '福安市', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('350982', '350982', '福鼎市', '3509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('36', '36', '江西省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3601', '3601', '南昌市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360102', '360102', '东湖区', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360103', '360103', '西湖区', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360104', '360104', '青云谱区', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360111', '360111', '青山湖区', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360112', '360112', '新建区', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360113', '360113', '红谷滩区', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360121', '360121', '南昌县', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360123', '360123', '安义县', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360124', '360124', '进贤县', '3601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3602', '3602', '景德镇市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360202', '360202', '昌江区', '3602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360203', '360203', '珠山区', '3602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360222', '360222', '浮梁县', '3602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360281', '360281', '乐平市', '3602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3603', '3603', '萍乡市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360302', '360302', '安源区', '3603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360313', '360313', '湘东区', '3603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360321', '360321', '莲花县', '3603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360322', '360322', '上栗县', '3603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360323', '360323', '芦溪县', '3603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3604', '3604', '九江市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360402', '360402', '濂溪区', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360403', '360403', '浔阳区', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360404', '360404', '柴桑区', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360423', '360423', '武宁县', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360424', '360424', '修水县', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360425', '360425', '永修县', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360426', '360426', '德安县', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360428', '360428', '都昌县', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360429', '360429', '湖口县', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360430', '360430', '彭泽县', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360481', '360481', '瑞昌市', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360482', '360482', '共青城市', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360483', '360483', '庐山市', '3604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3605', '3605', '新余市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360502', '360502', '渝水区', '3605', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360521', '360521', '分宜县', '3605', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3606', '3606', '鹰潭市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360602', '360602', '月湖区', '3606', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360603', '360603', '余江区', '3606', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360681', '360681', '贵溪市', '3606', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3607', '3607', '赣州市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360702', '360702', '章贡区', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360703', '360703', '南康区', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360704', '360704', '赣县区', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360722', '360722', '信丰县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360723', '360723', '大余县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360724', '360724', '上犹县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360725', '360725', '崇义县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360726', '360726', '安远县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360728', '360728', '定南县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360729', '360729', '全南县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360730', '360730', '宁都县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360731', '360731', '于都县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360732', '360732', '兴国县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360733', '360733', '会昌县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360734', '360734', '寻乌县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360735', '360735', '石城县', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360781', '360781', '瑞金市', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360783', '360783', '龙南市', '3607', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3608', '3608', '吉安市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360802', '360802', '吉州区', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360803', '360803', '青原区', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360821', '360821', '吉安县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360822', '360822', '吉水县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360823', '360823', '峡江县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360824', '360824', '新干县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360825', '360825', '永丰县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360826', '360826', '泰和县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360827', '360827', '遂川县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360828', '360828', '万安县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360829', '360829', '安福县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360830', '360830', '永新县', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360881', '360881', '井冈山市', '3608', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3609', '3609', '宜春市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360902', '360902', '袁州区', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360921', '360921', '奉新县', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360922', '360922', '万载县', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360923', '360923', '上高县', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360924', '360924', '宜丰县', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360925', '360925', '靖安县', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360926', '360926', '铜鼓县', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360981', '360981', '丰城市', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360982', '360982', '樟树市', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('360983', '360983', '高安市', '3609', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3610', '3610', '抚州市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361002', '361002', '临川区', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361003', '361003', '东乡区', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361021', '361021', '南城县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361022', '361022', '黎川县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361023', '361023', '南丰县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361024', '361024', '崇仁县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361025', '361025', '乐安县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361026', '361026', '宜黄县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361027', '361027', '金溪县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361028', '361028', '资溪县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361030', '361030', '广昌县', '3610', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3611', '3611', '上饶市', '36', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361102', '361102', '信州区', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361103', '361103', '广丰区', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361104', '361104', '广信区', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361123', '361123', '玉山县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361124', '361124', '铅山县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361125', '361125', '横峰县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361126', '361126', '弋阳县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361127', '361127', '余干县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361128', '361128', '鄱阳县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361129', '361129', '万年县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361130', '361130', '婺源县', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('361181', '361181', '德兴市', '3611', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('37', '37', '山东省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3701', '3701', '济南市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370102', '370102', '历下区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370103', '370103', '市中区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370104', '370104', '槐荫区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370105', '370105', '天桥区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370112', '370112', '历城区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370113', '370113', '长清区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370114', '370114', '章丘区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370115', '370115', '济阳区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370116', '370116', '莱芜区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370117', '370117', '钢城区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370124', '370124', '平阴县', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370126', '370126', '商河县', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370171', '370171', '济南高新技术产业开发区', '3701', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3702', '3702', '青岛市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370202', '370202', '市南区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370203', '370203', '市北区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370211', '370211', '黄岛区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370212', '370212', '崂山区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370213', '370213', '李沧区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370214', '370214', '城阳区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370215', '370215', '即墨区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370271', '370271', '青岛高新技术产业开发区', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370281', '370281', '胶州市', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370283', '370283', '平度市', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370285', '370285', '莱西市', '3702', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3703', '3703', '淄博市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370302', '370302', '淄川区', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370303', '370303', '张店区', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370304', '370304', '博山区', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370305', '370305', '临淄区', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370306', '370306', '周村区', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370321', '370321', '桓台县', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370322', '370322', '高青县', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370323', '370323', '沂源县', '3703', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3704', '3704', '枣庄市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370402', '370402', '市中区', '3704', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370403', '370403', '薛城区', '3704', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370404', '370404', '峄城区', '3704', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370405', '370405', '台儿庄区', '3704', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370406', '370406', '山亭区', '3704', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370481', '370481', '滕州市', '3704', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3705', '3705', '东营市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370502', '370502', '东营区', '3705', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370503', '370503', '河口区', '3705', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370505', '370505', '垦利区', '3705', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370522', '370522', '利津县', '3705', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370523', '370523', '广饶县', '3705', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370571', '370571', '东营经济技术开发区', '3705', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370572', '370572', '东营港经济开发区', '3705', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3706', '3706', '烟台市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370602', '370602', '芝罘区', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370611', '370611', '福山区', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370612', '370612', '牟平区', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370613', '370613', '莱山区', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370614', '370614', '蓬莱区', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370671', '370671', '烟台高新技术产业开发区', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370672', '370672', '烟台经济技术开发区', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370681', '370681', '龙口市', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370682', '370682', '莱阳市', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370683', '370683', '莱州市', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370685', '370685', '招远市', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370686', '370686', '栖霞市', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370687', '370687', '海阳市', '3706', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3707', '3707', '潍坊市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370702', '370702', '潍城区', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370703', '370703', '寒亭区', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370704', '370704', '坊子区', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370705', '370705', '奎文区', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370724', '370724', '临朐县', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370725', '370725', '昌乐县', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370772', '370772', '潍坊滨海经济技术开发区', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370781', '370781', '青州市', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370782', '370782', '诸城市', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370783', '370783', '寿光市', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370784', '370784', '安丘市', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370785', '370785', '高密市', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370786', '370786', '昌邑市', '3707', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3708', '3708', '济宁市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370811', '370811', '任城区', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370812', '370812', '兖州区', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370826', '370826', '微山县', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370827', '370827', '鱼台县', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370828', '370828', '金乡县', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370829', '370829', '嘉祥县', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370830', '370830', '汶上县', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370831', '370831', '泗水县', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370832', '370832', '梁山县', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370871', '370871', '济宁高新技术产业开发区', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370881', '370881', '曲阜市', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370883', '370883', '邹城市', '3708', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3709', '3709', '泰安市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370902', '370902', '泰山区', '3709', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370911', '370911', '岱岳区', '3709', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370921', '370921', '宁阳县', '3709', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370923', '370923', '东平县', '3709', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370982', '370982', '新泰市', '3709', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('370983', '370983', '肥城市', '3709', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3710', '3710', '威海市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371002', '371002', '环翠区', '3710', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371003', '371003', '文登区', '3710', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371071', '371071', '威海火炬高技术产业开发区', '3710', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371072', '371072', '威海经济技术开发区', '3710', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371073', '371073', '威海临港经济技术开发区', '3710', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371082', '371082', '荣成市', '3710', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371083', '371083', '乳山市', '3710', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3711', '3711', '日照市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371102', '371102', '东港区', '3711', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371103', '371103', '岚山区', '3711', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371121', '371121', '五莲县', '3711', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371122', '371122', '莒县', '3711', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371171', '371171', '日照经济技术开发区', '3711', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3713', '3713', '临沂市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371302', '371302', '兰山区', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371311', '371311', '罗庄区', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371312', '371312', '河东区', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371321', '371321', '沂南县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371322', '371322', '郯城县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371323', '371323', '沂水县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371324', '371324', '兰陵县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371325', '371325', '费县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371326', '371326', '平邑县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371327', '371327', '莒南县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371328', '371328', '蒙阴县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371329', '371329', '临沭县', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371371', '371371', '临沂高新技术产业开发区', '3713', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3714', '3714', '德州市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371402', '371402', '德城区', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371403', '371403', '陵城区', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371422', '371422', '宁津县', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371423', '371423', '庆云县', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371424', '371424', '临邑县', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371425', '371425', '齐河县', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371426', '371426', '平原县', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371427', '371427', '夏津县', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371428', '371428', '武城县', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371471', '371471', '德州经济技术开发区', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371472', '371472', '德州运河经济开发区', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371481', '371481', '乐陵市', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371482', '371482', '禹城市', '3714', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3715', '3715', '聊城市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371502', '371502', '东昌府区', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371503', '371503', '茌平区', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371521', '371521', '阳谷县', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371522', '371522', '莘县', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371524', '371524', '东阿县', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371525', '371525', '冠县', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371526', '371526', '高唐县', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371581', '371581', '临清市', '3715', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3716', '3716', '滨州市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371602', '371602', '滨城区', '3716', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371603', '371603', '沾化区', '3716', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371621', '371621', '惠民县', '3716', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371622', '371622', '阳信县', '3716', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371623', '371623', '无棣县', '3716', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371625', '371625', '博兴县', '3716', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371681', '371681', '邹平市', '3716', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('3717', '3717', '菏泽市', '37', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371702', '371702', '牡丹区', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371703', '371703', '定陶区', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371721', '371721', '曹县', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371722', '371722', '单县', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371723', '371723', '成武县', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371724', '371724', '巨野县', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371725', '371725', '郓城县', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371726', '371726', '鄄城县', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371728', '371728', '东明县', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371771', '371771', '菏泽经济技术开发区', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('371772', '371772', '菏泽高新技术开发区', '3717', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('41', '41', '河南省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4101', '4101', '郑州市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410102', '410102', '中原区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410103', '410103', '二七区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410104', '410104', '管城回族区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410105', '410105', '金水区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410106', '410106', '上街区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410108', '410108', '惠济区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410122', '410122', '中牟县', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410171', '410171', '郑州经济技术开发区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410172', '410172', '郑州高新技术产业开发区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410173', '410173', '郑州航空港经济综合实验区', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410181', '410181', '巩义市', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410182', '410182', '荥阳市', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410183', '410183', '新密市', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410184', '410184', '新郑市', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410185', '410185', '登封市', '4101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4102', '4102', '开封市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410202', '410202', '龙亭区', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410203', '410203', '顺河回族区', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410204', '410204', '鼓楼区', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410205', '410205', '禹王台区', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410212', '410212', '祥符区', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410221', '410221', '杞县', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410222', '410222', '通许县', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410223', '410223', '尉氏县', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410225', '410225', '兰考县', '4102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4103', '4103', '洛阳市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410302', '410302', '老城区', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410303', '410303', '西工区', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410304', '410304', '瀍河回族区', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410305', '410305', '涧西区', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410306', '410306', '吉利区', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410311', '410311', '洛龙区', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410322', '410322', '孟津县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410323', '410323', '新安县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410324', '410324', '栾川县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410325', '410325', '嵩县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410326', '410326', '汝阳县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410327', '410327', '宜阳县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410328', '410328', '洛宁县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410329', '410329', '伊川县', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410371', '410371', '洛阳高新技术产业开发区', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410381', '410381', '偃师市', '4103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4104', '4104', '平顶山市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410402', '410402', '新华区', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410403', '410403', '卫东区', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410404', '410404', '石龙区', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410411', '410411', '湛河区', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410421', '410421', '宝丰县', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410422', '410422', '叶县', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410423', '410423', '鲁山县', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410425', '410425', '郏县', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410471', '410471', '平顶山高新技术产业开发区', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410472', '410472', '平顶山市城乡一体化示范区', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410481', '410481', '舞钢市', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410482', '410482', '汝州市', '4104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4105', '4105', '安阳市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410502', '410502', '文峰区', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410503', '410503', '北关区', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410505', '410505', '殷都区', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410506', '410506', '龙安区', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410522', '410522', '安阳县', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410523', '410523', '汤阴县', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410526', '410526', '滑县', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410527', '410527', '内黄县', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410571', '410571', '安阳高新技术产业开发区', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410581', '410581', '林州市', '4105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4106', '4106', '鹤壁市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410602', '410602', '鹤山区', '4106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410603', '410603', '山城区', '4106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410611', '410611', '淇滨区', '4106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410621', '410621', '浚县', '4106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410622', '410622', '淇县', '4106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410671', '410671', '鹤壁经济技术开发区', '4106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4107', '4107', '新乡市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410702', '410702', '红旗区', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410703', '410703', '卫滨区', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410704', '410704', '凤泉区', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410711', '410711', '牧野区', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410721', '410721', '新乡县', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410724', '410724', '获嘉县', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410725', '410725', '原阳县', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410726', '410726', '延津县', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410727', '410727', '封丘县', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410771', '410771', '新乡高新技术产业开发区', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410772', '410772', '新乡经济技术开发区', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410773', '410773', '新乡市平原城乡一体化示范区', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410781', '410781', '卫辉市', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410782', '410782', '辉县市', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410783', '410783', '长垣市', '4107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4108', '4108', '焦作市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410802', '410802', '解放区', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410803', '410803', '中站区', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410804', '410804', '马村区', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410811', '410811', '山阳区', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410821', '410821', '修武县', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410822', '410822', '博爱县', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410823', '410823', '武陟县', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410825', '410825', '温县', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410871', '410871', '焦作城乡一体化示范区', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410882', '410882', '沁阳市', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410883', '410883', '孟州市', '4108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4109', '4109', '濮阳市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410902', '410902', '华龙区', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410922', '410922', '清丰县', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410923', '410923', '南乐县', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410926', '410926', '范县', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410927', '410927', '台前县', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410928', '410928', '濮阳县', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410971', '410971', '河南濮阳工业园区', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('410972', '410972', '濮阳经济技术开发区', '4109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4110', '4110', '许昌市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411002', '411002', '魏都区', '4110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411003', '411003', '建安区', '4110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411024', '411024', '鄢陵县', '4110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411025', '411025', '襄城县', '4110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411071', '411071', '许昌经济技术开发区', '4110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411081', '411081', '禹州市', '4110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411082', '411082', '长葛市', '4110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4111', '4111', '漯河市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411102', '411102', '源汇区', '4111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411103', '411103', '郾城区', '4111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411104', '411104', '召陵区', '4111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411121', '411121', '舞阳县', '4111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411122', '411122', '临颍县', '4111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411171', '411171', '漯河经济技术开发区', '4111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4112', '4112', '三门峡市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411202', '411202', '湖滨区', '4112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411203', '411203', '陕州区', '4112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411221', '411221', '渑池县', '4112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411224', '411224', '卢氏县', '4112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411271', '411271', '河南三门峡经济开发区', '4112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411281', '411281', '义马市', '4112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411282', '411282', '灵宝市', '4112', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4113', '4113', '南阳市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411302', '411302', '宛城区', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411303', '411303', '卧龙区', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411321', '411321', '南召县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411322', '411322', '方城县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411323', '411323', '西峡县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411324', '411324', '镇平县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411325', '411325', '内乡县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411326', '411326', '淅川县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411327', '411327', '社旗县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411328', '411328', '唐河县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411329', '411329', '新野县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411330', '411330', '桐柏县', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411371', '411371', '南阳高新技术产业开发区', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411372', '411372', '南阳市城乡一体化示范区', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411381', '411381', '邓州市', '4113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4114', '4114', '商丘市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411402', '411402', '梁园区', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411403', '411403', '睢阳区', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411421', '411421', '民权县', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411422', '411422', '睢县', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411423', '411423', '宁陵县', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411424', '411424', '柘城县', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411425', '411425', '虞城县', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411426', '411426', '夏邑县', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411471', '411471', '豫东综合物流产业聚集区', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411472', '411472', '河南商丘经济开发区', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411481', '411481', '永城市', '4114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4115', '4115', '信阳市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411502', '411502', '浉河区', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411503', '411503', '平桥区', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411521', '411521', '罗山县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411522', '411522', '光山县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411523', '411523', '新县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411524', '411524', '商城县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411525', '411525', '固始县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411526', '411526', '潢川县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411527', '411527', '淮滨县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411528', '411528', '息县', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411571', '411571', '信阳高新技术产业开发区', '4115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4116', '4116', '周口市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411602', '411602', '川汇区', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411603', '411603', '淮阳区', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411621', '411621', '扶沟县', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411622', '411622', '西华县', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411623', '411623', '商水县', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411624', '411624', '沈丘县', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411625', '411625', '郸城县', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411627', '411627', '太康县', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411628', '411628', '鹿邑县', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411671', '411671', '河南周口经济开发区', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411681', '411681', '项城市', '4116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4117', '4117', '驻马店市', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411702', '411702', '驿城区', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411721', '411721', '西平县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411722', '411722', '上蔡县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411723', '411723', '平舆县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411724', '411724', '正阳县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411725', '411725', '确山县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411726', '411726', '泌阳县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411727', '411727', '汝南县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411728', '411728', '遂平县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411729', '411729', '新蔡县', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('411771', '411771', '河南驻马店经济开发区', '4117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4190', '4190', '省直辖县级行政区划', '41', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('419001', '419001', '济源市', '4190', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('42', '42', '湖北省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4201', '4201', '武汉市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420102', '420102', '江岸区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420103', '420103', '江汉区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420104', '420104', '硚口区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420105', '420105', '汉阳区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420106', '420106', '武昌区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420107', '420107', '青山区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420111', '420111', '洪山区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420112', '420112', '东西湖区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420113', '420113', '汉南区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420114', '420114', '蔡甸区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420115', '420115', '江夏区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420116', '420116', '黄陂区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420117', '420117', '新洲区', '4201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4202', '4202', '黄石市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420202', '420202', '黄石港区', '4202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420203', '420203', '西塞山区', '4202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420204', '420204', '下陆区', '4202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420205', '420205', '铁山区', '4202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420222', '420222', '阳新县', '4202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420281', '420281', '大冶市', '4202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4203', '4203', '十堰市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420302', '420302', '茅箭区', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420303', '420303', '张湾区', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420304', '420304', '郧阳区', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420322', '420322', '郧西县', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420323', '420323', '竹山县', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420324', '420324', '竹溪县', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420325', '420325', '房县', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420381', '420381', '丹江口市', '4203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4205', '4205', '宜昌市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420502', '420502', '西陵区', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420503', '420503', '伍家岗区', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420504', '420504', '点军区', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420505', '420505', '猇亭区', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420506', '420506', '夷陵区', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420525', '420525', '远安县', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420526', '420526', '兴山县', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420527', '420527', '秭归县', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420528', '420528', '长阳土家族自治县', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420529', '420529', '五峰土家族自治县', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420581', '420581', '宜都市', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420582', '420582', '当阳市', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420583', '420583', '枝江市', '4205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4206', '4206', '襄阳市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420602', '420602', '襄城区', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420606', '420606', '樊城区', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420607', '420607', '襄州区', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420624', '420624', '南漳县', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420625', '420625', '谷城县', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420626', '420626', '保康县', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420682', '420682', '老河口市', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420683', '420683', '枣阳市', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420684', '420684', '宜城市', '4206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4207', '4207', '鄂州市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420702', '420702', '梁子湖区', '4207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420703', '420703', '华容区', '4207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420704', '420704', '鄂城区', '4207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4208', '4208', '荆门市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420802', '420802', '东宝区', '4208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420804', '420804', '掇刀区', '4208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420822', '420822', '沙洋县', '4208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420881', '420881', '钟祥市', '4208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420882', '420882', '京山市', '4208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4209', '4209', '孝感市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420902', '420902', '孝南区', '4209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420921', '420921', '孝昌县', '4209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420922', '420922', '大悟县', '4209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420923', '420923', '云梦县', '4209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420981', '420981', '应城市', '4209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420982', '420982', '安陆市', '4209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('420984', '420984', '汉川市', '4209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4210', '4210', '荆州市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421002', '421002', '沙市区', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421003', '421003', '荆州区', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421022', '421022', '公安县', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421023', '421023', '监利县', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421024', '421024', '江陵县', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421071', '421071', '荆州经济技术开发区', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421081', '421081', '石首市', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421083', '421083', '洪湖市', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421087', '421087', '松滋市', '4210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4211', '4211', '黄冈市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421102', '421102', '黄州区', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421121', '421121', '团风县', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421122', '421122', '红安县', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421123', '421123', '罗田县', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421124', '421124', '英山县', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421125', '421125', '浠水县', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421126', '421126', '蕲春县', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421127', '421127', '黄梅县', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421171', '421171', '龙感湖管理区', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421181', '421181', '麻城市', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421182', '421182', '武穴市', '4211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4212', '4212', '咸宁市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421202', '421202', '咸安区', '4212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421221', '421221', '嘉鱼县', '4212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421222', '421222', '通城县', '4212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421223', '421223', '崇阳县', '4212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421224', '421224', '通山县', '4212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421281', '421281', '赤壁市', '4212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4213', '4213', '随州市', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421303', '421303', '曾都区', '4213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421321', '421321', '随县', '4213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('421381', '421381', '广水市', '4213', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4228', '4228', '恩施土家族苗族自治州', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422801', '422801', '恩施市', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422802', '422802', '利川市', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422822', '422822', '建始县', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422823', '422823', '巴东县', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422825', '422825', '宣恩县', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422826', '422826', '咸丰县', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422827', '422827', '来凤县', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('422828', '422828', '鹤峰县', '4228', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4290', '4290', '省直辖县级行政区划', '42', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('429004', '429004', '仙桃市', '4290', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('429005', '429005', '潜江市', '4290', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('429006', '429006', '天门市', '4290', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('429021', '429021', '神农架林区', '4290', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('43', '43', '湖南省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4301', '4301', '长沙市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430102', '430102', '芙蓉区', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430103', '430103', '天心区', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430104', '430104', '岳麓区', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430105', '430105', '开福区', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430111', '430111', '雨花区', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430112', '430112', '望城区', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430121', '430121', '长沙县', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430181', '430181', '浏阳市', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430182', '430182', '宁乡市', '4301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4302', '4302', '株洲市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430202', '430202', '荷塘区', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430203', '430203', '芦淞区', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430204', '430204', '石峰区', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430211', '430211', '天元区', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430212', '430212', '渌口区', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430223', '430223', '攸县', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430224', '430224', '茶陵县', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430225', '430225', '炎陵县', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430271', '430271', '云龙示范区', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430281', '430281', '醴陵市', '4302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4303', '4303', '湘潭市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430302', '430302', '雨湖区', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430304', '430304', '岳塘区', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430321', '430321', '湘潭县', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430371', '430371', '湖南湘潭高新技术产业园区', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430372', '430372', '湘潭昭山示范区', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430373', '430373', '湘潭九华示范区', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430381', '430381', '湘乡市', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430382', '430382', '韶山市', '4303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4304', '4304', '衡阳市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430405', '430405', '珠晖区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430406', '430406', '雁峰区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430407', '430407', '石鼓区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430408', '430408', '蒸湘区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430412', '430412', '南岳区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430421', '430421', '衡阳县', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430422', '430422', '衡南县', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430423', '430423', '衡山县', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430424', '430424', '衡东县', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430426', '430426', '祁东县', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430471', '430471', '衡阳综合保税区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430472', '430472', '湖南衡阳高新技术产业园区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430473', '430473', '湖南衡阳松木经济开发区', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430481', '430481', '耒阳市', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430482', '430482', '常宁市', '4304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4305', '4305', '邵阳市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430502', '430502', '双清区', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430503', '430503', '大祥区', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430511', '430511', '北塔区', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430522', '430522', '新邵县', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430523', '430523', '邵阳县', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430524', '430524', '隆回县', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430525', '430525', '洞口县', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430527', '430527', '绥宁县', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430528', '430528', '新宁县', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430529', '430529', '城步苗族自治县', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430581', '430581', '武冈市', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430582', '430582', '邵东市', '4305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4306', '4306', '岳阳市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430602', '430602', '岳阳楼区', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430603', '430603', '云溪区', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430611', '430611', '君山区', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430621', '430621', '岳阳县', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430623', '430623', '华容县', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430624', '430624', '湘阴县', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430626', '430626', '平江县', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430671', '430671', '岳阳市屈原管理区', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430681', '430681', '汨罗市', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430682', '430682', '临湘市', '4306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4307', '4307', '常德市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430702', '430702', '武陵区', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430703', '430703', '鼎城区', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430721', '430721', '安乡县', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430722', '430722', '汉寿县', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430723', '430723', '澧县', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430724', '430724', '临澧县', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430725', '430725', '桃源县', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430726', '430726', '石门县', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430771', '430771', '常德市西洞庭管理区', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430781', '430781', '津市市', '4307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4308', '4308', '张家界市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430802', '430802', '永定区', '4308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430811', '430811', '武陵源区', '4308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430821', '430821', '慈利县', '4308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430822', '430822', '桑植县', '4308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4309', '4309', '益阳市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430902', '430902', '资阳区', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430903', '430903', '赫山区', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430921', '430921', '南县', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430922', '430922', '桃江县', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430923', '430923', '安化县', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430971', '430971', '益阳市大通湖管理区', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430972', '430972', '湖南益阳高新技术产业园区', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('430981', '430981', '沅江市', '4309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4310', '4310', '郴州市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431002', '431002', '北湖区', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431003', '431003', '苏仙区', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431021', '431021', '桂阳县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431022', '431022', '宜章县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431023', '431023', '永兴县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431024', '431024', '嘉禾县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431025', '431025', '临武县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431026', '431026', '汝城县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431027', '431027', '桂东县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431028', '431028', '安仁县', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431081', '431081', '资兴市', '4310', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4311', '4311', '永州市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431102', '431102', '零陵区', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431103', '431103', '冷水滩区', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431121', '431121', '祁阳县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431122', '431122', '东安县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431123', '431123', '双牌县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431124', '431124', '道县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431125', '431125', '江永县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431126', '431126', '宁远县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431127', '431127', '蓝山县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431128', '431128', '新田县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431129', '431129', '江华瑶族自治县', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431171', '431171', '永州经济技术开发区', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431172', '431172', '永州市金洞管理区', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431173', '431173', '永州市回龙圩管理区', '4311', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4312', '4312', '怀化市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431202', '431202', '鹤城区', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431221', '431221', '中方县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431222', '431222', '沅陵县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431223', '431223', '辰溪县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431224', '431224', '溆浦县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431225', '431225', '会同县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431226', '431226', '麻阳苗族自治县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431227', '431227', '新晃侗族自治县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431228', '431228', '芷江侗族自治县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431229', '431229', '靖州苗族侗族自治县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431230', '431230', '通道侗族自治县', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431271', '431271', '怀化市洪江管理区', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431281', '431281', '洪江市', '4312', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4313', '4313', '娄底市', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431302', '431302', '娄星区', '4313', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431321', '431321', '双峰县', '4313', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431322', '431322', '新化县', '4313', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431381', '431381', '冷水江市', '4313', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('431382', '431382', '涟源市', '4313', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4331', '4331', '湘西土家族苗族自治州', '43', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433101', '433101', '吉首市', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433122', '433122', '泸溪县', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433123', '433123', '凤凰县', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433124', '433124', '花垣县', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433125', '433125', '保靖县', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433126', '433126', '古丈县', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433127', '433127', '永顺县', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('433130', '433130', '龙山县', '4331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('44', '44', '广东省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4401', '4401', '广州市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440103', '440103', '荔湾区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440104', '440104', '越秀区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440105', '440105', '海珠区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440106', '440106', '天河区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440111', '440111', '白云区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440112', '440112', '黄埔区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440113', '440113', '番禺区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440114', '440114', '花都区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440115', '440115', '南沙区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440117', '440117', '从化区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440118', '440118', '增城区', '4401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4402', '4402', '韶关市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440203', '440203', '武江区', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440204', '440204', '浈江区', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440205', '440205', '曲江区', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440222', '440222', '始兴县', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440224', '440224', '仁化县', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440229', '440229', '翁源县', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440232', '440232', '乳源瑶族自治县', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440233', '440233', '新丰县', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440281', '440281', '乐昌市', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440282', '440282', '南雄市', '4402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4403', '4403', '深圳市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440303', '440303', '罗湖区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440304', '440304', '福田区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440305', '440305', '南山区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440306', '440306', '宝安区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440307', '440307', '龙岗区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440308', '440308', '盐田区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440309', '440309', '龙华区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440310', '440310', '坪山区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440311', '440311', '光明区', '4403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4404', '4404', '珠海市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440402', '440402', '香洲区', '4404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440403', '440403', '斗门区', '4404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440404', '440404', '金湾区', '4404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4405', '4405', '汕头市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440507', '440507', '龙湖区', '4405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440511', '440511', '金平区', '4405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440512', '440512', '濠江区', '4405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440513', '440513', '潮阳区', '4405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440514', '440514', '潮南区', '4405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440515', '440515', '澄海区', '4405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440523', '440523', '南澳县', '4405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4406', '4406', '佛山市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440604', '440604', '禅城区', '4406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440605', '440605', '南海区', '4406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440606', '440606', '顺德区', '4406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440607', '440607', '三水区', '4406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440608', '440608', '高明区', '4406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4407', '4407', '江门市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440703', '440703', '蓬江区', '4407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440704', '440704', '江海区', '4407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440705', '440705', '新会区', '4407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440781', '440781', '台山市', '4407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440783', '440783', '开平市', '4407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440784', '440784', '鹤山市', '4407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440785', '440785', '恩平市', '4407', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4408', '4408', '湛江市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440802', '440802', '赤坎区', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440803', '440803', '霞山区', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440804', '440804', '坡头区', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440811', '440811', '麻章区', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440823', '440823', '遂溪县', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440825', '440825', '徐闻县', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440881', '440881', '廉江市', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440882', '440882', '雷州市', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440883', '440883', '吴川市', '4408', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4409', '4409', '茂名市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440902', '440902', '茂南区', '4409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440904', '440904', '电白区', '4409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440981', '440981', '高州市', '4409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440982', '440982', '化州市', '4409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('440983', '440983', '信宜市', '4409', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4412', '4412', '肇庆市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441202', '441202', '端州区', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441203', '441203', '鼎湖区', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441204', '441204', '高要区', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441223', '441223', '广宁县', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441224', '441224', '怀集县', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441225', '441225', '封开县', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441226', '441226', '德庆县', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441284', '441284', '四会市', '4412', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4413', '4413', '惠州市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441302', '441302', '惠城区', '4413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441303', '441303', '惠阳区', '4413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441322', '441322', '博罗县', '4413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441323', '441323', '惠东县', '4413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441324', '441324', '龙门县', '4413', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4414', '4414', '梅州市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441402', '441402', '梅江区', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441403', '441403', '梅县区', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441422', '441422', '大埔县', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441423', '441423', '丰顺县', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441424', '441424', '五华县', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441426', '441426', '平远县', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441427', '441427', '蕉岭县', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441481', '441481', '兴宁市', '4414', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4415', '4415', '汕尾市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441502', '441502', '城区', '4415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441521', '441521', '海丰县', '4415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441523', '441523', '陆河县', '4415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441581', '441581', '陆丰市', '4415', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4416', '4416', '河源市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441602', '441602', '源城区', '4416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441621', '441621', '紫金县', '4416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441622', '441622', '龙川县', '4416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441623', '441623', '连平县', '4416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441624', '441624', '和平县', '4416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441625', '441625', '东源县', '4416', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4417', '4417', '阳江市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441702', '441702', '江城区', '4417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441704', '441704', '阳东区', '4417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441721', '441721', '阳西县', '4417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441781', '441781', '阳春市', '4417', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4418', '4418', '清远市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441802', '441802', '清城区', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441803', '441803', '清新区', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441821', '441821', '佛冈县', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441823', '441823', '阳山县', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441825', '441825', '连山壮族瑶族自治县', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441826', '441826', '连南瑶族自治县', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441881', '441881', '英德市', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441882', '441882', '连州市', '4418', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4419', '4419', '东莞市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900003', '441900003', '东城街道', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900004', '441900004', '南城街道', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900005', '441900005', '万江街道', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900006', '441900006', '莞城街道', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900101', '441900101', '石碣镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900102', '441900102', '石龙镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900103', '441900103', '茶山镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900104', '441900104', '石排镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900105', '441900105', '企石镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900106', '441900106', '横沥镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900107', '441900107', '桥头镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900108', '441900108', '谢岗镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900109', '441900109', '东坑镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900110', '441900110', '常平镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900111', '441900111', '寮步镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900112', '441900112', '樟木头镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900113', '441900113', '大朗镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900114', '441900114', '黄江镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900115', '441900115', '清溪镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900116', '441900116', '塘厦镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900117', '441900117', '凤岗镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900118', '441900118', '大岭山镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900119', '441900119', '长安镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900121', '441900121', '虎门镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900122', '441900122', '厚街镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900123', '441900123', '沙田镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900124', '441900124', '道滘镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900125', '441900125', '洪梅镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900126', '441900126', '麻涌镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900127', '441900127', '望牛墩镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900128', '441900128', '中堂镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900129', '441900129', '高埗镇', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900401', '441900401', '松山湖', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900402', '441900402', '东莞港', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('441900403', '441900403', '东莞生态园', '4419', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4420', '4420', '中山市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000001', '442000001', '石岐街道', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000002', '442000002', '东区街道', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000003', '442000003', '中山港街道', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000004', '442000004', '西区街道', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000005', '442000005', '南区街道', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000006', '442000006', '五桂山街道', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000100', '442000100', '小榄镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000101', '442000101', '黄圃镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000102', '442000102', '民众镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000103', '442000103', '东凤镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000104', '442000104', '东升镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000105', '442000105', '古镇镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000106', '442000106', '沙溪镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000107', '442000107', '坦洲镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000108', '442000108', '港口镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000109', '442000109', '三角镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000110', '442000110', '横栏镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000111', '442000111', '南头镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000112', '442000112', '阜沙镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000113', '442000113', '南朗镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000114', '442000114', '三乡镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000115', '442000115', '板芙镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000116', '442000116', '大涌镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('442000117', '442000117', '神湾镇', '4420', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4451', '4451', '潮州市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445102', '445102', '湘桥区', '4451', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445103', '445103', '潮安区', '4451', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445122', '445122', '饶平县', '4451', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4452', '4452', '揭阳市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445202', '445202', '榕城区', '4452', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445203', '445203', '揭东区', '4452', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445222', '445222', '揭西县', '4452', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445224', '445224', '惠来县', '4452', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445281', '445281', '普宁市', '4452', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4453', '4453', '云浮市', '44', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445302', '445302', '云城区', '4453', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445303', '445303', '云安区', '4453', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445321', '445321', '新兴县', '4453', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445322', '445322', '郁南县', '4453', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('445381', '445381', '罗定市', '4453', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('45', '45', '广西壮族自治区', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4501', '4501', '南宁市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450102', '450102', '兴宁区', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450103', '450103', '青秀区', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450105', '450105', '江南区', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450107', '450107', '西乡塘区', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450108', '450108', '良庆区', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450109', '450109', '邕宁区', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450110', '450110', '武鸣区', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450123', '450123', '隆安县', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450124', '450124', '马山县', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450125', '450125', '上林县', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450126', '450126', '宾阳县', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450127', '450127', '横县', '4501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4502', '4502', '柳州市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450202', '450202', '城中区', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450203', '450203', '鱼峰区', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450204', '450204', '柳南区', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450205', '450205', '柳北区', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450206', '450206', '柳江区', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450222', '450222', '柳城县', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450223', '450223', '鹿寨县', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450224', '450224', '融安县', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450225', '450225', '融水苗族自治县', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450226', '450226', '三江侗族自治县', '4502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4503', '4503', '桂林市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450302', '450302', '秀峰区', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450303', '450303', '叠彩区', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450304', '450304', '象山区', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450305', '450305', '七星区', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450311', '450311', '雁山区', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450312', '450312', '临桂区', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450321', '450321', '阳朔县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450323', '450323', '灵川县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450324', '450324', '全州县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450325', '450325', '兴安县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450326', '450326', '永福县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450327', '450327', '灌阳县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450328', '450328', '龙胜各族自治县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450329', '450329', '资源县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450330', '450330', '平乐县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450332', '450332', '恭城瑶族自治县', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450381', '450381', '荔浦市', '4503', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4504', '4504', '梧州市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450403', '450403', '万秀区', '4504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450405', '450405', '长洲区', '4504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450406', '450406', '龙圩区', '4504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450421', '450421', '苍梧县', '4504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450422', '450422', '藤县', '4504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450423', '450423', '蒙山县', '4504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450481', '450481', '岑溪市', '4504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4505', '4505', '北海市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450502', '450502', '海城区', '4505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450503', '450503', '银海区', '4505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450512', '450512', '铁山港区', '4505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450521', '450521', '合浦县', '4505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4506', '4506', '防城港市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450602', '450602', '港口区', '4506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450603', '450603', '防城区', '4506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450621', '450621', '上思县', '4506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450681', '450681', '东兴市', '4506', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4507', '4507', '钦州市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450702', '450702', '钦南区', '4507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450703', '450703', '钦北区', '4507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450721', '450721', '灵山县', '4507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450722', '450722', '浦北县', '4507', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4508', '4508', '贵港市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450802', '450802', '港北区', '4508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450803', '450803', '港南区', '4508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450804', '450804', '覃塘区', '4508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450821', '450821', '平南县', '4508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450881', '450881', '桂平市', '4508', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4509', '4509', '玉林市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450902', '450902', '玉州区', '4509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450903', '450903', '福绵区', '4509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450921', '450921', '容县', '4509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450922', '450922', '陆川县', '4509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450923', '450923', '博白县', '4509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450924', '450924', '兴业县', '4509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('450981', '450981', '北流市', '4509', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4510', '4510', '百色市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451002', '451002', '右江区', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451003', '451003', '田阳区', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451022', '451022', '田东县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451024', '451024', '德保县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451026', '451026', '那坡县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451027', '451027', '凌云县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451028', '451028', '乐业县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451029', '451029', '田林县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451030', '451030', '西林县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451031', '451031', '隆林各族自治县', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451081', '451081', '靖西市', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451082', '451082', '平果市', '4510', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4511', '4511', '贺州市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451102', '451102', '八步区', '4511', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451103', '451103', '平桂区', '4511', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451121', '451121', '昭平县', '4511', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451122', '451122', '钟山县', '4511', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451123', '451123', '富川瑶族自治县', '4511', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4512', '4512', '河池市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451202', '451202', '金城江区', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451203', '451203', '宜州区', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451221', '451221', '南丹县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451222', '451222', '天峨县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451223', '451223', '凤山县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451224', '451224', '东兰县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451225', '451225', '罗城仫佬族自治县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451226', '451226', '环江毛南族自治县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451227', '451227', '巴马瑶族自治县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451228', '451228', '都安瑶族自治县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451229', '451229', '大化瑶族自治县', '4512', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4513', '4513', '来宾市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451302', '451302', '兴宾区', '4513', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451321', '451321', '忻城县', '4513', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451322', '451322', '象州县', '4513', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451323', '451323', '武宣县', '4513', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451324', '451324', '金秀瑶族自治县', '4513', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451381', '451381', '合山市', '4513', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4514', '4514', '崇左市', '45', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451402', '451402', '江州区', '4514', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451421', '451421', '扶绥县', '4514', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451422', '451422', '宁明县', '4514', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451423', '451423', '龙州县', '4514', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451424', '451424', '大新县', '4514', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451425', '451425', '天等县', '4514', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('451481', '451481', '凭祥市', '4514', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('46', '46', '海南省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4601', '4601', '海口市', '46', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460105', '460105', '秀英区', '4601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460106', '460106', '龙华区', '4601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460107', '460107', '琼山区', '4601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460108', '460108', '美兰区', '4601', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4602', '4602', '三亚市', '46', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460202', '460202', '海棠区', '4602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460203', '460203', '吉阳区', '4602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460204', '460204', '天涯区', '4602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460205', '460205', '崖州区', '4602', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4603', '4603', '三沙市', '46', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460321', '460321', '西沙群岛', '4603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460322', '460322', '南沙群岛', '4603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460323', '460323', '中沙群岛的岛礁及其海域', '4603', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4604', '4604', '儋州市', '46', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400100', '460400100', '那大镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400101', '460400101', '和庆镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400102', '460400102', '南丰镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400103', '460400103', '大成镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400104', '460400104', '雅星镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400105', '460400105', '兰洋镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400106', '460400106', '光村镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400107', '460400107', '木棠镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400108', '460400108', '海头镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400109', '460400109', '峨蔓镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400111', '460400111', '王五镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400112', '460400112', '白马井镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400113', '460400113', '中和镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400114', '460400114', '排浦镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400115', '460400115', '东成镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400116', '460400116', '新州镇', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400499', '460400499', '洋浦经济开发区', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('460400500', '460400500', '华南热作学院', '4604', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('4690', '4690', '省直辖县级行政区划', '46', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469001', '469001', '五指山市', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469002', '469002', '琼海市', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469005', '469005', '文昌市', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469006', '469006', '万宁市', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469007', '469007', '东方市', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469021', '469021', '定安县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469022', '469022', '屯昌县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469023', '469023', '澄迈县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469024', '469024', '临高县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469025', '469025', '白沙黎族自治县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469026', '469026', '昌江黎族自治县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469027', '469027', '乐东黎族自治县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469028', '469028', '陵水黎族自治县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469029', '469029', '保亭黎族苗族自治县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('469030', '469030', '琼中黎族苗族自治县', '4690', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('50', '50', '重庆市', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5001', '5001', '市辖区', '50', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500101', '500101', '万州区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500102', '500102', '涪陵区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500103', '500103', '渝中区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500104', '500104', '大渡口区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500105', '500105', '江北区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500106', '500106', '沙坪坝区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500107', '500107', '九龙坡区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500108', '500108', '南岸区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500109', '500109', '北碚区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500110', '500110', '綦江区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500111', '500111', '大足区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500112', '500112', '渝北区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500113', '500113', '巴南区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500114', '500114', '黔江区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500115', '500115', '长寿区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500116', '500116', '江津区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500117', '500117', '合川区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500118', '500118', '永川区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500119', '500119', '南川区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500120', '500120', '璧山区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500151', '500151', '铜梁区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500152', '500152', '潼南区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500153', '500153', '荣昌区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500154', '500154', '开州区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500155', '500155', '梁平区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500156', '500156', '武隆区', '5001', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5002', '5002', '县', '50', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500229', '500229', '城口县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500230', '500230', '丰都县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500231', '500231', '垫江县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500233', '500233', '忠县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500235', '500235', '云阳县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500236', '500236', '奉节县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500237', '500237', '巫山县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500238', '500238', '巫溪县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500240', '500240', '石柱土家族自治县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500241', '500241', '秀山土家族苗族自治县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500242', '500242', '酉阳土家族苗族自治县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('500243', '500243', '彭水苗族土家族自治县', '5002', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('51', '51', '四川省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5101', '5101', '成都市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510104', '510104', '锦江区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510105', '510105', '青羊区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510106', '510106', '金牛区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510107', '510107', '武侯区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510108', '510108', '成华区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510112', '510112', '龙泉驿区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510113', '510113', '青白江区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510114', '510114', '新都区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510115', '510115', '温江区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510116', '510116', '双流区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510117', '510117', '郫都区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510118', '510118', '新津区', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510121', '510121', '金堂县', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510129', '510129', '大邑县', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510131', '510131', '蒲江县', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510181', '510181', '都江堰市', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510182', '510182', '彭州市', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510183', '510183', '邛崃市', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510184', '510184', '崇州市', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510185', '510185', '简阳市', '5101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5103', '5103', '自贡市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510302', '510302', '自流井区', '5103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510303', '510303', '贡井区', '5103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510304', '510304', '大安区', '5103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510311', '510311', '沿滩区', '5103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510321', '510321', '荣县', '5103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510322', '510322', '富顺县', '5103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5104', '5104', '攀枝花市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510402', '510402', '东区', '5104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510403', '510403', '西区', '5104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510411', '510411', '仁和区', '5104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510421', '510421', '米易县', '5104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510422', '510422', '盐边县', '5104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5105', '5105', '泸州市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510502', '510502', '江阳区', '5105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510503', '510503', '纳溪区', '5105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510504', '510504', '龙马潭区', '5105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510521', '510521', '泸县', '5105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510522', '510522', '合江县', '5105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510524', '510524', '叙永县', '5105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510525', '510525', '古蔺县', '5105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5106', '5106', '德阳市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510603', '510603', '旌阳区', '5106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510604', '510604', '罗江区', '5106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510623', '510623', '中江县', '5106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510681', '510681', '广汉市', '5106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510682', '510682', '什邡市', '5106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510683', '510683', '绵竹市', '5106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5107', '5107', '绵阳市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510703', '510703', '涪城区', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510704', '510704', '游仙区', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510705', '510705', '安州区', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510722', '510722', '三台县', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510723', '510723', '盐亭县', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510725', '510725', '梓潼县', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510726', '510726', '北川羌族自治县', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510727', '510727', '平武县', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510781', '510781', '江油市', '5107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5108', '5108', '广元市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510802', '510802', '利州区', '5108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510811', '510811', '昭化区', '5108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510812', '510812', '朝天区', '5108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510821', '510821', '旺苍县', '5108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510822', '510822', '青川县', '5108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510823', '510823', '剑阁县', '5108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510824', '510824', '苍溪县', '5108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5109', '5109', '遂宁市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510903', '510903', '船山区', '5109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510904', '510904', '安居区', '5109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510921', '510921', '蓬溪县', '5109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510923', '510923', '大英县', '5109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('510981', '510981', '射洪市', '5109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5110', '5110', '内江市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511002', '511002', '市中区', '5110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511011', '511011', '东兴区', '5110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511024', '511024', '威远县', '5110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511025', '511025', '资中县', '5110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511071', '511071', '内江经济开发区', '5110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511083', '511083', '隆昌市', '5110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5111', '5111', '乐山市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511102', '511102', '市中区', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511111', '511111', '沙湾区', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511112', '511112', '五通桥区', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511113', '511113', '金口河区', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511123', '511123', '犍为县', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511124', '511124', '井研县', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511126', '511126', '夹江县', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511129', '511129', '沐川县', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511132', '511132', '峨边彝族自治县', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511133', '511133', '马边彝族自治县', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511181', '511181', '峨眉山市', '5111', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5113', '5113', '南充市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511302', '511302', '顺庆区', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511303', '511303', '高坪区', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511304', '511304', '嘉陵区', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511321', '511321', '南部县', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511322', '511322', '营山县', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511323', '511323', '蓬安县', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511324', '511324', '仪陇县', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511325', '511325', '西充县', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511381', '511381', '阆中市', '5113', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5114', '5114', '眉山市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511402', '511402', '东坡区', '5114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511403', '511403', '彭山区', '5114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511421', '511421', '仁寿县', '5114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511423', '511423', '洪雅县', '5114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511424', '511424', '丹棱县', '5114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511425', '511425', '青神县', '5114', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5115', '5115', '宜宾市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511502', '511502', '翠屏区', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511503', '511503', '南溪区', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511504', '511504', '叙州区', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511523', '511523', '江安县', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511524', '511524', '长宁县', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511525', '511525', '高县', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511526', '511526', '珙县', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511527', '511527', '筠连县', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511528', '511528', '兴文县', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511529', '511529', '屏山县', '5115', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5116', '5116', '广安市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511602', '511602', '广安区', '5116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511603', '511603', '前锋区', '5116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511621', '511621', '岳池县', '5116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511622', '511622', '武胜县', '5116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511623', '511623', '邻水县', '5116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511681', '511681', '华蓥市', '5116', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5117', '5117', '达州市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511702', '511702', '通川区', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511703', '511703', '达川区', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511722', '511722', '宣汉县', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511723', '511723', '开江县', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511724', '511724', '大竹县', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511725', '511725', '渠县', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511771', '511771', '达州经济开发区', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511781', '511781', '万源市', '5117', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5118', '5118', '雅安市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511802', '511802', '雨城区', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511803', '511803', '名山区', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511822', '511822', '荥经县', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511823', '511823', '汉源县', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511824', '511824', '石棉县', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511825', '511825', '天全县', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511826', '511826', '芦山县', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511827', '511827', '宝兴县', '5118', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5119', '5119', '巴中市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511902', '511902', '巴州区', '5119', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511903', '511903', '恩阳区', '5119', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511921', '511921', '通江县', '5119', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511922', '511922', '南江县', '5119', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511923', '511923', '平昌县', '5119', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('511971', '511971', '巴中经济开发区', '5119', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5120', '5120', '资阳市', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('512002', '512002', '雁江区', '5120', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('512021', '512021', '安岳县', '5120', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('512022', '512022', '乐至县', '5120', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5132', '5132', '阿坝藏族羌族自治州', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513201', '513201', '马尔康市', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513221', '513221', '汶川县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513222', '513222', '理县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513223', '513223', '茂县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513224', '513224', '松潘县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513225', '513225', '九寨沟县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513226', '513226', '金川县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513227', '513227', '小金县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513228', '513228', '黑水县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513230', '513230', '壤塘县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513231', '513231', '阿坝县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513232', '513232', '若尔盖县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513233', '513233', '红原县', '5132', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5133', '5133', '甘孜藏族自治州', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513301', '513301', '康定市', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513322', '513322', '泸定县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513323', '513323', '丹巴县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513324', '513324', '九龙县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513325', '513325', '雅江县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513326', '513326', '道孚县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513327', '513327', '炉霍县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513328', '513328', '甘孜县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513329', '513329', '新龙县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513330', '513330', '德格县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513331', '513331', '白玉县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513332', '513332', '石渠县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513333', '513333', '色达县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513334', '513334', '理塘县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513335', '513335', '巴塘县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513336', '513336', '乡城县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513337', '513337', '稻城县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513338', '513338', '得荣县', '5133', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5134', '5134', '凉山彝族自治州', '51', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513401', '513401', '西昌市', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513422', '513422', '木里藏族自治县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513423', '513423', '盐源县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513424', '513424', '德昌县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513425', '513425', '会理县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513426', '513426', '会东县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513427', '513427', '宁南县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513428', '513428', '普格县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513429', '513429', '布拖县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513430', '513430', '金阳县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513431', '513431', '昭觉县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513432', '513432', '喜德县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513433', '513433', '冕宁县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513434', '513434', '越西县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513435', '513435', '甘洛县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513436', '513436', '美姑县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('513437', '513437', '雷波县', '5134', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('52', '52', '贵州省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5201', '5201', '贵阳市', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520102', '520102', '南明区', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520103', '520103', '云岩区', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520111', '520111', '花溪区', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520112', '520112', '乌当区', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520113', '520113', '白云区', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520115', '520115', '观山湖区', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520121', '520121', '开阳县', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520122', '520122', '息烽县', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520123', '520123', '修文县', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520181', '520181', '清镇市', '5201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5202', '5202', '六盘水市', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520201', '520201', '钟山区', '5202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520203', '520203', '六枝特区', '5202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520221', '520221', '水城县', '5202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520281', '520281', '盘州市', '5202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5203', '5203', '遵义市', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520302', '520302', '红花岗区', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520303', '520303', '汇川区', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520304', '520304', '播州区', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520322', '520322', '桐梓县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520323', '520323', '绥阳县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520324', '520324', '正安县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520325', '520325', '道真仡佬族苗族自治县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520326', '520326', '务川仡佬族苗族自治县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520327', '520327', '凤冈县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520328', '520328', '湄潭县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520329', '520329', '余庆县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520330', '520330', '习水县', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520381', '520381', '赤水市', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520382', '520382', '仁怀市', '5203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5204', '5204', '安顺市', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520402', '520402', '西秀区', '5204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520403', '520403', '平坝区', '5204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520422', '520422', '普定县', '5204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520423', '520423', '镇宁布依族苗族自治县', '5204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520424', '520424', '关岭布依族苗族自治县', '5204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520425', '520425', '紫云苗族布依族自治县', '5204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5205', '5205', '毕节市', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520502', '520502', '七星关区', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520521', '520521', '大方县', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520522', '520522', '黔西县', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520523', '520523', '金沙县', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520524', '520524', '织金县', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520525', '520525', '纳雍县', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520526', '520526', '威宁彝族回族苗族自治县', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520527', '520527', '赫章县', '5205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5206', '5206', '铜仁市', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520602', '520602', '碧江区', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520603', '520603', '万山区', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520621', '520621', '江口县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520622', '520622', '玉屏侗族自治县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520623', '520623', '石阡县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520624', '520624', '思南县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520625', '520625', '印江土家族苗族自治县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520626', '520626', '德江县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520627', '520627', '沿河土家族自治县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('520628', '520628', '松桃苗族自治县', '5206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5223', '5223', '黔西南布依族苗族自治州', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522301', '522301', '兴义市', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522302', '522302', '兴仁市', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522323', '522323', '普安县', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522324', '522324', '晴隆县', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522325', '522325', '贞丰县', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522326', '522326', '望谟县', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522327', '522327', '册亨县', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522328', '522328', '安龙县', '5223', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5226', '5226', '黔东南苗族侗族自治州', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522601', '522601', '凯里市', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522622', '522622', '黄平县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522623', '522623', '施秉县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522624', '522624', '三穗县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522625', '522625', '镇远县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522626', '522626', '岑巩县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522627', '522627', '天柱县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522628', '522628', '锦屏县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522629', '522629', '剑河县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522630', '522630', '台江县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522631', '522631', '黎平县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522632', '522632', '榕江县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522633', '522633', '从江县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522634', '522634', '雷山县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522635', '522635', '麻江县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522636', '522636', '丹寨县', '5226', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5227', '5227', '黔南布依族苗族自治州', '52', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522701', '522701', '都匀市', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522702', '522702', '福泉市', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522722', '522722', '荔波县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522723', '522723', '贵定县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522725', '522725', '瓮安县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522726', '522726', '独山县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522727', '522727', '平塘县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522728', '522728', '罗甸县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522729', '522729', '长顺县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522730', '522730', '龙里县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522731', '522731', '惠水县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('522732', '522732', '三都水族自治县', '5227', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('53', '53', '云南省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5301', '5301', '昆明市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530102', '530102', '五华区', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530103', '530103', '盘龙区', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530111', '530111', '官渡区', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530112', '530112', '西山区', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530113', '530113', '东川区', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530114', '530114', '呈贡区', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530115', '530115', '晋宁区', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530124', '530124', '富民县', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530125', '530125', '宜良县', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530126', '530126', '石林彝族自治县', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530127', '530127', '嵩明县', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530128', '530128', '禄劝彝族苗族自治县', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530129', '530129', '寻甸回族彝族自治县', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530181', '530181', '安宁市', '5301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5303', '5303', '曲靖市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530302', '530302', '麒麟区', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530303', '530303', '沾益区', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530304', '530304', '马龙区', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530322', '530322', '陆良县', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530323', '530323', '师宗县', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530324', '530324', '罗平县', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530325', '530325', '富源县', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530326', '530326', '会泽县', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530381', '530381', '宣威市', '5303', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5304', '5304', '玉溪市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530402', '530402', '红塔区', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530403', '530403', '江川区', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530423', '530423', '通海县', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530424', '530424', '华宁县', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530425', '530425', '易门县', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530426', '530426', '峨山彝族自治县', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530427', '530427', '新平彝族傣族自治县', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530428', '530428', '元江哈尼族彝族傣族自治县', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530481', '530481', '澄江市', '5304', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5305', '5305', '保山市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530502', '530502', '隆阳区', '5305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530521', '530521', '施甸县', '5305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530523', '530523', '龙陵县', '5305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530524', '530524', '昌宁县', '5305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530581', '530581', '腾冲市', '5305', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5306', '5306', '昭通市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530602', '530602', '昭阳区', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530621', '530621', '鲁甸县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530622', '530622', '巧家县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530623', '530623', '盐津县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530624', '530624', '大关县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530625', '530625', '永善县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530626', '530626', '绥江县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530627', '530627', '镇雄县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530628', '530628', '彝良县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530629', '530629', '威信县', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530681', '530681', '水富市', '5306', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5307', '5307', '丽江市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530702', '530702', '古城区', '5307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530721', '530721', '玉龙纳西族自治县', '5307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530722', '530722', '永胜县', '5307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530723', '530723', '华坪县', '5307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530724', '530724', '宁蒗彝族自治县', '5307', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5308', '5308', '普洱市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530802', '530802', '思茅区', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530821', '530821', '宁洱哈尼族彝族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530822', '530822', '墨江哈尼族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530823', '530823', '景东彝族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530824', '530824', '景谷傣族彝族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530825', '530825', '镇沅彝族哈尼族拉祜族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530826', '530826', '江城哈尼族彝族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530827', '530827', '孟连傣族拉祜族佤族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530828', '530828', '澜沧拉祜族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530829', '530829', '西盟佤族自治县', '5308', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5309', '5309', '临沧市', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530902', '530902', '临翔区', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530921', '530921', '凤庆县', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530922', '530922', '云县', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530923', '530923', '永德县', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530924', '530924', '镇康县', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530925', '530925', '双江拉祜族佤族布朗族傣族自治县', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530926', '530926', '耿马傣族佤族自治县', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('530927', '530927', '沧源佤族自治县', '5309', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5323', '5323', '楚雄彝族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532301', '532301', '楚雄市', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532322', '532322', '双柏县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532323', '532323', '牟定县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532324', '532324', '南华县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532325', '532325', '姚安县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532326', '532326', '大姚县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532327', '532327', '永仁县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532328', '532328', '元谋县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532329', '532329', '武定县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532331', '532331', '禄丰县', '5323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5325', '5325', '红河哈尼族彝族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532501', '532501', '个旧市', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532502', '532502', '开远市', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532503', '532503', '蒙自市', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532504', '532504', '弥勒市', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532523', '532523', '屏边苗族自治县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532524', '532524', '建水县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532525', '532525', '石屏县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532527', '532527', '泸西县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532528', '532528', '元阳县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532529', '532529', '红河县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532530', '532530', '金平苗族瑶族傣族自治县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532531', '532531', '绿春县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532532', '532532', '河口瑶族自治县', '5325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5326', '5326', '文山壮族苗族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532601', '532601', '文山市', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532622', '532622', '砚山县', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532623', '532623', '西畴县', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532624', '532624', '麻栗坡县', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532625', '532625', '马关县', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532626', '532626', '丘北县', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532627', '532627', '广南县', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532628', '532628', '富宁县', '5326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5328', '5328', '西双版纳傣族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532801', '532801', '景洪市', '5328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532822', '532822', '勐海县', '5328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532823', '532823', '勐腊县', '5328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5329', '5329', '大理白族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532901', '532901', '大理市', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532922', '532922', '漾濞彝族自治县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532923', '532923', '祥云县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532924', '532924', '宾川县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532925', '532925', '弥渡县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532926', '532926', '南涧彝族自治县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532927', '532927', '巍山彝族回族自治县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532928', '532928', '永平县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532929', '532929', '云龙县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532930', '532930', '洱源县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532931', '532931', '剑川县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('532932', '532932', '鹤庆县', '5329', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5331', '5331', '德宏傣族景颇族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533102', '533102', '瑞丽市', '5331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533103', '533103', '芒市', '5331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533122', '533122', '梁河县', '5331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533123', '533123', '盈江县', '5331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533124', '533124', '陇川县', '5331', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5333', '5333', '怒江傈僳族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533301', '533301', '泸水市', '5333', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533323', '533323', '福贡县', '5333', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533324', '533324', '贡山独龙族怒族自治县', '5333', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533325', '533325', '兰坪白族普米族自治县', '5333', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5334', '5334', '迪庆藏族自治州', '53', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533401', '533401', '香格里拉市', '5334', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533422', '533422', '德钦县', '5334', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('533423', '533423', '维西傈僳族自治县', '5334', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('54', '54', '西藏自治区', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5401', '5401', '拉萨市', '54', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540102', '540102', '城关区', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540103', '540103', '堆龙德庆区', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540104', '540104', '达孜区', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540121', '540121', '林周县', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540122', '540122', '当雄县', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540123', '540123', '尼木县', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540124', '540124', '曲水县', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540127', '540127', '墨竹工卡县', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540171', '540171', '格尔木藏青工业园区', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540172', '540172', '拉萨经济技术开发区', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540173', '540173', '西藏文化旅游创意园区', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540174', '540174', '达孜工业园区', '5401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5402', '5402', '日喀则市', '54', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540202', '540202', '桑珠孜区', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540221', '540221', '南木林县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540222', '540222', '江孜县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540223', '540223', '定日县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540224', '540224', '萨迦县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540225', '540225', '拉孜县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540226', '540226', '昂仁县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540227', '540227', '谢通门县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540228', '540228', '白朗县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540229', '540229', '仁布县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540230', '540230', '康马县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540231', '540231', '定结县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540232', '540232', '仲巴县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540233', '540233', '亚东县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540234', '540234', '吉隆县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540235', '540235', '聂拉木县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540236', '540236', '萨嘎县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540237', '540237', '岗巴县', '5402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5403', '5403', '昌都市', '54', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540302', '540302', '卡若区', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540321', '540321', '江达县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540322', '540322', '贡觉县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540323', '540323', '类乌齐县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540324', '540324', '丁青县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540325', '540325', '察雅县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540326', '540326', '八宿县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540327', '540327', '左贡县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540328', '540328', '芒康县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540329', '540329', '洛隆县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540330', '540330', '边坝县', '5403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5404', '5404', '林芝市', '54', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540402', '540402', '巴宜区', '5404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540421', '540421', '工布江达县', '5404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540422', '540422', '米林县', '5404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540423', '540423', '墨脱县', '5404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540424', '540424', '波密县', '5404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540425', '540425', '察隅县', '5404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540426', '540426', '朗县', '5404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5405', '5405', '山南市', '54', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540502', '540502', '乃东区', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540521', '540521', '扎囊县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540522', '540522', '贡嘎县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540523', '540523', '桑日县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540524', '540524', '琼结县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540525', '540525', '曲松县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540526', '540526', '措美县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540527', '540527', '洛扎县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540528', '540528', '加查县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540529', '540529', '隆子县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540530', '540530', '错那县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540531', '540531', '浪卡子县', '5405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5406', '5406', '那曲市', '54', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540602', '540602', '色尼区', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540621', '540621', '嘉黎县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540622', '540622', '比如县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540623', '540623', '聂荣县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540624', '540624', '安多县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540625', '540625', '申扎县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540626', '540626', '索县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540627', '540627', '班戈县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540628', '540628', '巴青县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540629', '540629', '尼玛县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('540630', '540630', '双湖县', '5406', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('5425', '5425', '阿里地区', '54', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('542521', '542521', '普兰县', '5425', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('542522', '542522', '札达县', '5425', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('542523', '542523', '噶尔县', '5425', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('542524', '542524', '日土县', '5425', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('542525', '542525', '革吉县', '5425', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('542526', '542526', '改则县', '5425', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('542527', '542527', '措勤县', '5425', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('61', '61', '陕西省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6101', '6101', '西安市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610102', '610102', '新城区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610103', '610103', '碑林区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610104', '610104', '莲湖区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610111', '610111', '灞桥区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610112', '610112', '未央区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610113', '610113', '雁塔区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610114', '610114', '阎良区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610115', '610115', '临潼区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610116', '610116', '长安区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610117', '610117', '高陵区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610118', '610118', '鄠邑区', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610122', '610122', '蓝田县', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610124', '610124', '周至县', '6101', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6102', '6102', '铜川市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610202', '610202', '王益区', '6102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610203', '610203', '印台区', '6102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610204', '610204', '耀州区', '6102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610222', '610222', '宜君县', '6102', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6103', '6103', '宝鸡市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610302', '610302', '渭滨区', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610303', '610303', '金台区', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610304', '610304', '陈仓区', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610322', '610322', '凤翔县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610323', '610323', '岐山县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610324', '610324', '扶风县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610326', '610326', '眉县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610327', '610327', '陇县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610328', '610328', '千阳县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610329', '610329', '麟游县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610330', '610330', '凤县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610331', '610331', '太白县', '6103', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6104', '6104', '咸阳市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610402', '610402', '秦都区', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610403', '610403', '杨陵区', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610404', '610404', '渭城区', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610422', '610422', '三原县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610423', '610423', '泾阳县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610424', '610424', '乾县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610425', '610425', '礼泉县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610426', '610426', '永寿县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610428', '610428', '长武县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610429', '610429', '旬邑县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610430', '610430', '淳化县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610431', '610431', '武功县', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610481', '610481', '兴平市', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610482', '610482', '彬州市', '6104', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6105', '6105', '渭南市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610502', '610502', '临渭区', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610503', '610503', '华州区', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610522', '610522', '潼关县', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610523', '610523', '大荔县', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610524', '610524', '合阳县', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610525', '610525', '澄城县', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610526', '610526', '蒲城县', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610527', '610527', '白水县', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610528', '610528', '富平县', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610581', '610581', '韩城市', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610582', '610582', '华阴市', '6105', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6106', '6106', '延安市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610602', '610602', '宝塔区', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610603', '610603', '安塞区', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610621', '610621', '延长县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610622', '610622', '延川县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610625', '610625', '志丹县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610626', '610626', '吴起县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610627', '610627', '甘泉县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610628', '610628', '富县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610629', '610629', '洛川县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610630', '610630', '宜川县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610631', '610631', '黄龙县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610632', '610632', '黄陵县', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610681', '610681', '子长市', '6106', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6107', '6107', '汉中市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610702', '610702', '汉台区', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610703', '610703', '南郑区', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610722', '610722', '城固县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610723', '610723', '洋县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610724', '610724', '西乡县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610725', '610725', '勉县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610726', '610726', '宁强县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610727', '610727', '略阳县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610728', '610728', '镇巴县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610729', '610729', '留坝县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610730', '610730', '佛坪县', '6107', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6108', '6108', '榆林市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610802', '610802', '榆阳区', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610803', '610803', '横山区', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610822', '610822', '府谷县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610824', '610824', '靖边县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610825', '610825', '定边县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610826', '610826', '绥德县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610827', '610827', '米脂县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610828', '610828', '佳县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610829', '610829', '吴堡县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610830', '610830', '清涧县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610831', '610831', '子洲县', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610881', '610881', '神木市', '6108', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6109', '6109', '安康市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610902', '610902', '汉滨区', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610921', '610921', '汉阴县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610922', '610922', '石泉县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610923', '610923', '宁陕县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610924', '610924', '紫阳县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610925', '610925', '岚皋县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610926', '610926', '平利县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610927', '610927', '镇坪县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610928', '610928', '旬阳县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('610929', '610929', '白河县', '6109', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6110', '6110', '商洛市', '61', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('611002', '611002', '商州区', '6110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('611021', '611021', '洛南县', '6110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('611022', '611022', '丹凤县', '6110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('611023', '611023', '商南县', '6110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('611024', '611024', '山阳县', '6110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('611025', '611025', '镇安县', '6110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('611026', '611026', '柞水县', '6110', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('62', '62', '甘肃省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6201', '6201', '兰州市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620102', '620102', '城关区', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620103', '620103', '七里河区', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620104', '620104', '西固区', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620105', '620105', '安宁区', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620111', '620111', '红古区', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620121', '620121', '永登县', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620122', '620122', '皋兰县', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620123', '620123', '榆中县', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620171', '620171', '兰州新区', '6201', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6202', '6202', '嘉峪关市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620201001', '620201001', '雄关街道', '6202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620201002', '620201002', '钢城街道', '6202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620201100', '620201100', '新城镇', '6202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620201101', '620201101', '峪泉镇', '6202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620201102', '620201102', '文殊镇', '6202', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6203', '6203', '金昌市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620302', '620302', '金川区', '6203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620321', '620321', '永昌县', '6203', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6204', '6204', '白银市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620402', '620402', '白银区', '6204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620403', '620403', '平川区', '6204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620421', '620421', '靖远县', '6204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620422', '620422', '会宁县', '6204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620423', '620423', '景泰县', '6204', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6205', '6205', '天水市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620502', '620502', '秦州区', '6205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620503', '620503', '麦积区', '6205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620521', '620521', '清水县', '6205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620522', '620522', '秦安县', '6205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620523', '620523', '甘谷县', '6205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620524', '620524', '武山县', '6205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620525', '620525', '张家川回族自治县', '6205', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6206', '6206', '武威市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620602', '620602', '凉州区', '6206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620621', '620621', '民勤县', '6206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620622', '620622', '古浪县', '6206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620623', '620623', '天祝藏族自治县', '6206', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6207', '6207', '张掖市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620702', '620702', '甘州区', '6207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620721', '620721', '肃南裕固族自治县', '6207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620722', '620722', '民乐县', '6207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620723', '620723', '临泽县', '6207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620724', '620724', '高台县', '6207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620725', '620725', '山丹县', '6207', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6208', '6208', '平凉市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620802', '620802', '崆峒区', '6208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620821', '620821', '泾川县', '6208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620822', '620822', '灵台县', '6208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620823', '620823', '崇信县', '6208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620825', '620825', '庄浪县', '6208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620826', '620826', '静宁县', '6208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620881', '620881', '华亭市', '6208', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6209', '6209', '酒泉市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620902', '620902', '肃州区', '6209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620921', '620921', '金塔县', '6209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620922', '620922', '瓜州县', '6209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620923', '620923', '肃北蒙古族自治县', '6209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620924', '620924', '阿克塞哈萨克族自治县', '6209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620981', '620981', '玉门市', '6209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('620982', '620982', '敦煌市', '6209', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6210', '6210', '庆阳市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621002', '621002', '西峰区', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621021', '621021', '庆城县', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621022', '621022', '环县', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621023', '621023', '华池县', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621024', '621024', '合水县', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621025', '621025', '正宁县', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621026', '621026', '宁县', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621027', '621027', '镇原县', '6210', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6211', '6211', '定西市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621102', '621102', '安定区', '6211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621121', '621121', '通渭县', '6211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621122', '621122', '陇西县', '6211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621123', '621123', '渭源县', '6211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621124', '621124', '临洮县', '6211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621125', '621125', '漳县', '6211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621126', '621126', '岷县', '6211', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6212', '6212', '陇南市', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621202', '621202', '武都区', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621221', '621221', '成县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621222', '621222', '文县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621223', '621223', '宕昌县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621224', '621224', '康县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621225', '621225', '西和县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621226', '621226', '礼县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621227', '621227', '徽县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('621228', '621228', '两当县', '6212', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6229', '6229', '临夏回族自治州', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622901', '622901', '临夏市', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622921', '622921', '临夏县', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622922', '622922', '康乐县', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622923', '622923', '永靖县', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622924', '622924', '广河县', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622925', '622925', '和政县', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622926', '622926', '东乡族自治县', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('622927', '622927', '积石山保安族东乡族撒拉族自治县', '6229', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6230', '6230', '甘南藏族自治州', '62', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623001', '623001', '合作市', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623021', '623021', '临潭县', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623022', '623022', '卓尼县', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623023', '623023', '舟曲县', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623024', '623024', '迭部县', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623025', '623025', '玛曲县', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623026', '623026', '碌曲县', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('623027', '623027', '夏河县', '6230', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('63', '63', '青海省', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6301', '6301', '西宁市', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630102', '630102', '城东区', '6301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630103', '630103', '城中区', '6301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630104', '630104', '城西区', '6301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630105', '630105', '城北区', '6301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630106', '630106', '湟中区', '6301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630121', '630121', '大通回族土族自治县', '6301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630123', '630123', '湟源县', '6301', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6302', '6302', '海东市', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630202', '630202', '乐都区', '6302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630203', '630203', '平安区', '6302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630222', '630222', '民和回族土族自治县', '6302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630223', '630223', '互助土族自治县', '6302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630224', '630224', '化隆回族自治县', '6302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('630225', '630225', '循化撒拉族自治县', '6302', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6322', '6322', '海北藏族自治州', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632221', '632221', '门源回族自治县', '6322', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632222', '632222', '祁连县', '6322', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632223', '632223', '海晏县', '6322', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632224', '632224', '刚察县', '6322', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6323', '6323', '黄南藏族自治州', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632321', '632321', '同仁县', '6323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632322', '632322', '尖扎县', '6323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632323', '632323', '泽库县', '6323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632324', '632324', '河南蒙古族自治县', '6323', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6325', '6325', '海南藏族自治州', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632521', '632521', '共和县', '6325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632522', '632522', '同德县', '6325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632523', '632523', '贵德县', '6325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632524', '632524', '兴海县', '6325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632525', '632525', '贵南县', '6325', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6326', '6326', '果洛藏族自治州', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632621', '632621', '玛沁县', '6326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632622', '632622', '班玛县', '6326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632623', '632623', '甘德县', '6326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632624', '632624', '达日县', '6326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632625', '632625', '久治县', '6326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632626', '632626', '玛多县', '6326', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6327', '6327', '玉树藏族自治州', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632701', '632701', '玉树市', '6327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632722', '632722', '杂多县', '6327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632723', '632723', '称多县', '6327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632724', '632724', '治多县', '6327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632725', '632725', '囊谦县', '6327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632726', '632726', '曲麻莱县', '6327', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6328', '6328', '海西蒙古族藏族自治州', '63', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632801', '632801', '格尔木市', '6328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632802', '632802', '德令哈市', '6328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632803', '632803', '茫崖市', '6328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632821', '632821', '乌兰县', '6328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632822', '632822', '都兰县', '6328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632823', '632823', '天峻县', '6328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('632857', '632857', '大柴旦行政委员会', '6328', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('64', '64', '宁夏回族自治区', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6401', '6401', '银川市', '64', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640104', '640104', '兴庆区', '6401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640105', '640105', '西夏区', '6401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640106', '640106', '金凤区', '6401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640121', '640121', '永宁县', '6401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640122', '640122', '贺兰县', '6401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640181', '640181', '灵武市', '6401', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6402', '6402', '石嘴山市', '64', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640202', '640202', '大武口区', '6402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640205', '640205', '惠农区', '6402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640221', '640221', '平罗县', '6402', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6403', '6403', '吴忠市', '64', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640302', '640302', '利通区', '6403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640303', '640303', '红寺堡区', '6403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640323', '640323', '盐池县', '6403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640324', '640324', '同心县', '6403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640381', '640381', '青铜峡市', '6403', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6404', '6404', '固原市', '64', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640402', '640402', '原州区', '6404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640422', '640422', '西吉县', '6404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640423', '640423', '隆德县', '6404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640424', '640424', '泾源县', '6404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640425', '640425', '彭阳县', '6404', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6405', '6405', '中卫市', '64', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640502', '640502', '沙坡头区', '6405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640521', '640521', '中宁县', '6405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('640522', '640522', '海原县', '6405', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('65', '65', '新疆维吾尔自治区', NULL, 1); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6501', '6501', '乌鲁木齐市', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650102', '650102', '天山区', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650103', '650103', '沙依巴克区', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650104', '650104', '新市区', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650105', '650105', '水磨沟区', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650106', '650106', '头屯河区', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650107', '650107', '达坂城区', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650109', '650109', '米东区', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650121', '650121', '乌鲁木齐县', '6501', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6502', '6502', '克拉玛依市', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650202', '650202', '独山子区', '6502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650203', '650203', '克拉玛依区', '6502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650204', '650204', '白碱滩区', '6502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650205', '650205', '乌尔禾区', '6502', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6504', '6504', '吐鲁番市', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650402', '650402', '高昌区', '6504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650421', '650421', '鄯善县', '6504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650422', '650422', '托克逊县', '6504', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6505', '6505', '哈密市', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650502', '650502', '伊州区', '6505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650521', '650521', '巴里坤哈萨克自治县', '6505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('650522', '650522', '伊吾县', '6505', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6523', '6523', '昌吉回族自治州', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652301', '652301', '昌吉市', '6523', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652302', '652302', '阜康市', '6523', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652323', '652323', '呼图壁县', '6523', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652324', '652324', '玛纳斯县', '6523', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652325', '652325', '奇台县', '6523', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652327', '652327', '吉木萨尔县', '6523', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652328', '652328', '木垒哈萨克自治县', '6523', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6527', '6527', '博尔塔拉蒙古自治州', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652701', '652701', '博乐市', '6527', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652702', '652702', '阿拉山口市', '6527', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652722', '652722', '精河县', '6527', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652723', '652723', '温泉县', '6527', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6528', '6528', '巴音郭楞蒙古自治州', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652801', '652801', '库尔勒市', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652822', '652822', '轮台县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652823', '652823', '尉犁县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652824', '652824', '若羌县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652825', '652825', '且末县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652826', '652826', '焉耆回族自治县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652827', '652827', '和静县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652828', '652828', '和硕县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652829', '652829', '博湖县', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652871', '652871', '库尔勒经济技术开发区', '6528', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6529', '6529', '阿克苏地区', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652901', '652901', '阿克苏市', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652902', '652902', '库车市', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652922', '652922', '温宿县', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652924', '652924', '沙雅县', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652925', '652925', '新和县', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652926', '652926', '拜城县', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652927', '652927', '乌什县', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652928', '652928', '阿瓦提县', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('652929', '652929', '柯坪县', '6529', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6530', '6530', '克孜勒苏柯尔克孜自治州', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653001', '653001', '阿图什市', '6530', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653022', '653022', '阿克陶县', '6530', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653023', '653023', '阿合奇县', '6530', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653024', '653024', '乌恰县', '6530', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6531', '6531', '喀什地区', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653101', '653101', '喀什市', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653121', '653121', '疏附县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653122', '653122', '疏勒县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653123', '653123', '英吉沙县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653124', '653124', '泽普县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653125', '653125', '莎车县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653126', '653126', '叶城县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653127', '653127', '麦盖提县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653128', '653128', '岳普湖县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653129', '653129', '伽师县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653130', '653130', '巴楚县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653131', '653131', '塔什库尔干塔吉克自治县', '6531', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6532', '6532', '和田地区', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653201', '653201', '和田市', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653221', '653221', '和田县', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653222', '653222', '墨玉县', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653223', '653223', '皮山县', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653224', '653224', '洛浦县', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653225', '653225', '策勒县', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653226', '653226', '于田县', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('653227', '653227', '民丰县', '6532', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6540', '6540', '伊犁哈萨克自治州', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654002', '654002', '伊宁市', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654003', '654003', '奎屯市', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654004', '654004', '霍尔果斯市', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654021', '654021', '伊宁县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654022', '654022', '察布查尔锡伯自治县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654023', '654023', '霍城县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654024', '654024', '巩留县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654025', '654025', '新源县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654026', '654026', '昭苏县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654027', '654027', '特克斯县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654028', '654028', '尼勒克县', '6540', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6542', '6542', '塔城地区', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654201', '654201', '塔城市', '6542', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654202', '654202', '乌苏市', '6542', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654221', '654221', '额敏县', '6542', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654223', '654223', '沙湾县', '6542', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654224', '654224', '托里县', '6542', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654225', '654225', '裕民县', '6542', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654226', '654226', '和布克赛尔蒙古自治县', '6542', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6543', '6543', '阿勒泰地区', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654301', '654301', '阿勒泰市', '6543', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654321', '654321', '布尔津县', '6543', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654322', '654322', '富蕴县', '6543', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654323', '654323', '福海县', '6543', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654324', '654324', '哈巴河县', '6543', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654325', '654325', '青河县', '6543', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('654326', '654326', '吉木乃县', '6543', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('6590', '6590', '自治区直辖县级行政区划', '65', 2); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659001', '659001', '石河子市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659002', '659002', '阿拉尔市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659003', '659003', '图木舒克市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659004', '659004', '五家渠市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659005', '659005', '北屯市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659006', '659006', '铁门关市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659007', '659007', '双河市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659008', '659008', '可克达拉市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659009', '659009', '昆玉市', '6590', 3); +INSERT INTO `dic_city` (`id`, `code`, `name`, `parent_id`, `level`) VALUES ('659010', '659010', '胡杨河市', '6590', 3); +COMMIT; + +-- ---------------------------- +-- Table structure for gen_create_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_create_column_config`; +CREATE TABLE `gen_create_column_config` ( + `id` varchar(32) NOT NULL, + `required` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否必填', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='新增功能代码生成配置'; + +-- ---------------------------- +-- Records of gen_create_column_config +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_form +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_form`; +CREATE TABLE `gen_custom_form` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(20) NOT NULL COMMENT '名称', + `category_id` varchar(32) DEFAULT NULL COMMENT '分类ID', + `is_dialog` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否对话框表单', + `dialog_tittle` varchar(100) DEFAULT NULL COMMENT '对话框标题', + `dialog_width` varchar(100) DEFAULT '1' COMMENT '对话框宽度', + `form_config` longtext NOT NULL COMMENT '表单配置', + `prefix_submit` longtext COMMENT '前置提交脚本', + `suffix_submit` longtext COMMENT '后置提交脚本', + `require_query` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要查询', + `query_bean` longtext COMMENT '查询数据Bean名称', + `handle_bean` longtext COMMENT '操作数据Bean名称', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + KEY `category_id` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义对话框'; + +-- ---------------------------- +-- Records of gen_custom_form +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_form_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_form_category`; +CREATE TABLE `gen_custom_form_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义列表分类'; + +-- ---------------------------- +-- Records of gen_custom_form_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_list +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list`; +CREATE TABLE `gen_custom_list` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(20) NOT NULL COMMENT '名称', + `category_id` varchar(32) DEFAULT NULL COMMENT '分类ID', + `data_obj_id` varchar(32) NOT NULL DEFAULT '1' COMMENT '数据对象ID', + `list_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '列表类型', + `label_width` int(11) NOT NULL COMMENT '表单Label宽度', + `has_page` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否分页', + `tree_data` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否树形列表', + `id_column` varchar(32) DEFAULT NULL COMMENT 'ID字段', + `id_column_rela_id` varchar(32) DEFAULT NULL COMMENT 'ID字段关联ID', + `tree_pid_column` varchar(32) DEFAULT NULL COMMENT '父级ID字段', + `tree_pid_column_rela_id` varchar(32) DEFAULT NULL COMMENT '父级ID字段关联ID', + `tree_node_column` varchar(32) DEFAULT NULL COMMENT '树形节点字段', + `tree_node_column_rela_id` varchar(32) DEFAULT NULL COMMENT '树形节点字段关联ID', + `tree_children_key` varchar(100) DEFAULT NULL COMMENT '子节点Key值', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `query_prefix_sql` longtext COMMENT '查询前置SQL', + `query_suffix_sql` longtext COMMENT '查询后置SQL', + `suffix_sql` longtext COMMENT '后置SQL', + `allow_export` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否允许导出', + PRIMARY KEY (`id`) USING BTREE, + KEY `category_id` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义列表'; + +-- ---------------------------- +-- Records of gen_custom_list +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_list_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_category`; +CREATE TABLE `gen_custom_list_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义列表分类'; + +-- ---------------------------- +-- Records of gen_custom_list_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_list_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_detail`; +CREATE TABLE `gen_custom_list_detail` ( + `id` varchar(32) NOT NULL, + `custom_list_id` varchar(32) NOT NULL COMMENT '自定义列表ID', + `rela_id` varchar(32) DEFAULT NULL COMMENT '关联ID', + `data_entity_id` varchar(32) DEFAULT NULL COMMENT '数据实体ID', + `width_type` tinyint(3) NOT NULL COMMENT '宽度类型', + `width` int(11) NOT NULL COMMENT '宽度', + `sortable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否页面排序', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `type` tinyint(3) NOT NULL COMMENT '类型', + `formatter` longtext COMMENT '格式化脚本', + PRIMARY KEY (`id`) USING BTREE, + KEY `custom_list_id` (`custom_list_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义列表明细'; + +-- ---------------------------- +-- Records of gen_custom_list_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_list_handle_column +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_handle_column`; +CREATE TABLE `gen_custom_list_handle_column` ( + `id` varchar(32) NOT NULL, + `custom_list_id` varchar(32) NOT NULL COMMENT '自定义列表ID', + `name` varchar(32) NOT NULL COMMENT '显示名称', + `view_type` varchar(20) NOT NULL COMMENT '显示类型', + `btn_type` tinyint(3) NOT NULL COMMENT '按钮类型', + `btn_config` longtext COMMENT '按钮配置', + `request_param` longtext COMMENT '请求参数', + `icon` varchar(100) DEFAULT NULL COMMENT '图标', + `width` int(11) NOT NULL COMMENT '宽度', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义列表工具栏'; + +-- ---------------------------- +-- Records of gen_custom_list_handle_column +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_list_query_params +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_query_params`; +CREATE TABLE `gen_custom_list_query_params` ( + `id` varchar(32) NOT NULL, + `custom_list_id` varchar(32) NOT NULL COMMENT '自定义列表ID', + `rela_id` varchar(32) NOT NULL COMMENT '关联ID', + `data_entity_id` varchar(32) NOT NULL COMMENT '数据实体ID', + `front_show` tinyint(1) NOT NULL DEFAULT '1' COMMENT '前端显示', + `query_type` tinyint(3) NOT NULL COMMENT '查询类型', + `form_width` int(11) NOT NULL DEFAULT '6' COMMENT '表单宽度', + `default_value` longtext COMMENT '默认值', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `type` tinyint(3) NOT NULL COMMENT '类型', + PRIMARY KEY (`id`) USING BTREE, + KEY `custom_list_id` (`custom_list_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义列表查询参数'; + +-- ---------------------------- +-- Records of gen_custom_list_query_params +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_list_toolbar +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_list_toolbar`; +CREATE TABLE `gen_custom_list_toolbar` ( + `id` varchar(32) NOT NULL, + `custom_list_id` varchar(32) NOT NULL COMMENT '自定义列表ID', + `name` varchar(32) NOT NULL COMMENT '显示名称', + `view_type` varchar(20) NOT NULL COMMENT '显示类型', + `btn_type` tinyint(3) NOT NULL COMMENT '按钮类型', + `btn_config` longtext COMMENT '按钮配置', + `request_param` longtext COMMENT '请求参数', + `icon` varchar(100) DEFAULT NULL COMMENT '图标', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义列表工具栏'; + +-- ---------------------------- +-- Records of gen_custom_list_toolbar +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_selector +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_selector`; +CREATE TABLE `gen_custom_selector` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(20) NOT NULL COMMENT '名称', + `category_id` varchar(32) DEFAULT NULL COMMENT '分类ID', + `custom_list_id` varchar(32) NOT NULL DEFAULT '1' COMMENT '数据对象ID', + `dialog_tittle` varchar(100) DEFAULT NULL COMMENT '对话框标题', + `dialog_width` varchar(100) NOT NULL DEFAULT '1' COMMENT '对话框宽度', + `placeholder` varchar(100) DEFAULT NULL COMMENT '占位符', + `id_column` varchar(32) DEFAULT NULL COMMENT 'ID字段', + `id_column_rela_id` varchar(32) DEFAULT NULL COMMENT 'ID字段关联ID', + `name_column` varchar(32) DEFAULT NULL COMMENT '名称ID字段', + `name_column_rela_id` varchar(32) DEFAULT NULL COMMENT '名称ID字段关联ID', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + KEY `category_id` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义对话框'; + +-- ---------------------------- +-- Records of gen_custom_selector +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_custom_selector_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_custom_selector_category`; +CREATE TABLE `gen_custom_selector_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义对话框分类'; + +-- ---------------------------- +-- Records of gen_custom_selector_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_data_entity +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_entity`; +CREATE TABLE `gen_data_entity` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(20) NOT NULL COMMENT '名称', + `category_id` varchar(32) DEFAULT NULL COMMENT '分类ID', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `gen_status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态', + `table_schema` varchar(64) NOT NULL COMMENT '数据表所属的数据库名', + `table_name` varchar(64) NOT NULL COMMENT '数据库表名', + `engine` varchar(64) DEFAULT NULL COMMENT '数据库引擎', + `table_collation` varchar(32) DEFAULT NULL COMMENT '字符校验编码集', + `table_comment` varchar(2048) NOT NULL COMMENT '备注', + `convert_type` tinyint(3) NOT NULL COMMENT '转换方式', + PRIMARY KEY (`id`) USING BTREE, + KEY `category_id` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据实体'; + +-- ---------------------------- +-- Records of gen_data_entity +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_data_entity_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_entity_category`; +CREATE TABLE `gen_data_entity_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据实体分类'; + +-- ---------------------------- +-- Records of gen_data_entity_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_data_entity_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_entity_detail`; +CREATE TABLE `gen_data_entity_detail` ( + `id` varchar(32) NOT NULL, + `entity_id` varchar(32) NOT NULL COMMENT '实体ID', + `name` varchar(64) NOT NULL COMMENT '字段显示名称', + `column_name` varchar(64) NOT NULL COMMENT '字段名称', + `is_key` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否主键', + `data_type` tinyint(3) NOT NULL COMMENT '数据类型', + `column_order` int(11) NOT NULL COMMENT '排序编号', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `view_type` tinyint(3) NOT NULL COMMENT '显示类型', + `data_dic_id` varchar(32) DEFAULT NULL COMMENT '数据字典ID', + `custom_selector_id` varchar(32) DEFAULT NULL COMMENT '自定义选择器ID', + `fix_enum` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否内置枚举', + `enum_back` varchar(200) DEFAULT NULL COMMENT '后端枚举名', + `enum_front` varchar(200) DEFAULT NULL COMMENT '前端枚举名', + `regular_expression` varchar(200) DEFAULT NULL COMMENT '正则表达式', + `is_order` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否排序字段', + `order_type` varchar(20) DEFAULT NULL COMMENT '排序类型', + `len` bigint(20) DEFAULT NULL COMMENT '长度', + `decimals` int(11) DEFAULT NULL COMMENT '小数位数', + `db_column_name` varchar(64) NOT NULL COMMENT '字段名', + `db_data_type` varchar(64) NOT NULL DEFAULT '' COMMENT '字段数据类型', + `is_nullable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否允许为空', + `column_default` longtext COMMENT '默认值', + `ordinal_position` bigint(21) unsigned NOT NULL DEFAULT '0' COMMENT '字段排序', + `column_comment` varchar(1024) NOT NULL DEFAULT '' COMMENT '字段备注', + `db_len` bigint(20) DEFAULT NULL COMMENT '长度', + `db_decimals` int(11) DEFAULT NULL COMMENT '小数位数', + PRIMARY KEY (`id`) USING BTREE, + KEY `entity_id` (`entity_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据实体明细'; + +-- ---------------------------- +-- Records of gen_data_entity_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_data_obj +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj`; +CREATE TABLE `gen_data_obj` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(20) NOT NULL COMMENT '名称', + `category_id` varchar(32) DEFAULT NULL COMMENT '分类ID', + `main_table_id` varchar(32) NOT NULL DEFAULT '1' COMMENT '主表ID', + `main_table_alias` varchar(200) NOT NULL COMMENT '主表别名', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + KEY `category_id` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据对象'; + +-- ---------------------------- +-- Records of gen_data_obj +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_data_obj_category +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj_category`; +CREATE TABLE `gen_data_obj_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据实体分类'; + +-- ---------------------------- +-- Records of gen_data_obj_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_data_obj_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj_detail`; +CREATE TABLE `gen_data_obj_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `data_obj_id` varchar(32) NOT NULL COMMENT '数据对象ID', + `main_table_detail_ids` longtext NOT NULL COMMENT '主表字段', + `rela_type` tinyint(3) NOT NULL COMMENT '关联类型', + `rela_mode` tinyint(3) NOT NULL COMMENT '关联方式', + `sub_table_id` varchar(32) NOT NULL COMMENT '子表ID', + `sub_table_alias` varchar(200) NOT NULL COMMENT '子表别名', + `sub_table_detail_ids` longtext NOT NULL COMMENT '子表字段', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`), + KEY `data_obj_id` (`data_obj_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据对象明细'; + +-- ---------------------------- +-- Records of gen_data_obj_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_data_obj_query_detail +-- ---------------------------- +DROP TABLE IF EXISTS `gen_data_obj_query_detail`; +CREATE TABLE `gen_data_obj_query_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `data_obj_id` varchar(32) NOT NULL COMMENT '数据对象ID', + `custom_name` varchar(200) NOT NULL COMMENT '显示名称', + `custom_sql` longtext NOT NULL COMMENT '自定义SQL', + `custom_alias` varchar(200) NOT NULL COMMENT '自定义别名', + `data_type` tinyint(3) NOT NULL COMMENT '数据类型', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`), + KEY `data_obj_id` (`data_obj_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据对象自定义查询明细'; + +-- ---------------------------- +-- Records of gen_data_obj_query_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_detail_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_detail_column_config`; +CREATE TABLE `gen_detail_column_config` ( + `id` varchar(32) NOT NULL, + `span` int(11) NOT NULL COMMENT '列宽', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='详情功能代码生成配置'; + +-- ---------------------------- +-- Records of gen_detail_column_config +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_generate_info +-- ---------------------------- +DROP TABLE IF EXISTS `gen_generate_info`; +CREATE TABLE `gen_generate_info` ( + `id` varchar(32) NOT NULL, + `template_type` tinyint(3) NOT NULL COMMENT '生成模板类型', + `package_name` varchar(200) NOT NULL COMMENT '包名', + `module_name` varchar(200) NOT NULL COMMENT '模块名', + `biz_name` varchar(200) NOT NULL COMMENT '业务名', + `class_name` varchar(200) NOT NULL COMMENT '类名', + `parent_menu_id` varchar(32) DEFAULT NULL COMMENT '父级菜单ID', + `key_type` tinyint(3) NOT NULL COMMENT '主键类型', + `author` varchar(100) DEFAULT NULL COMMENT '作者', + `class_description` varchar(200) NOT NULL COMMENT '类描述', + `menu_code` varchar(20) NOT NULL COMMENT '本级菜单编号', + `menu_name` varchar(200) NOT NULL COMMENT '本级菜单名称', + `detail_span` int(11) NOT NULL COMMENT '详情页Span总数量', + `is_cache` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否应用缓存', + `has_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否内置删除功能', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成基本信息'; + +-- ---------------------------- +-- Records of gen_generate_info +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_query_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_query_column_config`; +CREATE TABLE `gen_query_column_config` ( + `id` varchar(32) NOT NULL, + `width_type` tinyint(3) NOT NULL COMMENT '宽度类型', + `width` int(11) NOT NULL COMMENT '宽度', + `sortable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否页面排序', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='查询功能代码生成配置'; + +-- ---------------------------- +-- Records of gen_query_column_config +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_query_params_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_query_params_column_config`; +CREATE TABLE `gen_query_params_column_config` ( + `id` varchar(32) NOT NULL, + `query_type` tinyint(3) NOT NULL COMMENT '查询类型', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='查询参数功能代码生成配置'; + +-- ---------------------------- +-- Records of gen_query_params_column_config +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_simple_table +-- ---------------------------- +DROP TABLE IF EXISTS `gen_simple_table`; +CREATE TABLE `gen_simple_table` ( + `id` varchar(32) NOT NULL, + `table_schema` varchar(64) NOT NULL COMMENT '数据表所属的数据库名', + `table_name` varchar(64) NOT NULL COMMENT '数据库表名', + `engine` varchar(64) DEFAULT NULL COMMENT '数据库引擎', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `table_collation` varchar(32) DEFAULT NULL COMMENT '字符校验编码集', + `table_comment` varchar(2048) NOT NULL COMMENT '备注', + `convert_type` tinyint(3) NOT NULL COMMENT '转换方式', + PRIMARY KEY (`id`), + KEY `table_schema` (`table_schema`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据库单表'; + +-- ---------------------------- +-- Records of gen_simple_table +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_simple_table_column +-- ---------------------------- +DROP TABLE IF EXISTS `gen_simple_table_column`; +CREATE TABLE `gen_simple_table_column` ( + `id` varchar(32) NOT NULL, + `table_id` varchar(32) NOT NULL, + `column_name` varchar(64) NOT NULL COMMENT '字段名', + `data_type` varchar(64) NOT NULL DEFAULT '' COMMENT '字段数据类型', + `is_nullable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否允许为空', + `is_key` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否主键', + `column_default` longtext COMMENT '默认值', + `ordinal_position` bigint(21) unsigned NOT NULL DEFAULT '0' COMMENT '字段排序', + `column_comment` varchar(1024) NOT NULL DEFAULT '' COMMENT '字段备注', + `len` bigint(20) DEFAULT NULL COMMENT '长度', + `decimals` int(11) DEFAULT NULL COMMENT '小数位数', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据库单表列信息'; + +-- ---------------------------- +-- Records of gen_simple_table_column +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_update_column_config +-- ---------------------------- +DROP TABLE IF EXISTS `gen_update_column_config`; +CREATE TABLE `gen_update_column_config` ( + `id` varchar(32) NOT NULL, + `required` tinyint(1) NOT NULL DEFAULT '0', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='修改功能代码生成配置'; + +-- ---------------------------- +-- Records of gen_update_column_config +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for op_logs +-- ---------------------------- +DROP TABLE IF EXISTS `op_logs`; +CREATE TABLE `op_logs` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(200) NOT NULL COMMENT '日志名称', + `log_type` tinyint(3) NOT NULL COMMENT '类别', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `extra` longtext COMMENT '补充信息', + `ip` varchar(100) NOT NULL COMMENT 'IP地址', + PRIMARY KEY (`id`), + KEY `create_by` (`create_by`), + KEY `create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='操作日志'; + +-- ---------------------------- +-- Records of op_logs +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for recursion_mapping +-- ---------------------------- +DROP TABLE IF EXISTS `recursion_mapping`; +CREATE TABLE `recursion_mapping` ( + `id` varchar(32) NOT NULL, + `node_id` varchar(32) NOT NULL COMMENT '节点ID', + `node_type` tinyint(3) NOT NULL COMMENT '节点类型', + `path` longtext COMMENT '从顶点到当前结点的路径,用,分割', + `level` int(11) NOT NULL COMMENT '节点层级', + PRIMARY KEY (`id`), + UNIQUE KEY `node_id` (`node_id`,`node_type`) USING BTREE, + KEY `node_type` (`node_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='树形数据节点关系表'; + +-- ---------------------------- +-- Records of recursion_mapping +-- ---------------------------- +BEGIN; +INSERT INTO `recursion_mapping` (`id`, `node_id`, `node_type`, `path`, `level`) VALUES ('1', '2', 1, NULL, 1); +INSERT INTO `recursion_mapping` (`id`, `node_id`, `node_type`, `path`, `level`) VALUES ('2', '4', 1, '2', 2); +INSERT INTO `recursion_mapping` (`id`, `node_id`, `node_type`, `path`, `level`) VALUES ('3', '3', 1, '1', 2); +INSERT INTO `recursion_mapping` (`id`, `node_id`, `node_type`, `path`, `level`) VALUES ('4', '1', 1, NULL, 1); +COMMIT; + +-- ---------------------------- +-- Table structure for settle_check_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_check_sheet`; +CREATE TABLE `settle_check_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `total_pay_amount` decimal(24,2) NOT NULL COMMENT '应付金额', + `total_payed_amount` decimal(24,2) NOT NULL COMMENT '已付金额', + `total_discount_amount` decimal(24,2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `supplier_id` (`supplier_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商对账单'; + +-- ---------------------------- +-- Records of settle_check_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_check_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_check_sheet_detail`; +CREATE TABLE `settle_check_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '对账单ID', + `biz_id` varchar(32) NOT NULL COMMENT '单据ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `calc_type` tinyint(3) NOT NULL COMMENT '计算类型', + `pay_amount` decimal(24,2) NOT NULL COMMENT '应付金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`biz_id`), + KEY `biz_id` (`biz_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商对账单明细'; + +-- ---------------------------- +-- Records of settle_check_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_fee_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_fee_sheet`; +CREATE TABLE `settle_fee_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', + `sheet_type` tinyint(3) NOT NULL COMMENT '单据类型', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `supplier_id` (`supplier_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商费用单'; + +-- ---------------------------- +-- Records of settle_fee_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_fee_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_fee_sheet_detail`; +CREATE TABLE `settle_fee_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '费用单ID', + `item_id` varchar(32) NOT NULL COMMENT '项目ID', + `amount` decimal(24,2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`item_id`), + KEY `item_id` (`item_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商费用单明细'; + +-- ---------------------------- +-- Records of settle_fee_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_in_item +-- ---------------------------- +DROP TABLE IF EXISTS `settle_in_item`; +CREATE TABLE `settle_in_item` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收入项目'; + +-- ---------------------------- +-- Records of settle_in_item +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_out_item +-- ---------------------------- +DROP TABLE IF EXISTS `settle_out_item`; +CREATE TABLE `settle_out_item` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支出项目'; + +-- ---------------------------- +-- Records of settle_out_item +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_pre_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_pre_sheet`; +CREATE TABLE `settle_pre_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `supplier_id` (`supplier_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商预付款单'; + +-- ---------------------------- +-- Records of settle_pre_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_pre_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_pre_sheet_detail`; +CREATE TABLE `settle_pre_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '预付款单ID', + `item_id` varchar(32) NOT NULL COMMENT '项目ID', + `amount` decimal(24,2) NOT NULL COMMENT '金额', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`item_id`), + KEY `item_id` (`item_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商预付款单明细'; + +-- ---------------------------- +-- Records of settle_pre_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `settle_sheet`; +CREATE TABLE `settle_sheet` ( + `id` varchar(32) NOT NULL, + `code` varchar(32) NOT NULL COMMENT '单号', + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', + `total_amount` decimal(24,2) NOT NULL COMMENT '总金额', + `total_discount_amount` decimal(24,2) NOT NULL COMMENT '已优惠金额', + `start_date` date NOT NULL COMMENT '起始日期', + `end_date` date NOT NULL COMMENT '截止日期', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `supplier_id` (`supplier_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商结算单'; + +-- ---------------------------- +-- Records of settle_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for settle_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `settle_sheet_detail`; +CREATE TABLE `settle_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '结算单ID', + `biz_id` varchar(32) NOT NULL COMMENT '单据ID', + `pay_amount` decimal(24,2) NOT NULL COMMENT '实付金额', + `discount_amount` decimal(24,2) NOT NULL COMMENT '优惠金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`biz_id`), + KEY `biz_id` (`biz_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商结算单明细'; + +-- ---------------------------- +-- Records of settle_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sw_file_box +-- ---------------------------- +DROP TABLE IF EXISTS `sw_file_box`; +CREATE TABLE `sw_file_box` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(200) NOT NULL COMMENT '名称', + `url` longtext NOT NULL COMMENT 'Url', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件收纳箱'; + +-- ---------------------------- +-- Records of sw_file_box +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sw_online_excel +-- ---------------------------- +DROP TABLE IF EXISTS `sw_online_excel`; +CREATE TABLE `sw_online_excel` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `name` varchar(200) NOT NULL COMMENT '名称', + `content` longtext NOT NULL COMMENT '内容', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 1-在用 0停用', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='在线Excel'; + +-- ---------------------------- +-- Records of sw_online_excel +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_data_dic +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_dic`; +CREATE TABLE `sys_data_dic` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `category_id` varchar(32) DEFAULT NULL COMMENT '分类ID', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + UNIQUE KEY `name` (`name`), + KEY `category_id` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据字典'; + +-- ---------------------------- +-- Records of sys_data_dic +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_data_dic_category +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_dic_category`; +CREATE TABLE `sys_data_dic_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据字典分类'; + +-- ---------------------------- +-- Records of sys_data_dic_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_data_dic_item +-- ---------------------------- +DROP TABLE IF EXISTS `sys_data_dic_item`; +CREATE TABLE `sys_data_dic_item` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `dic_id` varchar(32) NOT NULL COMMENT '字典ID', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `dic_id` (`dic_id`,`code`), + UNIQUE KEY `dic_id_2` (`dic_id`,`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据字典'; + +-- ---------------------------- +-- Records of sys_data_dic_item +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dept`; +CREATE TABLE `sys_dept` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(100) NOT NULL COMMENT '名称', + `short_name` varchar(20) NOT NULL COMMENT '简称', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父级ID', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + UNIQUE KEY `name` (`name`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门'; + +-- ---------------------------- +-- Records of sys_dept +-- ---------------------------- +BEGIN; +INSERT INTO `sys_dept` (`id`, `code`, `name`, `short_name`, `parent_id`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1', '001', '销售中心', '销售中心', NULL, 1, '', '系统管理员', '1', '2022-01-13 00:37:06', '系统管理员', '1', '2022-01-13 00:37:06'); +INSERT INTO `sys_dept` (`id`, `code`, `name`, `short_name`, `parent_id`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2', '002', '研发中心', '研发中心', NULL, 1, '', '系统管理员', '1', '2022-01-13 00:37:17', '系统管理员', '1', '2022-01-13 00:37:17'); +INSERT INTO `sys_dept` (`id`, `code`, `name`, `short_name`, `parent_id`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3', '001001', '销售部', '销售部', '1', 1, '', '系统管理员', '1', '2022-01-13 00:38:03', '系统管理员', '1', '2022-01-13 00:38:03'); +INSERT INTO `sys_dept` (`id`, `code`, `name`, `short_name`, `parent_id`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4', '002001', '研发部', '研发部', '2', 1, '', '系统管理员', '1', '2022-01-13 00:38:15', '系统管理员', '1', '2022-01-13 00:38:15'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu`; +CREATE TABLE `sys_menu` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(200) DEFAULT NULL COMMENT '名称(前端使用)', + `title` varchar(20) NOT NULL COMMENT '标题', + `icon` varchar(200) DEFAULT NULL COMMENT '图标', + `component_type` tinyint(3) DEFAULT NULL COMMENT '组件类型(前端使用)', + `component` varchar(200) DEFAULT NULL COMMENT '组件(前端使用)', + `request_param` longtext COMMENT '自定义请求参数', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父级ID', + `path` varchar(200) DEFAULT NULL COMMENT '路由路径(前端使用)', + `no_cache` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否缓存(前端使用)', + `display` tinyint(3) NOT NULL COMMENT '类型 0-目录 1-菜单 2-功能', + `hidden` tinyint(1) DEFAULT '0' COMMENT '是否隐藏(前端使用)', + `permission` varchar(200) DEFAULT NULL COMMENT '权限', + `is_special` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否特殊菜单', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + KEY `code` (`code`,`name`,`title`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单'; + +-- ---------------------------- +-- Records of sys_menu +-- ---------------------------- +BEGIN; +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('0001', '0001', 'Xingyun', '星云工作台', 'a-menu', NULL, '', NULL, NULL, '/xingyun', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000', '1000', 'System', '系统管理', 'a-menu', NULL, '', NULL, '0001', '/system', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000001', '1000001', 'Menu', '菜单管理', NULL, 0, '/system/menu/index', NULL, '1000', '/menu', 0, 1, 0, 'system:menu:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000001001', '1000001001', '', '新增菜单', NULL, 0, '', NULL, '1000001', '', 0, 2, 0, 'system:menu:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000001002', '1000001002', '', '修改菜单', NULL, 0, '', NULL, '1000001', '', 0, 2, 0, 'system:menu:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000001003', '1000001003', '', '删除菜单', NULL, 0, '', NULL, '1000001', '', 0, 2, 0, 'system:menu:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000002', '1000002', 'Dept', '部门管理', NULL, 0, '/system/dept/index', NULL, '1000', '/dept', 0, 1, 0, 'system:dept:query', 1, 1, '', '系统管理员', '1', '2021-07-05 01:09:27', '系统管理员', '1', '2021-07-05 01:09:27'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000002001', '1000002001', '', '新增部门', NULL, 0, '', NULL, '1000002', '', 0, 2, 0, 'system:dept:add', 1, 1, '', '系统管理员', '1', '2021-06-27 01:33:31', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000002002', '1000002002', '', '修改部门', NULL, 0, '', NULL, '1000002', '', 0, 2, 0, 'system:dept:modify', 1, 1, '', '系统管理员', '1', '2021-06-27 01:33:47', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000003', '1000003', 'Position', '岗位管理', NULL, 0, '/system/position/index', NULL, '1000', '/position', 0, 1, 0, 'system:position:query', 1, 1, '', '系统管理员', '1', '2021-07-01 23:26:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000003001', '1000003001', '', '新增岗位', NULL, 0, '', NULL, '1000003', '', 0, 2, 0, 'system:position:add', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000003002', '1000003002', '', '修改岗位', NULL, 0, '', NULL, '1000003', '', 0, 2, 0, 'system:position:modify', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000004', '1000004', 'Role', '角色管理', NULL, 0, '/system/role/index', NULL, '1000', '/role', 0, 1, 0, 'system:role:query', 1, 1, '', '系统管理员', '1', '2021-07-04 00:35:49', '系统管理员', '1', '2021-07-04 00:35:49'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000004001', '1000004001', '', '新增角色', NULL, 0, '', NULL, '1000004', '', 0, 2, 0, 'system:role:add', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000004002', '1000004002', '', '修改角色', NULL, 0, '', NULL, '1000004', '', 0, 2, 0, 'system:role:modify', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000004003', '1000004003', '', '角色授权', NULL, 0, '', NULL, '1000004', '', 0, 2, 0, 'system:role:permission', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000005', '1000005', 'User', '用户管理', NULL, 0, '/system/user/index', NULL, '1000', '/user', 0, 1, 0, 'system:user:query', 1, 1, '', '系统管理员', '1', '2021-07-05 01:08:40', '系统管理员', '1', '2021-07-05 01:08:40'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000005001', '1000005001', '', '新增用户', NULL, 0, '', NULL, '1000005', '', 0, 2, 0, 'system:user:add', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:17', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000005002', '1000005002', '', '修改用户', NULL, 0, '', NULL, '1000005', '', 0, 2, 0, 'system:user:modify', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000005003', '1000005003', '', '用户授权', NULL, 0, '', NULL, '1000005', '', 0, 2, 0, 'system:user:permission', 1, 1, '', '系统管理员', '1', '2021-06-30 00:32:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000006', '1000006', 'Oplog', '操作日志', NULL, 0, '/system/oplog/index', NULL, '1000', '/oplog', 0, 1, 0, 'system:oplog:query', 1, 1, '', '系统管理员', '1', '2021-07-05 01:08:40', '系统管理员', '1', '2021-07-05 01:08:40'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000007', '1000007', 'SysParameter', '系统参数', NULL, 0, '/system/parameter/index', NULL, '1000', '/parameter', 0, 1, 0, 'system:parameter:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000007001', '1000007001', '', '新增系统参数', NULL, 0, '', NULL, '1000007', '', 0, 2, 0, 'system:parameter:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000007002', '1000007002', '', '修改系统参数', NULL, 0, '', NULL, '1000007', '', 0, 2, 0, 'system:parameter:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000007003', '1000007003', '', '删除系统参数', NULL, 0, '', NULL, '1000007', '', 0, 2, 0, 'system:parameter:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000008', '1000008', 'PublishSysNotice', '发布系统通知', NULL, 0, '/system/notice/publish', NULL, '1000', '/system/notice/publish', 0, 1, 0, 'system:notice:publish', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000008001', '1000008001', '', '新增系统通知', NULL, 0, '', NULL, '1000008', '', 0, 2, 0, 'system:notice:add', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000008002', '1000008002', '', '修改系统通知', NULL, 0, '', NULL, '1000008', '', 0, 2, 0, 'system:notice:modify', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000009', '1000009', 'SysNotice', '系统通知', NULL, 0, '/system/notice/index', NULL, '1000', '/system/notice', 0, 1, 0, 'system:notice:query', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010', '1000010', 'SysDataDic', '数据字典', NULL, 0, '/system/dic/index', NULL, '1000', '/dic', 0, 1, 0, 'system:dic:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010001', '1000010001', '', '新增数据字典', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010002', '1000010002', '', '修改数据字典', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010003', '1000010003', '', '删除数据字典', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010004', '1000010004', '', '新增数据字典分类', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic-category:add', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010005', '1000010005', '', '修改数据字典分类', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic-category:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010006', '1000010006', '', '删除数据字典分类', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic-category:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010007', '1000010007', '', '新增数据字典值', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010008', '1000010008', '', '修改数据字典值', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000010009', '1000010009', '', '删除数据字典值', NULL, 0, '', NULL, '1000010', '', 0, 2, 0, 'system:dic-item:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000011', '1000011', 'SysTenant', '租户管理', NULL, 0, '/system/tenant/index', NULL, '1000', '/system/tenant', 0, 1, 0, 'system:tenant:query', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000011001', '1000011001', '', '新增租户', NULL, 0, '', NULL, '1000011', '', 0, 2, 0, 'system:tenant:add', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000011002', '1000011002', '', '修改租户', NULL, 0, '', NULL, '1000011', '', 0, 2, 0, 'system:tenant:modify', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000012', '1000012', 'OpenDomain', '开放域', 'a-menu', 0, '/system/open-domain/index', NULL, '1000', '/open-domain', 0, 1, 0, 'system:open-domain:config', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000', '2000', 'BaseData', '基础信息管理', 'a-menu', NULL, '', NULL, '0001', '/base-data', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000002', '2000002', 'StoreCenterInfo', '仓库信息', NULL, 0, '/base-data/store-center/index', NULL, '2000', '/store-center', 0, 1, 0, 'base-data:store-center:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000002001', '2000002001', '', '新增仓库', NULL, 0, '', NULL, '2000002', '', 0, 2, 0, 'base-data:store-center:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000002002', '2000002002', '', '修改仓库', NULL, 0, '', NULL, '2000002', '', 0, 2, 0, 'base-data:store-center:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000002003', '2000002003', '', '导入仓库', NULL, 0, '', NULL, '2000002', '', 0, 2, 0, 'base-data:store-center:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000004', '2000004', 'Customer', '客户信息', NULL, 0, '/base-data/customer/index', NULL, '2000', '/customer', 0, 1, 0, 'base-data:customer:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000004001', '2000004001', '', '新增客户', NULL, 0, '', NULL, '2000004', '', 0, 2, 0, 'base-data:customer:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000004002', '2000004002', '', '修改客户', NULL, 0, '', NULL, '2000004', '', 0, 2, 0, 'base-data:customer:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000004003', '2000004003', '', '导入客户', NULL, 0, '', NULL, '2000004', '', 0, 2, 0, 'base-data:customer:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000005', '2000005', 'Supplier', '供应商信息', NULL, 0, '/base-data/supplier/index', NULL, '2000', '/supplier', 0, 1, 0, 'base-data:supplier:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000005001', '2000005001', '', '新增供应商', NULL, 0, '', NULL, '2000005', '', 0, 2, 0, 'base-data:supplier:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000005002', '2000005002', '', '修改供应商', NULL, 0, '', NULL, '2000005', '', 0, 2, 0, 'base-data:supplier:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000005003', '2000005003', '', '导入供应商', NULL, 0, '', NULL, '2000005', '', 0, 2, 0, 'base-data:supplier:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000006', '2000006', 'Member', '会员信息', NULL, 0, '/base-data/member/index', NULL, '2000', '/member', 0, 1, 0, 'base-data:member:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000006001', '2000006001', '', '新增会员', NULL, 0, '', NULL, '2000006', '', 0, 2, 0, 'base-data:member:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000006002', '2000006002', '', '修改会员', NULL, 0, '', NULL, '2000006', '', 0, 2, 0, 'base-data:member:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000006003', '2000006003', '', '导入会员', NULL, 0, '', NULL, '2000006', '', 0, 2, 0, 'base-data:member:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000007', '2000007', 'Shop', '门店信息', NULL, 0, '/base-data/shop/index', NULL, '2000', '/shop', 0, 1, 0, 'base-data:shop:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000007001', '2000007001', '', '新增门店', NULL, 0, '', NULL, '2000007', '', 0, 2, 0, 'base-data:shop:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000007002', '2000007002', '', '修改门店', NULL, 0, '', NULL, '2000007', '', 0, 2, 0, 'base-data:shop:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000007003', '2000007003', '', '导入门店', NULL, 0, '', NULL, '2000007', '', 0, 2, 0, 'base-data:shop:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001', '2001', 'Product', '商品中心', 'a-menu', NULL, '', NULL, '0001', '/product', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001001', '2001001', 'ProductCategory', '商品类目', NULL, 0, '/base-data/product/category/index', NULL, '2001', '/category', 0, 1, 0, 'base-data:product:category:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001001001', '2001001001', '', '新增类目', NULL, 0, '', NULL, '2001001', '', 0, 2, 0, 'base-data:product:category:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001001002', '2001001002', '', '修改类目', NULL, 0, '', NULL, '2001001', '', 0, 2, 0, 'base-data:product:category:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001001003', '2001001003', '', '导入类目', NULL, 0, '', NULL, '2001001', '', 0, 2, 0, 'base-data:product:category:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001002', '2001002', 'ProductBrand', '商品品牌', NULL, 0, '/base-data/product/brand/index', NULL, '2001', '/brand', 0, 1, 0, 'base-data:product:brand:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001002001', '2001002001', '', '新增品牌', NULL, 0, '', NULL, '2001002', '', 0, 2, 0, 'base-data:product:brand:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001002002', '2001002002', '', '修改品牌', NULL, 0, '', NULL, '2001002', '', 0, 2, 0, 'base-data:product:brand:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001002003', '2001002003', '', '导入品牌', NULL, 0, '', NULL, '2001002', '', 0, 2, 0, 'base-data:product:brand:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001003', '2001003', 'ProductSalePropGroup', '商品销售属性组', NULL, 0, '/base-data/product/saleprop/index', NULL, '2001', '/spec', 0, 1, 0, 'base-data:product:saleprop-group:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001003001', '2001003001', '', '新增销售属性组', NULL, 0, '', NULL, '2001003', '', 0, 2, 0, 'base-data:product:saleprop-group:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001003002', '2001003002', '', '修改销售属性组', NULL, 0, '', NULL, '2001003', '', 0, 2, 0, 'base-data:product:saleprop-group:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001003003', '2001003003', '', '查询销售属性', NULL, 0, '', NULL, '2001003', '', 0, 2, 0, 'base-data:product:saleprop-item:query', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001003004', '2001003004', '', '新增销售属性', NULL, 0, '', NULL, '2001003', '', 0, 2, 0, 'base-data:product:saleprop-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001003005', '2001003005', '', '修改销售属性', NULL, 0, '', NULL, '2001003', '', 0, 2, 0, 'base-data:product:saleprop-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001004', '2001004', 'ProductProperty', '商品属性', NULL, 0, '/base-data/product/property/index', NULL, '2001', '/property', 0, 1, 0, 'base-data:product:property:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001004001', '2001004001', '', '新增属性', NULL, 0, '', NULL, '2001004', '', 0, 2, 0, 'base-data:product:property:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001004002', '2001004002', '', '修改属性', NULL, 0, '', NULL, '2001004', '', 0, 2, 0, 'base-data:product:property:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001004003', '2001004003', '', '查询属性值', NULL, 0, '', NULL, '2001004', '', 0, 2, 0, 'base-data:product:property-item:query', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001004004', '2001004004', '', '新增属性值', NULL, 0, '', NULL, '2001004', '', 0, 2, 0, 'base-data:product:property-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001004005', '2001004005', '', '修改属性值', NULL, 0, '', NULL, '2001004', '', 0, 2, 0, 'base-data:product:property-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001005', '2001005', 'ProductInfo', '商品管理', NULL, 0, '/base-data/product/info/index', NULL, '2001', '/info', 0, 1, 0, 'base-data:product:info:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001005001', '2001005001', '', '新增商品', NULL, 0, '', NULL, '2001005', '', 0, 2, 0, 'base-data:product:info:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001005002', '2001005002', '', '修改商品', NULL, 0, '', NULL, '2001005', '', 0, 2, 0, 'base-data:product:info:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001005003', '2001005003', '', '导入商品', NULL, 0, '', NULL, '2001005', '', 0, 2, 0, 'base-data:product:info:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001006', '2001006', 'ProductPoly', '商品SPU', NULL, 0, '/base-data/product/poly/index', NULL, '2001', '/poly', 0, 1, 0, 'base-data:product:poly:query', 1, 1, '', '系统管理员', '1', '2021-07-06 17:01:00', '系统管理员', '1', '2021-07-06 17:01:00'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001006001', '2001006001', '', '新增商品SPU', NULL, 0, '', NULL, '2001006', '', 0, 2, 0, 'base-data:product:poly:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001006002', '2001006002', '', '修改商品SPU', NULL, 0, '', NULL, '2001006', '', 0, 2, 0, 'base-data:product:poly:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2001006003', '2001006003', '', '导入商品SPU', NULL, 0, '', NULL, '2001006', '', 0, 2, 0, 'base-data:product:poly:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002', '2002', 'Purchase', '采购管理', 'a-menu', NULL, '', NULL, '0001', '/purchase', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002001', '2002001', 'PurchaseConfig', '采购参数设置', NULL, 0, '/sc/purchase/config/index', NULL, '2002', '/config', 1, 1, 0, 'purchase:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002002', '2002002', 'PurchaseOrder', '采购订单管理', NULL, 0, '/sc/purchase/order/index', NULL, '2002', '/order', 0, 1, 0, 'purchase:order:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002002001', '2002002001', '', '新增采购订单', NULL, 0, '', NULL, '2002002', '', 0, 2, 0, 'purchase:order:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002002002', '2002002002', '', '修改采购订单', NULL, 0, '', NULL, '2002002', '', 0, 2, 0, 'purchase:order:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002002003', '2002002003', '', '删除采购订单', NULL, 0, '', NULL, '2002002', '', 0, 2, 0, 'purchase:order:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002002004', '2002002004', '', '审核采购订单', NULL, 0, '', NULL, '2002002', '', 0, 2, 0, 'purchase:order:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002002005', '2002002005', '', '导出采购订单', NULL, 0, '', NULL, '2002002', '', 0, 2, 0, 'purchase:order:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002002006', '2002002006', '', '导入采购订单', NULL, 0, '', NULL, '2002002', '', 0, 2, 0, 'purchase:order:import', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002003', '2002003', 'ReceiveSheet', '采购收货管理', NULL, 0, '/sc/purchase/receive/index', NULL, '2002', '/receive', 0, 1, 0, 'purchase:receive:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002003001', '2002003001', '', '新增采购收货单', NULL, 0, '', NULL, '2002003', '', 0, 2, 0, 'purchase:receive:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002003002', '2002003002', '', '修改采购收货单', NULL, 0, '', NULL, '2002003', '', 0, 2, 0, 'purchase:receive:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002003003', '2002003003', '', '删除采购收货单', NULL, 0, '', NULL, '2002003', '', 0, 2, 0, 'purchase:receive:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002003004', '2002003004', '', '审核采购收货单', NULL, 0, '', NULL, '2002003', '', 0, 2, 0, 'purchase:receive:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002003005', '2002003005', '', '导出采购收货单', NULL, 0, '', NULL, '2002003', '', 0, 2, 0, 'purchase:receive:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002003006', '2002003006', '', '导入采购收货单', NULL, 0, '', NULL, '2002003', '', 0, 2, 0, 'purchase:receive:import', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002004', '2002004', 'PurchaseReturn', '采购退货管理', NULL, 0, '/sc/purchase/return/index', NULL, '2002', '/return', 0, 1, 0, 'purchase:return:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002004001', '2002004001', '', '新增采购退货单', NULL, 0, '', NULL, '2002004', '', 0, 2, 0, 'purchase:return:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002004002', '2002004002', '', '修改采购退货单', NULL, 0, '', NULL, '2002004', '', 0, 2, 0, 'purchase:return:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002004003', '2002004003', '', '删除采购退货单', NULL, 0, '', NULL, '2002004', '', 0, 2, 0, 'purchase:return:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002004004', '2002004004', '', '审核采购退货单', NULL, 0, '', NULL, '2002004', '', 0, 2, 0, 'purchase:return:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2002004005', '2002004005', '', '导出采购退货单', NULL, 0, '', NULL, '2002004', '', 0, 2, 0, 'purchase:return:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003', '2003', 'Sale', '销售管理', 'a-menu', NULL, '', NULL, '0001', '/sale', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003001', '2003001', 'SaleConfig', '销售参数设置', NULL, 0, '/sc/sale/config/index', NULL, '2003', '/config', 1, 1, 0, 'sale:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003002', '2003002', 'SaleOrder', '销售订单管理', NULL, 0, '/sc/sale/order/index', NULL, '2003', '/order', 0, 1, 0, 'sale:order:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003002001', '2003002001', '', '新增销售订单', NULL, 0, '', NULL, '2003002', '', 0, 2, 0, 'sale:order:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003002002', '2003002002', '', '修改销售订单', NULL, 0, '', NULL, '2003002', '', 0, 2, 0, 'sale:order:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003002003', '2003002003', '', '删除销售订单', NULL, 0, '', NULL, '2003002', '', 0, 2, 0, 'sale:order:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003002004', '2003002004', '', '审核销售订单', NULL, 0, '', NULL, '2003002', '', 0, 2, 0, 'sale:order:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003002005', '2003002005', '', '导出销售订单', NULL, 0, '', NULL, '2003002', '', 0, 2, 0, 'sale:order:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003003', '2003003', 'SaleOutSheet', '销售出库管理', NULL, 0, '/sc/sale/out/index', NULL, '2003', '/out', 0, 1, 0, 'sale:out:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003003001', '2003003001', '', '新增销售出库单', NULL, 0, '', NULL, '2003003', '', 0, 2, 0, 'sale:out:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003003002', '2003003002', '', '修改销售出库单', NULL, 0, '', NULL, '2003003', '', 0, 2, 0, 'sale:out:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003003003', '2003003003', '', '删除销售出库单', NULL, 0, '', NULL, '2003003', '', 0, 2, 0, 'sale:out:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003003004', '2003003004', '', '审核销售出库单', NULL, 0, '', NULL, '2003003', '', 0, 2, 0, 'sale:out:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003003005', '2003003005', '', '导出销售出库单', NULL, 0, '', NULL, '2003003', '', 0, 2, 0, 'sale:out:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003004', '2003004', 'SaleReturn', '销售退货管理', NULL, 0, '/sc/sale/return/index', NULL, '2003', '/return', 0, 1, 0, 'sale:return:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003004001', '2003004001', '', '新增销售退货单', NULL, 0, '', NULL, '2003004', '', 0, 2, 0, 'sale:return:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003004002', '2003004002', '', '修改销售退货单', NULL, 0, '', NULL, '2003004', '', 0, 2, 0, 'sale:return:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003004003', '2003004003', '', '删除销售退货单', NULL, 0, '', NULL, '2003004', '', 0, 2, 0, 'sale:return:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003004004', '2003004004', '', '审核销售退货单', NULL, 0, '', NULL, '2003004', '', 0, 2, 0, 'sale:return:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2003004005', '2003004005', '', '导出销售退货单', NULL, 0, '', NULL, '2003004', '', 0, 2, 0, 'sale:return:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004', '2004', 'Retail', '零售管理', 'a-menu', NULL, '', NULL, '0001', '/retail', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004001', '2004001', 'RetailConfig', '零售参数设置', NULL, 0, '/sc/retail/config/index', NULL, '2004', '/config', 1, 1, 0, 'retail:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004002', '2004002', 'RetailOutSheet', '零售出库管理', NULL, 0, '/sc/retail/out/index', NULL, '2004', '/out', 0, 1, 0, 'retail:out:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004002001', '2004002001', '', '新增零售出库单', NULL, 0, '', NULL, '2004002', '', 0, 2, 0, 'retail:out:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004002002', '2004002002', '', '修改零售出库单', NULL, 0, '', NULL, '2004002', '', 0, 2, 0, 'retail:out:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004002003', '2004002003', '', '删除零售出库单', NULL, 0, '', NULL, '2004002', '', 0, 2, 0, 'retail:out:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004002004', '2004002004', '', '审核零售出库单', NULL, 0, '', NULL, '2004002', '', 0, 2, 0, 'retail:out:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004002005', '2004002005', '', '导出零售出库单', NULL, 0, '', NULL, '2004002', '', 0, 2, 0, 'retail:out:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004003', '2004003', 'RetailReturn', '零售退货管理', NULL, 0, '/sc/retail/return/index', NULL, '2004', '/return', 0, 1, 0, 'retail:return:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004003001', '2004003001', '', '新增零售退货单', NULL, 0, '', NULL, '2004003', '', 0, 2, 0, 'retail:return:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004003002', '2004003002', '', '修改零售退货单', NULL, 0, '', NULL, '2004003', '', 0, 2, 0, 'retail:return:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004003003', '2004003003', '', '删除零售退货单', NULL, 0, '', NULL, '2004003', '', 0, 2, 0, 'retail:return:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004003004', '2004003004', '', '审核零售退货单', NULL, 0, '', NULL, '2004003', '', 0, 2, 0, 'retail:return:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2004003005', '2004003005', '', '导出零售退货单', NULL, 0, '', NULL, '2004003', '', 0, 2, 0, 'retail:return:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000', '3000', 'StockManage', '库存管理', 'a-menu', NULL, '', NULL, '0001', '/stock', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000001', '3000001', 'ProductStock', '商品库存', NULL, 0, '/sc/stock/product/index', NULL, '3000', '/product', 0, 1, 0, 'stock:product:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000001001', '3000001001', '', '导出商品库存', NULL, 0, '', NULL, '3000001', '', 0, 2, 0, 'stock:product:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000003', '3000003', 'ProductStockLog', '商品库存变动记录', NULL, 0, '/sc/stock/product-log/index', NULL, '3000', '/product/log', 0, 1, 0, 'stock:product-log:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000003001', '3000003001', '', '导出商品库存变动记录', NULL, 0, '', NULL, '3000003', '', 0, 2, 0, 'stock:product-log:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004', '3000004', 'TakeStock', '库存盘点', 'a-menu', NULL, '', NULL, '0001', '/take', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004001', '3000004001', 'TakeStockConfig', '盘点参数设置', NULL, 0, '/sc/stock/take/config/index', NULL, '3000004', '/config', 1, 1, 0, 'stock:take:config:modify', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004002', '3000004002', 'PreTakeStockSheet', '预先盘点单管理', NULL, 0, '/sc/stock/take/pre/index', NULL, '3000004', '/pre', 0, 1, 0, 'stock:take:pre:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004002001', '3000004002001', '', '新增预先盘点单', NULL, 0, '', NULL, '3000004002', '', 0, 2, 0, 'stock:take:pre:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004002002', '3000004002002', '', '修改预先盘点单', NULL, 0, '', NULL, '3000004002', '', 0, 2, 0, 'stock:take:pre:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004002003', '3000004002003', '', '删除预先盘点单', NULL, 0, '', NULL, '3000004002', '', 0, 2, 0, 'stock:take:pre:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004002004', '3000004002004', '', '导出预先盘点单', NULL, 0, '', NULL, '3000004002', '', 0, 2, 0, 'stock:take:pre:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003', '3000004003', 'TakeStockPlan', '盘点任务管理', NULL, 0, '/sc/stock/take/plan/index', NULL, '3000004', '/plan', 0, 1, 0, 'stock:take:plan:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003001', '3000004003001', '', '新增盘点任务', NULL, 0, '', NULL, '3000004003', '', 0, 2, 0, 'stock:take:plan:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003002', '3000004003002', '', '修改盘点任务', NULL, 0, '', NULL, '3000004003', '', 0, 2, 0, 'stock:take:plan:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003003', '3000004003003', '', '删除盘点任务', NULL, 0, '', NULL, '3000004003', '', 0, 2, 0, 'stock:take:plan:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003004', '3000004003004', '', '导出盘点任务', NULL, 0, '', NULL, '3000004003', '', 0, 2, 0, 'stock:take:plan:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003005', '3000004003005', '', '差异生成', NULL, 0, '', NULL, '3000004003', '', 0, 2, 0, 'stock:take:plan:create-diff', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003006', '3000004003006', '', '差异处理', NULL, 0, '', NULL, '3000004003', '', 0, 2, 0, 'stock:take:plan:handle-diff', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004003007', '3000004003007', '', '作废盘点任务', NULL, 0, '', NULL, '3000004003', '', 0, 2, 0, 'stock:take:plan:cancel', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004004', '3000004004', 'TakeStockSheet', '盘点单管理', NULL, 0, '/sc/stock/take/sheet/index', NULL, '3000004', '/sheet', 0, 1, 0, 'stock:take:sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004004001', '3000004004001', '', '新增盘点单', NULL, 0, '', NULL, '3000004004', '', 0, 2, 0, 'stock:take:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004004002', '3000004004002', '', '修改盘点单', NULL, 0, '', NULL, '3000004004', '', 0, 2, 0, 'stock:take:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004004003', '3000004004003', '', '删除盘点单', NULL, 0, '', NULL, '3000004004', '', 0, 2, 0, 'stock:take:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004004004', '3000004004004', '', '导出盘点单', NULL, 0, '', NULL, '3000004004', '', 0, 2, 0, 'stock:take:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004004005', '3000004004005', '', '审核盘点单', NULL, 0, '', NULL, '3000004004', '', 0, 2, 0, 'stock:take:sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000004004006', '3000004004006', '', '取消审核盘点单', NULL, 0, '', NULL, '3000004004', '', 0, 2, 0, 'stock:take:sheet:cancel-approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005', '3000005', 'StockAdjust', '库存调整', 'a-menu', NULL, '', NULL, '0001', '/take-adjust', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005001', '3000005001', 'StockCostAdjustSheet', '库存成本调整', NULL, 0, '/sc/stock/adjust/cost/index', NULL, '3000005', '/cost', 0, 1, 0, 'stock:adjust:cost:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005001001', '3000005001001', '', '新增库存成本调整单', NULL, 0, '', NULL, '3000005001', '', 0, 2, 0, 'stock:adjust:cost:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005001002', '3000005001002', '', '修改库存成本调整单', NULL, 0, '', NULL, '3000005001', '', 0, 2, 0, 'stock:adjust:cost:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005001003', '3000005001003', '', '删除库存成本调整单', NULL, 0, '', NULL, '3000005001', '', 0, 2, 0, 'stock:adjust:cost:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005001004', '3000005001004', '', '导出库存成本调整单', NULL, 0, '', NULL, '3000005001', '', 0, 2, 0, 'stock:adjust:cost:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005001005', '3000005001005', '', '审核库存成本调整单', NULL, 0, '', NULL, '3000005001', '', 0, 2, 0, 'stock:adjust:cost:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000', '4000', 'SettleManage', '结算管理', 'a-menu', NULL, '', NULL, '0001', '/settle', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000001', '4000001', 'SettleInItem', '收入项目', NULL, 0, '/settle/in-item/index', NULL, '4000', '/in-item', 0, 1, 0, 'settle:in-item:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000001001', '4000001001', '', '新增收入项目', NULL, 0, '', NULL, '4000001', '', 0, 2, 0, 'settle:in-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000001002', '4000001002', '', '修改收入项目', NULL, 0, '', NULL, '4000001', '', 0, 2, 0, 'settle:in-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000001003', '4000001003', '', '导出收入项目', NULL, 0, '', NULL, '4000001', '', 0, 2, 0, 'settle:in-item:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000002', '4000002', 'SettleOutItem', '支出项目', NULL, 0, '/settle/out-item/index', NULL, '4000', '/out-item', 0, 1, 0, 'settle:out-item:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000002001', '4000002001', '', '新增支出项目', NULL, 0, '', NULL, '4000002', '', 0, 2, 0, 'settle:out-item:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000002002', '4000002002', '', '修改支出项目', NULL, 0, '', NULL, '4000002', '', 0, 2, 0, 'settle:out-item:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000002003', '4000002003', '', '导出支出项目', NULL, 0, '', NULL, '4000002', '', 0, 2, 0, 'settle:out-item:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000003', '4000003', 'SettleFeeSheet', '供应商费用', NULL, 0, '/settle/fee-sheet/index', NULL, '4000007', '/fee-sheet', 0, 1, 0, 'settle:fee-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000003001', '4000003001', '', '新增供应商费用单', NULL, 0, '', NULL, '4000003', '', 0, 2, 0, 'settle:fee-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000003002', '4000003002', '', '修改供应商费用单', NULL, 0, '', NULL, '4000003', '', 0, 2, 0, 'settle:fee-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000003003', '4000003003', '', '删除供应商费用单', NULL, 0, '', NULL, '4000003', '', 0, 2, 0, 'settle:fee-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000003004', '4000003004', '', '审核供应商费用单', NULL, 0, '', NULL, '4000003', '', 0, 2, 0, 'settle:fee-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000003005', '4000003005', '', '导出供应商费用单', NULL, 0, '', NULL, '4000003', '', 0, 2, 0, 'settle:fee-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000004', '4000004', 'SettlePreSheet', '供应商预付款', NULL, 0, '/settle/pre-sheet/index', NULL, '4000007', '/pre-sheet', 0, 1, 0, 'settle:pre-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000004001', '4000004001', '', '新增供应商预付款单', NULL, 0, '', NULL, '4000004', '', 0, 2, 0, 'settle:pre-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000004002', '4000004002', '', '修改供应商预付款单', NULL, 0, '', NULL, '4000004', '', 0, 2, 0, 'settle:pre-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000004003', '4000004003', '', '删除供应商预付款单', NULL, 0, '', NULL, '4000004', '', 0, 2, 0, 'settle:pre-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000004004', '4000004004', '', '审核供应商预付款单', NULL, 0, '', NULL, '4000004', '', 0, 2, 0, 'settle:pre-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000004005', '4000004005', '', '导出供应商预付款单', NULL, 0, '', NULL, '4000004', '', 0, 2, 0, 'settle:pre-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000005', '4000005', 'SettleCheckSheet', '供应商对账', NULL, 0, '/settle/check-sheet/index', NULL, '4000007', '/check-sheet', 0, 1, 0, 'settle:check-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000005001', '4000005001', '', '新增供应商对账单', NULL, 0, '', NULL, '4000005', '', 0, 2, 0, 'settle:check-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000005002', '4000005002', '', '修改供应商对账单', NULL, 0, '', NULL, '4000005', '', 0, 2, 0, 'settle:check-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000005003', '4000005003', '', '删除供应商对账单', NULL, 0, '', NULL, '4000005', '', 0, 2, 0, 'settle:check-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000005004', '4000005004', '', '审核供应商对账单', NULL, 0, '', NULL, '4000005', '', 0, 2, 0, 'settle:check-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000005005', '4000005005', '', '导出供应商对账单', NULL, 0, '', NULL, '4000005', '', 0, 2, 0, 'settle:check-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000006', '4000006', 'SettleSheet', '供应商结算', NULL, 0, '/settle/sheet/index', NULL, '4000007', '/sheet', 0, 1, 0, 'settle:sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000006001', '4000006001', '', '新增供应商结算单', NULL, 0, '', NULL, '4000006', '', 0, 2, 0, 'settle:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000006002', '4000006002', '', '修改供应商结算单', NULL, 0, '', NULL, '4000006', '', 0, 2, 0, 'settle:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000006003', '4000006003', '', '删除供应商结算单', NULL, 0, '', NULL, '4000006', '', 0, 2, 0, 'settle:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000006004', '4000006004', '', '审核供应商结算单', NULL, 0, '', NULL, '4000006', '', 0, 2, 0, 'settle:sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000006005', '4000006005', '', '导出供应商结算单', NULL, 0, '', NULL, '4000006', '', 0, 2, 0, 'settle:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000007', '4000007', 'SupplierSettleManage', '供应商结算', 'a-menu', NULL, '', NULL, '4000', '/supplier', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000008', '4000008', 'CustomerSettleManage', '客户结算', 'a-menu', NULL, '', NULL, '4000', '/customer', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-05 01:21:35', '系统管理员', '1', '2021-07-05 01:21:39'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000009', '4000009', 'CustomerSettleFeeSheet', '客户费用', NULL, 0, '/customer-settle/fee-sheet/index', NULL, '4000008', '/fee-sheet', 0, 1, 0, 'customer-settle:fee-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000009001', '4000009001', '', '新增客户费用单', NULL, 0, '', NULL, '4000009', '', 0, 2, 0, 'customer-settle:fee-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000009002', '4000009002', '', '修改客户费用单', NULL, 0, '', NULL, '4000009', '', 0, 2, 0, 'customer-settle:fee-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000009003', '4000009003', '', '删除客户费用单', NULL, 0, '', NULL, '4000009', '', 0, 2, 0, 'customer-settle:fee-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000009004', '4000009004', '', '审核客户费用单', NULL, 0, '', NULL, '4000009', '', 0, 2, 0, 'customer-settle:fee-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000009005', '4000009005', '', '导出客户费用单', NULL, 0, '', NULL, '4000009', '', 0, 2, 0, 'customer-settle:fee-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000010', '4000010', 'CustomerSettlePreSheet', '客户预收款', NULL, 0, '/customer-settle/pre-sheet/index', NULL, '4000008', '/pre-sheet', 0, 1, 0, 'customer-settle:pre-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000010001', '4000010001', '', '新增客户预收款单', NULL, 0, '', NULL, '4000010', '', 0, 2, 0, 'customer-settle:pre-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000010002', '4000010002', '', '修改客户预收款单', NULL, 0, '', NULL, '4000010', '', 0, 2, 0, 'customer-settle:pre-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000010003', '4000010003', '', '删除客户预收款单', NULL, 0, '', NULL, '4000010', '', 0, 2, 0, 'customer-settle:pre-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000010004', '4000010004', '', '审核客户预收款单', NULL, 0, '', NULL, '4000010', '', 0, 2, 0, 'customer-settle:pre-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000010005', '4000010005', '', '导出客户预收款单', NULL, 0, '', NULL, '4000010', '', 0, 2, 0, 'customer-settle:pre-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000011', '4000011', 'CustomerSettleCheckSheet', '客户对账', NULL, 0, '/customer-settle/check-sheet/index', NULL, '4000008', '/check-sheet', 0, 1, 0, 'customer-settle:check-sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000011001', '4000011001', '', '新增客户对账单', NULL, 0, '', NULL, '4000011', '', 0, 2, 0, 'customer-settle:check-sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000011002', '4000011002', '', '修改客户对账单', NULL, 0, '', NULL, '4000011', '', 0, 2, 0, 'customer-settle:check-sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000011003', '4000011003', '', '删除客户对账单', NULL, 0, '', NULL, '4000011', '', 0, 2, 0, 'customer-settle:check-sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000011004', '4000011004', '', '审核客户对账单', NULL, 0, '', NULL, '4000011', '', 0, 2, 0, 'customer-settle:check-sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000011005', '4000011005', '', '导出客户对账单', NULL, 0, '', NULL, '4000011', '', 0, 2, 0, 'customer-settle:check-sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000012', '4000012', 'CustomerSettleSheet', '客户结算', NULL, 0, '/customer-settle/sheet/index', NULL, '4000008', '/sheet', 0, 1, 0, 'customer-settle:sheet:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000012001', '4000012001', '', '新增客户结算单', NULL, 0, '', NULL, '4000012', '', 0, 2, 0, 'customer-settle:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000012002', '4000012002', '', '修改客户结算单', NULL, 0, '', NULL, '4000012', '', 0, 2, 0, 'customer-settle:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000012003', '4000012003', '', '删除客户结算单', NULL, 0, '', NULL, '4000012', '', 0, 2, 0, 'customer-settle:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000012004', '4000012004', '', '审核客户结算单', NULL, 0, '', NULL, '4000012', '', 0, 2, 0, 'customer-settle:sheet:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('4000012005', '4000012005', '', '导出客户结算单', NULL, 0, '', NULL, '4000012', '', 0, 2, 0, 'customer-settle:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 10:53:45', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000', '9000', 'Development', '开发管理', 'a-menu', NULL, '', NULL, '0001', '/development', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000001', '9000001', 'Qrtz', '定时器管理', NULL, 0, '/development/qrtz/index', NULL, '9000', '/qrtz', 0, 1, 0, 'development:qrtz:manage', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000002', '9000002', 'DataEntity', '数据实体', NULL, 0, '/development/data/entity/index', NULL, '9000', '/data/entity', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000003', '9000003', 'DataObj', '数据对象', NULL, 0, '/development/data/obj/index', NULL, '9000', '/data/obj', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000004', '9000004', 'CustomList', '自定义列表', NULL, 0, '/development/custom/list/index', NULL, '9000', '/custom/list', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000005', '9000005', 'CustomSelector', '自定义选择器', NULL, 0, '/development/custom/selector/index', NULL, '9000', '/custom/selector', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000006', '9000006', 'FmDesigner', '表单生成器', NULL, 0, '/development/fm-designer/index', NULL, '9000', '/fm-designer', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000007', '9000007', 'CustomForm', '自定义表单', NULL, 0, '/development/custom/form/index', NULL, '9000', '/custom/form', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9001', '9001', 'SmartWork', '便捷办公', 'a-menu', NULL, '', NULL, '0001', '/smart-work', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9001001', '9001001', 'FileBox', '文件收纳箱', NULL, 0, '/smart-work/file-box/index', NULL, '9001', '/file-box', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9001002', '9001002', 'OnlineExcel', '在线Excel', NULL, 0, '/smart-work/online-excel/index', NULL, '9001', '/online-excel', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_menu_collect +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu_collect`; +CREATE TABLE `sys_menu_collect` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `menu_id` varchar(32) NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`id`), + UNIQUE KEY `user_id, menu_id` (`user_id`,`menu_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单收藏'; + +-- ---------------------------- +-- Table structure for sys_notice +-- ---------------------------- +DROP TABLE IF EXISTS `sys_notice`; +CREATE TABLE `sys_notice` ( + `id` varchar(32) CHARACTER SET utf8mb4 NOT NULL COMMENT 'ID', + `title` varchar(200) CHARACTER SET utf8mb4 NOT NULL COMMENT '标题', + `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '内容', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `published` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布', + `create_by` varchar(32) CHARACTER SET utf8mb4 NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `readed_num` int(11) NOT NULL DEFAULT '0' COMMENT '已读人数', + `un_read_num` int(11) NOT NULL DEFAULT '0' COMMENT '未读人数', + `publish_time` datetime DEFAULT NULL COMMENT '发布时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统通知'; + +-- ---------------------------- +-- Records of sys_notice +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_notice_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_notice_log`; +CREATE TABLE `sys_notice_log` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `notice_id` varchar(32) NOT NULL COMMENT '标题', + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `readed` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已读', + `read_time` datetime DEFAULT NULL COMMENT '已读时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `notice_id` (`notice_id`,`user_id`), + KEY `user_id` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统通知记录'; + +-- ---------------------------- +-- Records of sys_notice_log +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_parameter +-- ---------------------------- +DROP TABLE IF EXISTS `sys_parameter`; +CREATE TABLE `sys_parameter` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `pm_key` varchar(100) NOT NULL COMMENT '键', + `pm_value` varchar(200) DEFAULT NULL COMMENT '值', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `pm_key` (`pm_key`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COMMENT='系统参数'; + +-- ---------------------------- +-- Records of sys_parameter +-- ---------------------------- +BEGIN; +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (1, 'tx-map.key', 'OLJBZ-ZFJK6-QWUSK-MB7XT-6UTN2-AWBSY', '腾讯地图Key', '系统管理员', '1', '2022-05-22 04:18:59', '系统管理员', '1', '2022-05-22 04:18:59'); +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (2, 'tx-map.secret', 'secret', '腾讯地图Secret', '系统管理员', '1', '2022-05-22 04:18:59', '系统管理员', '1', '2022-05-22 04:18:59'); +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (3, 'excel-import.max-size', '2000', 'Excel导入最大条数', '系统管理员', '1', '2022-06-10 21:39:32', '系统管理员', '1', '2022-06-10 21:39:32'); +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (7, 'sms.ali', '{\n \"accessKeyId\": \"123456789\",\n \"accessKeySecret\": \"123456789abcdefg\",\n \"endpoint\": \"dysmsapi.aliyuncs.com\"\n}', '阿里云短信配置', '系统管理员', '1', '2023-03-14 21:07:09', '系统管理员', '1', '2023-03-14 21:07:09'); +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (8, 'mail', '{\n \"pass\":\"123456\",\n \"sslEnable\":true,\n \"timeOut\":30000,\n \"port\":25,\n \"host\":\"smtp.xingyun.com\",\n \"connectTimeOut\":1000,\n \"from\":\"test@xingyun.com\",\n \"user\":\"test\"\n}', '邮件配置', '系统管理员', '1', '2023-03-14 21:13:44', '系统管理员', '1', '2023-03-14 21:13:44'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_position +-- ---------------------------- +DROP TABLE IF EXISTS `sys_position`; +CREATE TABLE `sys_position` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '岗位编号', + `name` varchar(20) NOT NULL COMMENT '岗位名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + UNIQUE KEY `name` (`name`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位'; + +-- ---------------------------- +-- Records of sys_position +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `permission` varchar(200) DEFAULT NULL COMMENT '权限', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + UNIQUE KEY `name` (`name`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色'; + +-- ---------------------------- +-- Records of sys_role +-- ---------------------------- +BEGIN; +INSERT INTO `sys_role` (`id`, `code`, `name`, `permission`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1', '001', '系统管理员', 'admin', 1, '系统管理员', '系统管理员', '1', '2021-05-08 18:04:41', '系统管理员', '1', '2021-05-08 18:04:45'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role_menu`; +CREATE TABLE `sys_role_menu` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + `menu_id` varchar(32) NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`id`), + UNIQUE KEY `role_id, menu_id` (`role_id`,`menu_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色与菜单关系表'; + +-- ---------------------------- +-- Records of sys_role_menu +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '姓名', + `username` varchar(30) NOT NULL COMMENT '用户名', + `password` varchar(100) NOT NULL COMMENT '密码', + `email` varchar(100) DEFAULT NULL COMMENT '邮箱', + `telephone` varchar(11) DEFAULT NULL COMMENT '联系电话', + `gender` tinyint(3) NOT NULL DEFAULT '0' COMMENT '性别 0-未知 1-男 2-女', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 1-在用 0停用', + `lock_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '锁定状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户'; + +-- ---------------------------- +-- Records of sys_user +-- ---------------------------- +BEGIN; +INSERT INTO `sys_user` (`id`, `code`, `name`, `username`, `password`, `email`, `telephone`, `gender`, `available`, `lock_status`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1', '001', '系统管理员', 'admin', '$2a$10$IJtHluhnhAYkgvM4PdKuZek5PWbtuxtjB9pB.twZdxg/qrlR4s4q6', 'xingyun@lframework.com', '17600000001', 0, 1, 0, '', '系统管理员', '1', '2021-04-22 22:00:27', '系统管理员', '1', '2023-03-09 13:30:44'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_dept`; +CREATE TABLE `sys_user_dept` ( + `id` varchar(32) NOT NULL, + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `dept_id` varchar(32) NOT NULL COMMENT '部门ID', + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`dept_id`) USING BTREE, + KEY `dept_id` (`dept_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户与部门关系表'; + +-- ---------------------------- +-- Records of sys_user_dept +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_position +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_position`; +CREATE TABLE `sys_user_position` ( + `id` varchar(32) NOT NULL, + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `position_id` varchar(32) NOT NULL COMMENT '岗位ID', + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`position_id`) USING BTREE, + KEY `position_id` (`position_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户与岗位关系表'; + +-- ---------------------------- +-- Records of sys_user_position +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`id`), + UNIQUE KEY `user_id, role_id` (`user_id`,`role_id`) USING BTREE, + KEY `role_id` (`role_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户与角色关系表'; + +-- ---------------------------- +-- Records of sys_user_role +-- ---------------------------- +BEGIN; +INSERT INTO `sys_user_role` (`id`, `user_id`, `role_id`) VALUES ('1', '1', '1'); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_telephone +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_telephone`; +CREATE TABLE `sys_user_telephone` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `telephone` varchar(11) NOT NULL COMMENT '手机号', + `user_id` varchar(32) DEFAULT NULL COMMENT '用户ID', + PRIMARY KEY (`id`), + UNIQUE KEY `telephone` (`telephone`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户绑定手机号表'; + +-- ---------------------------- +-- Records of sys_user_telephone +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_order_chart +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_order_chart`; +CREATE TABLE `tbl_order_chart` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `total_amount` decimal(24,2) NOT NULL COMMENT '单据总金额', + `create_time` datetime NOT NULL COMMENT '创建时间', + `create_date` varchar(19) NOT NULL COMMENT '创建日期', + `create_hour` varchar(13) NOT NULL COMMENT '创建时间(小时)', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`), + KEY `create_time` (`create_time`), + KEY `create_date` (`create_date`), + KEY `create_hour` (`create_hour`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单图表数据'; + +-- ---------------------------- +-- Records of tbl_order_chart +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_order_time_line +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_order_time_line`; +CREATE TABLE `tbl_order_time_line` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `order_id` varchar(32) NOT NULL COMMENT '单据ID', + `content` longtext COMMENT '描述内容', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`), + KEY `order_id` (`order_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='单据时间轴'; + +-- ---------------------------- +-- Records of tbl_order_time_line +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_pre_take_stock_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_pre_take_stock_sheet`; +CREATE TABLE `tbl_pre_take_stock_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `take_status` tinyint(3) NOT NULL COMMENT '盘点状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `sc_id` (`sc_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存预先盘点单'; + +-- ---------------------------- +-- Records of tbl_pre_take_stock_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_pre_take_stock_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_pre_take_stock_sheet_detail`; +CREATE TABLE `tbl_pre_take_stock_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '预先盘点单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `first_num` int(11) DEFAULT NULL COMMENT '初盘数量', + `second_num` int(11) DEFAULT NULL COMMENT '复盘数量', + `rand_num` int(11) DEFAULT NULL COMMENT '抽盘数量', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存预先盘点单明细'; + +-- ---------------------------- +-- Records of tbl_pre_take_stock_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_product_stock +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_product_stock`; +CREATE TABLE `tbl_product_stock` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL DEFAULT '0' COMMENT '库存数量', + `tax_price` decimal(24,6) NOT NULL COMMENT '含税价格', + `tax_amount` decimal(24,2) NOT NULL COMMENT '含税金额', + `un_tax_price` decimal(24,6) NOT NULL COMMENT '无税价格', + `un_tax_amount` decimal(24,6) NOT NULL COMMENT '无税金额', + PRIMARY KEY (`id`), + UNIQUE KEY `product_id` (`product_id`,`sc_id`) USING BTREE, + KEY `sc_id` (`sc_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品库存'; + +-- ---------------------------- +-- Records of tbl_product_stock +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_product_stock_log +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_product_stock_log`; +CREATE TABLE `tbl_product_stock_log` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `ori_tax_price` decimal(24,6) NOT NULL COMMENT '原含税成本价', + `cur_tax_price` decimal(24,6) NOT NULL COMMENT '现含税成本价', + `ori_un_tax_price` decimal(24,6) NOT NULL COMMENT '原无税成本价', + `cur_un_tax_price` decimal(24,6) NOT NULL COMMENT '现无税成本价', + `ori_stock_num` int(11) NOT NULL, + `cur_stock_num` int(11) NOT NULL, + `stock_num` int(11) NOT NULL DEFAULT '0' COMMENT '库存数量', + `tax_amount` decimal(24,2) NOT NULL COMMENT '含税金额', + `un_tax_amount` decimal(24,6) NOT NULL COMMENT '无税金额', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `biz_id` varchar(32) DEFAULT NULL COMMENT '业务单据ID', + `biz_code` varchar(32) DEFAULT NULL COMMENT '业务单据号', + `biz_detail_id` varchar(32) DEFAULT NULL COMMENT '业务单据明细ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`), + KEY `sc_id` (`sc_id`), + KEY `create_time` (`create_time`), + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品库存变动记录'; + +-- ---------------------------- +-- Records of tbl_product_stock_log +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_purchase_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_config`; +CREATE TABLE `tbl_purchase_config` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `receive_require_purchase` tinyint(1) NOT NULL DEFAULT '0' COMMENT '采购收货单是否关联采购订单', + `receive_multiple_relate_purchase` tinyint(1) NOT NULL DEFAULT '0' COMMENT '采购收货单是否多次关联采购订单', + `purchase_return_require_receive` tinyint(1) NOT NULL DEFAULT '0' COMMENT '采购退货单是否关联采购收货单', + `purchase_return_multiple_relate_receive` tinyint(1) NOT NULL DEFAULT '0' COMMENT '采购退货单是否多次关联采购收货单', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购参数设置'; + +-- ---------------------------- +-- Records of tbl_purchase_config +-- ---------------------------- +BEGIN; +INSERT INTO `tbl_purchase_config` (`id`, `receive_require_purchase`, `receive_multiple_relate_purchase`, `purchase_return_require_receive`, `purchase_return_multiple_relate_receive`) VALUES ('1', 1, 1, 1, 1); +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_purchase_order +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_order`; +CREATE TABLE `tbl_purchase_order` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', + `purchaser_id` varchar(32) DEFAULT NULL COMMENT '采购员ID', + `expect_arrive_date` date DEFAULT NULL COMMENT '预计到货日期', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '采购数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '采购金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `sc_id` (`sc_id`), + KEY `supplier_id` (`supplier_id`), + KEY `create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购订单'; + +-- ---------------------------- +-- Records of tbl_purchase_order +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_purchase_order_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_order_detail`; +CREATE TABLE `tbl_purchase_order_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `order_id` varchar(32) NOT NULL COMMENT '订单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '采购数量', + `tax_price` decimal(16,2) NOT NULL COMMENT '采购价', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `receive_num` int(11) NOT NULL DEFAULT '0' COMMENT '已收货数量', + PRIMARY KEY (`id`), + KEY `order_id` (`order_id`), + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购订单明细'; + +-- ---------------------------- +-- Records of tbl_purchase_order_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_purchase_return +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_return`; +CREATE TABLE `tbl_purchase_return` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', + `purchaser_id` varchar(32) DEFAULT NULL COMMENT '采购员ID', + `payment_date` date DEFAULT NULL COMMENT '付款日期', + `receive_sheet_id` varchar(32) DEFAULT NULL COMMENT '收货单ID', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '退货金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `tx_id` varchar(100) DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `sc_id` (`sc_id`) USING BTREE, + KEY `supplier_id` (`supplier_id`) USING BTREE, + KEY `receive_sheet_id` (`receive_sheet_id`), + KEY `create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购退单'; + +-- ---------------------------- +-- Records of tbl_purchase_return +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_purchase_return_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_purchase_return_detail`; +CREATE TABLE `tbl_purchase_return_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `return_id` varchar(32) NOT NULL COMMENT '收货单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `return_num` int(11) NOT NULL COMMENT '退货数量', + `tax_price` decimal(16,2) NOT NULL COMMENT '采购价', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `receive_sheet_detail_id` varchar(32) DEFAULT NULL COMMENT '收货单明细ID', + PRIMARY KEY (`id`), + KEY `return_id` (`return_id`) USING BTREE, + KEY `receive_sheet_detail_id` (`receive_sheet_detail_id`), + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购退单明细'; + +-- ---------------------------- +-- Records of tbl_purchase_return_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_receive_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_receive_sheet`; +CREATE TABLE `tbl_receive_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', + `purchaser_id` varchar(32) DEFAULT NULL COMMENT '采购员ID', + `payment_date` date DEFAULT NULL COMMENT '付款日期', + `receive_date` date DEFAULT NULL COMMENT '到货日期', + `purchase_order_id` varchar(32) DEFAULT NULL COMMENT '采购单ID', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '收货金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `tx_id` varchar(100) DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `sc_id` (`sc_id`) USING BTREE, + KEY `supplier_id` (`supplier_id`) USING BTREE, + KEY `purchase_order_id` (`purchase_order_id`), + KEY `create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购收货单'; + +-- ---------------------------- +-- Records of tbl_receive_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_receive_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_receive_sheet_detail`; +CREATE TABLE `tbl_receive_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '收货单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '采购数量', + `tax_price` decimal(16,2) NOT NULL COMMENT '采购价', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `purchase_order_detail_id` varchar(32) DEFAULT NULL COMMENT '采购订单明细ID', + `return_num` int(11) NOT NULL DEFAULT '0' COMMENT '已退货数量', + PRIMARY KEY (`id`), + KEY `sheet_id` (`sheet_id`) USING BTREE, + KEY `purchase_order_detail_id` (`purchase_order_detail_id`), + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购收货单明细'; + +-- ---------------------------- +-- Records of tbl_receive_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_retail_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_config`; +CREATE TABLE `tbl_retail_config` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `retail_out_sheet_require_member` tinyint(1) NOT NULL DEFAULT '1' COMMENT '零售出库单上的会员是否必填', + `retail_return_require_out_stock` tinyint(1) NOT NULL DEFAULT '0' COMMENT '零售退货单是否关联零售出库单', + `retail_return_multiple_relate_out_stock` tinyint(1) NOT NULL DEFAULT '0' COMMENT '零售退货单是否多次关联零售出库单', + `retail_return_require_member` tinyint(1) NOT NULL DEFAULT '1' COMMENT '零售退货单上的会员是否必填', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='零售参数设置'; + +-- ---------------------------- +-- Records of tbl_retail_config +-- ---------------------------- +BEGIN; +INSERT INTO `tbl_retail_config` (`id`, `retail_out_sheet_require_member`, `retail_return_require_out_stock`, `retail_return_multiple_relate_out_stock`, `retail_return_require_member`) VALUES ('1', 0, 0, 1, 0); +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_retail_out_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_out_sheet`; +CREATE TABLE `tbl_retail_out_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `member_id` varchar(32) DEFAULT NULL COMMENT '会员ID', + `saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID', + `payment_date` date DEFAULT NULL COMMENT '付款日期', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '出库金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `sc_id` (`sc_id`) USING BTREE, + KEY `create_time` (`create_time`), + KEY `member_id` (`member_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='零售出库单'; + +-- ---------------------------- +-- Records of tbl_retail_out_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_retail_out_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_out_sheet_detail`; +CREATE TABLE `tbl_retail_out_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '出库单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `ori_price` decimal(16,2) NOT NULL COMMENT '原价', + `tax_price` decimal(16,2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `return_num` int(11) NOT NULL DEFAULT '0' COMMENT '已退货数量', + PRIMARY KEY (`id`), + KEY `sheet_id` (`sheet_id`) USING BTREE, + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='零售出库单明细'; + +-- ---------------------------- +-- Records of tbl_retail_out_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_retail_out_sheet_detail_lot +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_out_sheet_detail_lot`; +CREATE TABLE `tbl_retail_out_sheet_detail_lot` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `detail_id` varchar(32) NOT NULL COMMENT '明细ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `return_num` int(11) NOT NULL DEFAULT '0' COMMENT '已退货数量', + `cost_tax_amount` decimal(24,2) NOT NULL COMMENT '含税成本金额', + `cost_un_tax_amount` decimal(24,6) NOT NULL COMMENT '无税成本金额', + `settle_status` tinyint(3) NOT NULL COMMENT '结算状态', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`), + KEY `detail_id` (`detail_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='零售出库单批次明细'; + +-- ---------------------------- +-- Records of tbl_retail_out_sheet_detail_lot +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_retail_return +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_return`; +CREATE TABLE `tbl_retail_return` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `member_id` varchar(32) DEFAULT NULL COMMENT '会员ID', + `saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID', + `payment_date` date DEFAULT NULL COMMENT '付款日期', + `out_sheet_id` varchar(32) DEFAULT NULL COMMENT '出库单ID', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '退货金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `sc_id` (`sc_id`) USING BTREE, + KEY `create_time` (`create_time`), + KEY `out_sheet_id` (`out_sheet_id`) USING BTREE, + KEY `member_id` (`member_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='零售退单'; + +-- ---------------------------- +-- Records of tbl_retail_return +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_retail_return_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_retail_return_detail`; +CREATE TABLE `tbl_retail_return_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `return_id` varchar(32) NOT NULL COMMENT '退货单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `return_num` int(11) NOT NULL COMMENT '退货数量', + `ori_price` decimal(16,2) NOT NULL COMMENT '原价', + `tax_price` decimal(16,2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `out_sheet_detail_id` varchar(32) DEFAULT NULL COMMENT '出库单明细ID', + PRIMARY KEY (`id`), + KEY `return_id` (`return_id`) USING BTREE, + KEY `out_sheet_detail_id` (`out_sheet_detail_id`) USING BTREE, + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='零售退单明细'; + +-- ---------------------------- +-- Records of tbl_retail_return_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_config`; +CREATE TABLE `tbl_sale_config` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `out_stock_require_sale` tinyint(1) NOT NULL DEFAULT '0' COMMENT '销售出库单是否关联销售订单', + `out_stock_multiple_relate_sale` tinyint(1) NOT NULL DEFAULT '0' COMMENT '销售出库单是否多次关联销售订单', + `sale_return_require_out_stock` tinyint(1) NOT NULL DEFAULT '0' COMMENT '销售退货单是否关联销售出库单', + `sale_return_multiple_relate_out_stock` tinyint(1) NOT NULL DEFAULT '0' COMMENT '销售退货单是否多次关联销售出库单', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售参数设置'; + +-- ---------------------------- +-- Records of tbl_sale_config +-- ---------------------------- +BEGIN; +INSERT INTO `tbl_sale_config` (`id`, `out_stock_require_sale`, `out_stock_multiple_relate_sale`, `sale_return_require_out_stock`, `sale_return_multiple_relate_out_stock`) VALUES ('1', 0, 0, 0, 0); +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_order +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_order`; +CREATE TABLE `tbl_sale_order` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `customer_id` varchar(32) NOT NULL COMMENT '客户ID', + `saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '销售数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '销售金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `sc_id` (`sc_id`), + KEY `create_time` (`create_time`), + KEY `customer_id` (`customer_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售订单'; + +-- ---------------------------- +-- Records of tbl_sale_order +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_order_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_order_detail`; +CREATE TABLE `tbl_sale_order_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `order_id` varchar(32) NOT NULL COMMENT '订单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '销售数量', + `ori_price` decimal(16,2) NOT NULL COMMENT '原价', + `tax_price` decimal(16,2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `out_num` int(11) NOT NULL DEFAULT '0' COMMENT '已出库数量', + PRIMARY KEY (`id`), + KEY `order_id` (`order_id`), + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售订单明细'; + +-- ---------------------------- +-- Records of tbl_sale_order_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_out_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_out_sheet`; +CREATE TABLE `tbl_sale_out_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `customer_id` varchar(32) NOT NULL COMMENT '客户ID', + `saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID', + `payment_date` date DEFAULT NULL COMMENT '付款日期', + `sale_order_id` varchar(32) DEFAULT NULL COMMENT '销售单ID', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '出库金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `tx_id` varchar(100) DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `sc_id` (`sc_id`) USING BTREE, + KEY `create_time` (`create_time`), + KEY `customer_id` (`customer_id`) USING BTREE, + KEY `sale_order_id` (`sale_order_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售出库单'; + +-- ---------------------------- +-- Records of tbl_sale_out_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_out_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_out_sheet_detail`; +CREATE TABLE `tbl_sale_out_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '出库单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `ori_price` decimal(16,2) NOT NULL COMMENT '原价', + `tax_price` decimal(16,2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `sale_order_detail_id` varchar(32) DEFAULT NULL COMMENT '销售订单明细ID', + `return_num` int(11) NOT NULL DEFAULT '0' COMMENT '已退货数量', + PRIMARY KEY (`id`), + KEY `sheet_id` (`sheet_id`) USING BTREE, + KEY `purchase_order_detail_id` (`sale_order_detail_id`), + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售出库单明细'; + +-- ---------------------------- +-- Records of tbl_sale_out_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_out_sheet_detail_lot +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_out_sheet_detail_lot`; +CREATE TABLE `tbl_sale_out_sheet_detail_lot` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `detail_id` varchar(32) NOT NULL COMMENT '明细ID', + `order_num` int(11) NOT NULL COMMENT '出库数量', + `return_num` int(11) NOT NULL DEFAULT '0' COMMENT '已退货数量', + `cost_tax_amount` decimal(24,2) NOT NULL COMMENT '含税成本金额', + `cost_un_tax_amount` decimal(24,6) NOT NULL COMMENT '无税成本金额', + `settle_status` tinyint(3) NOT NULL COMMENT '结算状态', + `order_no` int(11) NOT NULL COMMENT '排序编号', + PRIMARY KEY (`id`), + KEY `detail_id` (`detail_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售出库单批次明细'; + +-- ---------------------------- +-- Records of tbl_sale_out_sheet_detail_lot +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_return +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_return`; +CREATE TABLE `tbl_sale_return` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '单号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `customer_id` varchar(32) NOT NULL COMMENT '客户ID', + `saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID', + `payment_date` date DEFAULT NULL COMMENT '付款日期', + `out_sheet_id` varchar(32) DEFAULT NULL COMMENT '出库单ID', + `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量', + `total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量', + `total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '退货金额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `tx_id` varchar(100) DEFAULT NULL COMMENT '事务ID', + `ori_settle_status` tinyint(3) DEFAULT NULL COMMENT '结算状态中间态', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) USING BTREE, + KEY `sc_id` (`sc_id`) USING BTREE, + KEY `create_time` (`create_time`), + KEY `customer_id` (`customer_id`) USING BTREE, + KEY `out_sheet_id` (`out_sheet_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售退单'; + +-- ---------------------------- +-- Records of tbl_sale_return +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_sale_return_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_sale_return_detail`; +CREATE TABLE `tbl_sale_return_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `return_id` varchar(32) NOT NULL COMMENT '退货单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `return_num` int(11) NOT NULL COMMENT '退货数量', + `ori_price` decimal(16,2) NOT NULL COMMENT '原价', + `tax_price` decimal(16,2) NOT NULL COMMENT '现价', + `discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)', + `is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品', + `tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态', + `out_sheet_detail_id` varchar(32) DEFAULT NULL COMMENT '出库单明细ID', + PRIMARY KEY (`id`), + KEY `return_id` (`return_id`) USING BTREE, + KEY `out_sheet_detail_id` (`out_sheet_detail_id`) USING BTREE, + KEY `product_id` (`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售退单明细'; + +-- ---------------------------- +-- Records of tbl_sale_return_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_shop +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_shop`; +CREATE TABLE `tbl_shop` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `dept_id` varchar(32) DEFAULT NULL COMMENT '所属部门ID', + `lng` decimal(16,6) DEFAULT NULL COMMENT '经度', + `lat` decimal(16,6) DEFAULT NULL COMMENT '纬度', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 1-在用 0停用', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='门店'; + +-- ---------------------------- +-- Records of tbl_shop +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_stock_cost_adjust_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_stock_cost_adjust_sheet`; +CREATE TABLE `tbl_stock_cost_adjust_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `product_num` int(11) NOT NULL COMMENT '调价品种数', + `diff_amount` decimal(24,2) NOT NULL COMMENT '库存调价差额', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `sc_id` (`sc_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存成本调整单'; + +-- ---------------------------- +-- Records of tbl_stock_cost_adjust_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_stock_cost_adjust_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_stock_cost_adjust_sheet_detail`; +CREATE TABLE `tbl_stock_cost_adjust_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '单据ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL COMMENT '库存数量', + `purchase_price` decimal(16,2) NOT NULL COMMENT '档案采购价', + `ori_price` decimal(16,2) NOT NULL COMMENT '调整前成本价', + `price` decimal(16,2) NOT NULL COMMENT '调整后成本价', + `diff_amount` decimal(24,2) NOT NULL COMMENT '库存调价差额', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存成本调整单明细'; + +-- ---------------------------- +-- Records of tbl_stock_cost_adjust_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_take_stock_config +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_config`; +CREATE TABLE `tbl_take_stock_config` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `show_product` tinyint(1) NOT NULL DEFAULT '0' COMMENT '库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据', + `show_stock` tinyint(1) NOT NULL DEFAULT '0' COMMENT '库存盘点单是否显示盘点任务创建时商品的系统库存数量', + `auto_change_stock` tinyint(1) NOT NULL DEFAULT '0' COMMENT '盘点差异生成时是否自动调整盘点任务中商品的系统库存数量', + `allow_change_num` tinyint(1) NOT NULL DEFAULT '0' COMMENT '盘点差异单中的盘点数量是否允许手动修改', + `cancel_hours` int(11) NOT NULL DEFAULT '24' COMMENT '盘点任务创建后多少小时内内未完成,则自动作废', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存盘点参数设置'; + +-- ---------------------------- +-- Records of tbl_take_stock_config +-- ---------------------------- +BEGIN; +INSERT INTO `tbl_take_stock_config` (`id`, `show_product`, `show_stock`, `auto_change_stock`, `allow_change_num`, `cancel_hours`) VALUES ('1', 1, 1, 1, 1, 168); +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_take_stock_plan +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_plan`; +CREATE TABLE `tbl_take_stock_plan` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `take_type` tinyint(3) NOT NULL COMMENT '盘点类别', + `biz_id` longtext COMMENT '业务ID', + `take_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '盘点状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `sc_id` (`sc_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存盘点任务'; + +-- ---------------------------- +-- Records of tbl_take_stock_plan +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_take_stock_plan_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_plan_detail`; +CREATE TABLE `tbl_take_stock_plan_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `plan_id` varchar(32) NOT NULL COMMENT '盘点任务ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL COMMENT '初始库存数量', + `ori_take_num` int(11) DEFAULT NULL COMMENT '盘点数量', + `take_num` int(11) DEFAULT NULL COMMENT '修改后的盘点数量', + `total_out_num` int(11) NOT NULL DEFAULT '0' COMMENT '出项数量', + `total_in_num` int(11) NOT NULL DEFAULT '0' COMMENT '入项数量', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL DEFAULT '0' COMMENT '排序', + PRIMARY KEY (`id`), + UNIQUE KEY `plan_id` (`plan_id`,`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存盘点任务明细'; + +-- ---------------------------- +-- Records of tbl_take_stock_plan_detail +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_take_stock_sheet +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_sheet`; +CREATE TABLE `tbl_take_stock_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '业务单据号', + `plan_id` varchar(32) NOT NULL COMMENT '盘点任务ID', + `pre_sheet_id` varchar(32) DEFAULT NULL COMMENT '预先盘点单ID', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `code` (`code`), + KEY `plan_id` (`plan_id`), + KEY `sc_id` (`sc_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存盘点单'; + +-- ---------------------------- +-- Records of tbl_take_stock_sheet +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for tbl_take_stock_sheet_detail +-- ---------------------------- +DROP TABLE IF EXISTS `tbl_take_stock_sheet_detail`; +CREATE TABLE `tbl_take_stock_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '盘点单ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `take_num` int(11) NOT NULL COMMENT '盘点数量', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存盘点单明细'; + +-- ---------------------------- +-- Records of tbl_take_stock_sheet_detail +-- ---------------------------- +BEGIN; +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.1__paytype.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.1__paytype.sql new file mode 100644 index 0000000..aca2de3 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.1__paytype.sql @@ -0,0 +1,425 @@ +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000008', '2000008', 'PayType', '支付方式', NULL, 0, '/base-data/pay-type/index', NULL, '2000', '/pay-type', 0, 1, 0, 'base-data:pay-type:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000008001', '2000008001', '', '新增支付方式', NULL, 0, '', NULL, '2000008', '', 0, 2, 0, 'base-data:pay-type:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000008002', '2000008002', '', '修改支付方式', NULL, 0, '', NULL, '2000008', '', 0, 2, 0, 'base-data:pay-type:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for base_data_pay_type +-- ---------------------------- +DROP TABLE IF EXISTS `base_data_pay_type`; +CREATE TABLE `base_data_pay_type` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `rec_text` tinyint(1) NOT NULL COMMENT '是否记录内容', + `available` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付方式' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of base_data_pay_type +-- ---------------------------- +INSERT INTO `base_data_pay_type` VALUES ('1', '001', '现金', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('2', '002', '微信支付', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('3', '003', '支付宝支付', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('4', '004', '移动支付', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('5', '005', '优惠券', 1, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); +INSERT INTO `base_data_pay_type` VALUES ('6', '006', '积分', 0, 1, '', '系统管理员', '1', '2023-03-21 10:09:44', '系统管理员', '1', '2023-03-21 10:12:30'); + +SET FOREIGN_KEY_CHECKS = 1; + +ALTER TABLE `base_data_store_center` + ADD COLUMN `zip_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮编' AFTER `people_num`, + ADD COLUMN `receiver` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货人' AFTER `zip_code`, + ADD COLUMN `receive_telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货手机号' AFTER `receiver`, + ADD COLUMN `receive_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货地址' AFTER `receive_telephone`, + ADD COLUMN `sender` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货人' AFTER `receive_address`, + ADD COLUMN `send_telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货手机号' AFTER `sender`, + ADD COLUMN `send_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货地址' AFTER `send_telephone`; + +ALTER TABLE `base_data_supplier` + CHANGE COLUMN `delivery_address` `send_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发货地址' AFTER `address`, + ADD COLUMN `sender` varchar(200) NULL COMMENT '发货人' AFTER `address`, + ADD COLUMN `send_telephone` varchar(20) NULL COMMENT '发货手机号' AFTER `sender`; + +ALTER TABLE `base_data_member` + ADD COLUMN `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区ID' AFTER `guider_id`, + ADD COLUMN `zip_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮编' AFTER `city_id`, + ADD COLUMN `receiver` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货人' AFTER `zip_code`, + ADD COLUMN `receive_telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货手机号' AFTER `receiver`, + ADD COLUMN `receive_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货地址' AFTER `receive_telephone`; + +DROP TABLE IF EXISTS `base_data_address`; +CREATE TABLE `base_data_address` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `entity_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '实体ID', + `entity_type` tinyint(3) NOT NULL COMMENT '实体类型', + `address_type` tinyint(3) NOT NULL COMMENT '地址类型', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '姓名', + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号', + `province_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '省', + `city_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '市', + `district_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '区', + `address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '详细地址', + `is_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否默认地址', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `entity_id`(`entity_id`, `entity_type`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '地址库' ROW_FORMAT = Dynamic; +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000009', '2000009', 'Address', '地址库', NULL, 0, '/base-data/address/index', NULL, '2000', '/address', 0, 1, 0, 'base-data:address:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000009001', '2000009001', '', '新增地址', NULL, 0, '', NULL, '2000009', '', 0, 2, 0, 'base-data:address:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000009002', '2000009002', '', '修改地址', NULL, 0, '', NULL, '2000009', '', 0, 2, 0, 'base-data:address:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000009003', '2000009003', '', '导出地址', NULL, 0, '', NULL, '2000009', '', 0, 2, 0, 'base-data:address:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000009004', '2000009004', '', '导入地址', NULL, 0, '', NULL, '2000009', '', 0, 2, 0, 'base-data:address:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); + +INSERT INTO base_data_address ( + id, + entity_id, + entity_type, + address_type, + `name`, + telephone, + province_id, + city_id, + district_id, + address, + is_default, + create_by, + create_by_id, + create_time, + update_by, + update_by_id, + update_time +) SELECT + CONCAT(tb.id, 2) AS id, + tb.id AS entity_id, + 1 AS entity_type, + 2 AS address_type, + tb.receiver, + tb.receive_telephone, + p.id AS province_id, + c.id AS city_id, + d.id AS district_id, + tb.receive_address, + 1 AS is_default, + tb.create_by, + tb.create_by_id, + tb.create_time, + tb.update_by, + tb.update_by_id, + tb.update_time +FROM + base_data_store_center AS tb + INNER JOIN dic_city AS d ON d.id = tb.city_id + INNER JOIN dic_city as c ON c.id = d.parent_id + INNER JOIN dic_city as p ON p.id = c.parent_id +WHERE + tb.receiver IS NOT NULL + AND tb.receiver != '' + AND tb.receive_telephone IS NOT NULL + AND tb.receive_telephone != '' + AND tb.receive_address IS NOT NULL + AND tb.receive_address != ''; + +INSERT INTO base_data_address ( + id, + entity_id, + entity_type, + address_type, + `name`, + telephone, + province_id, + city_id, + district_id, + address, + is_default, + create_by, + create_by_id, + create_time, + update_by, + update_by_id, + update_time +) SELECT + CONCAT(tb.id, 2) AS id, + tb.id AS entity_id, + 2 AS entity_type, + 2 AS address_type, + tb.receiver, + tb.receive_telephone, + p.id AS province_id, + c.id AS city_id, + d.id AS district_id, + tb.receive_address, + 1 AS is_default, + tb.create_by, + tb.create_by_id, + tb.create_time, + tb.update_by, + tb.update_by_id, + tb.update_time +FROM + base_data_customer AS tb + INNER JOIN dic_city AS d ON d.id = tb.city_id + INNER JOIN dic_city as c ON c.id = d.parent_id + INNER JOIN dic_city as p ON p.id = c.parent_id +WHERE + tb.receiver IS NOT NULL + AND tb.receiver != '' + AND tb.receive_telephone IS NOT NULL + AND tb.receive_telephone != '' + AND tb.receive_address IS NOT NULL + AND tb.receive_address != ''; + +INSERT INTO base_data_address ( + id, + entity_id, + entity_type, + address_type, + `name`, + telephone, + province_id, + city_id, + district_id, + address, + is_default, + create_by, + create_by_id, + create_time, + update_by, + update_by_id, + update_time +) SELECT + CONCAT(tb.id, 2) AS id, + tb.id AS entity_id, + 4 AS entity_type, + 2 AS address_type, + tb.receiver, + tb.receive_telephone, + p.id AS province_id, + c.id AS city_id, + d.id AS district_id, + tb.receive_address, + 1 AS is_default, + tb.create_by, + tb.create_by_id, + tb.create_time, + tb.update_by, + tb.update_by_id, + tb.update_time +FROM + base_data_member AS tb + INNER JOIN dic_city AS d ON d.id = tb.city_id + INNER JOIN dic_city as c ON c.id = d.parent_id + INNER JOIN dic_city as p ON p.id = c.parent_id +WHERE + tb.receiver IS NOT NULL + AND tb.receiver != '' + AND tb.receive_telephone IS NOT NULL + AND tb.receive_telephone != '' + AND tb.receive_address IS NOT NULL + AND tb.receive_address != ''; + +INSERT INTO base_data_address ( + id, + entity_id, + entity_type, + address_type, + `name`, + telephone, + province_id, + city_id, + district_id, + address, + is_default, + create_by, + create_by_id, + create_time, + update_by, + update_by_id, + update_time +) SELECT + CONCAT(tb.id, 1) AS id, + tb.id AS entity_id, + 1 AS entity_type, + 1 AS address_type, + tb.sender, + tb.send_telephone, + p.id AS province_id, + c.id AS city_id, + d.id AS district_id, + tb.send_address, + 1 AS is_default, + tb.create_by, + tb.create_by_id, + tb.create_time, + tb.update_by, + tb.update_by_id, + tb.update_time +FROM + base_data_store_center AS tb + INNER JOIN dic_city AS d ON d.id = tb.city_id + INNER JOIN dic_city as c ON c.id = d.parent_id + INNER JOIN dic_city as p ON p.id = c.parent_id +WHERE + tb.sender IS NOT NULL + AND tb.sender != '' + AND tb.send_telephone IS NOT NULL + AND tb.send_telephone != '' + AND tb.send_address IS NOT NULL + AND tb.send_address != ''; + +INSERT INTO base_data_address ( + id, + entity_id, + entity_type, + address_type, + `name`, + telephone, + province_id, + city_id, + district_id, + address, + is_default, + create_by, + create_by_id, + create_time, + update_by, + update_by_id, + update_time +) SELECT + CONCAT(tb.id, 1) AS id, + tb.id AS entity_id, + 3 AS entity_type, + 1 AS address_type, + tb.sender, + tb.send_telephone, + p.id AS province_id, + c.id AS city_id, + d.id AS district_id, + tb.send_address, + 1 AS is_default, + tb.create_by, + tb.create_by_id, + tb.create_time, + tb.update_by, + tb.update_by_id, + tb.update_time +FROM + base_data_supplier AS tb + INNER JOIN dic_city AS d ON d.id = tb.city_id + INNER JOIN dic_city as c ON c.id = d.parent_id + INNER JOIN dic_city as p ON p.id = c.parent_id +WHERE + tb.sender IS NOT NULL + AND tb.sender != '' + AND tb.send_telephone IS NOT NULL + AND tb.send_telephone != '' + AND tb.send_address IS NOT NULL + AND tb.send_address != ''; + +ALTER TABLE `base_data_customer` +DROP COLUMN `receiver`, +DROP COLUMN `receive_telephone`, +DROP COLUMN `receive_address`; + +ALTER TABLE `base_data_member` +DROP COLUMN `zip_code`, +DROP COLUMN `receiver`, +DROP COLUMN `receive_telephone`, +DROP COLUMN `receive_address`; + +ALTER TABLE `base_data_supplier` +DROP COLUMN `sender`, +DROP COLUMN `send_telephone`, +DROP COLUMN `send_address`; + +ALTER TABLE `base_data_store_center` +DROP COLUMN `zip_code`, +DROP COLUMN `receiver`, +DROP COLUMN `receive_telephone`, +DROP COLUMN `receive_address`, +DROP COLUMN `sender`, +DROP COLUMN `send_telephone`, +DROP COLUMN `send_address`; + +DROP TABLE IF EXISTS `tbl_order_pay_type`; +CREATE TABLE `tbl_order_pay_type` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单ID', + `pay_type_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支付方式ID', + `pay_amount` decimal(24, 2) NOT NULL COMMENT '支付金额', + `text` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付内容', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单支付方式' ROW_FORMAT = Dynamic; + +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_purchase_order where total_amount > 0; +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_receive_sheet where total_amount > 0; +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_purchase_return where total_amount > 0; +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_retail_out_sheet where total_amount > 0; +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_retail_return where total_amount > 0; +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_sale_order where total_amount > 0; +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_sale_out_sheet where total_amount > 0; +insert into tbl_order_pay_type (id, order_id, pay_type_id, pay_amount, text) select id, id, 1, total_amount, NULL from tbl_sale_return where total_amount > 0; + +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000002003', '1000002003', '', '部门权限', NULL, 0, '', NULL, '1000002', '', 0, 2, 0, 'system:dept:permission', 1, 1, '', '系统管理员', '1', '2021-06-27 01:33:47', '系统管理员', '1', '2021-07-04 00:34:23'); +DROP TABLE IF EXISTS `sys_data_permission_data`; +CREATE TABLE `sys_data_permission_data` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `biz_id` varchar(32) NOT NULL COMMENT '业务ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `permission_type` tinyint(3) NOT NULL COMMENT '权限类型', + `permission` longtext NOT NULL COMMENT '数据权限', + PRIMARY KEY (`id`), + UNIQUE KEY `biz_id` (`biz_id`,`biz_type`,`permission_type`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据权限数据'; +DROP TABLE IF EXISTS `sys_data_permission_model_detail`; +CREATE TABLE `sys_data_permission_model_detail` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `model_id` int(11) NOT NULL COMMENT '模型ID', + `condition_type` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '条件', + `input_type` tinyint(3) NOT NULL COMMENT '输入类型', + `table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '表名', + `column_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字段名', + `enum_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '前端枚举名', + `sql_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'SQL', + PRIMARY KEY (`id`) USING BTREE, + INDEX `model_id`(`model_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据权限模型明细' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_data_permission_model_detail +-- ---------------------------- +INSERT INTO `sys_data_permission_model_detail` VALUES (1, '编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (2, '名称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (3, '简称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'short_name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (4, 'SKU', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'sku_code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (5, '外部编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'external_code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (6, '品类编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'category', 'code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (7, '品类名称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'category', 'name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (8, '品牌编号', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'brand', 'code', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (9, '品牌名称', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'brand', 'name', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (10, '规格', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'spec', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (11, '单位', 1, '0,1,2,3,4,5,6,7,8,9,10', 0, 'product', 'unit', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (12, '状态', 1, '0,5,6,7', 1, 'product', 'available', 'AVAILABLE', NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (13, '创建时间', 1, '0,1,2,3,4,5', 2, 'product', 'create_time', NULL, NULL); +INSERT INTO `sys_data_permission_model_detail` VALUES (14, '创建人部门与本人相同', 2, '6', 99, 'order', 'create_by_id', NULL, 'SELECT __ud.user_id FROM sys_user_dept AS __ud WHERE __ud.dept_id IN ({__var#curDeptIds})'); +INSERT INTO `sys_data_permission_model_detail` VALUES (15, '创建人部门是本人的上级部门', 2, '6', 99, 'order', 'create_by_id', NULL, 'SELECT DISTINCT __ud.user_id FROM sys_user_dept AS __ud WHERE FIND_IN_SET(__ud.dept_id,(SELECT GROUP_CONCAT(__mp.path) FROM sys_dept AS __d INNER JOIN recursion_mapping AS __mp ON __mp.node_id=__d.id AND __mp.node_type=1 WHERE __d.id IN ({__var#curDeptIds}) AND __mp.level> 1))'); +INSERT INTO `sys_data_permission_model_detail` VALUES (16, '创建人部门是本人的下级部门', 2, '6', 99, 'order', 'create_by_id', NULL, 'SELECT DISTINCT __ud.user_id FROM sys_user_dept AS __ud WHERE __ud.dept_id IN (SELECT __mp.node_id FROM recursion_mapping AS __mp WHERE FIND_IN_SET((SELECT __d.id FROM sys_dept AS __d WHERE __d.id IN ({__var#curDeptIds})),__mp.path) AND __mp.node_type=1)'); +INSERT INTO `sys_data_permission_model_detail` VALUES (17, '创建时间', 2, '0,1,2,3,4,5', 2, 'order', 'create_time', NULL, NULL); diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.2__stock_adjust.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.2__stock_adjust.sql new file mode 100644 index 0000000..e391d22 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.2__stock_adjust.sql @@ -0,0 +1,69 @@ +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005002', '3000005002', 'StockAdjustReason', '库存调整原因', NULL, 0, '/sc/stock/adjust/stock/reason/index', NULL, '3000005', '/stock/reason', 0, 1, 0, 'stock:adjust:reason:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005002001', '3000005002001', '', '新增库存成本调整单', NULL, 0, '', NULL, '3000005002', '', 0, 2, 0, 'stock:adjust:reason:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005002002', '3000005002002', '', '修改库存成本调整单', NULL, 0, '', NULL, '3000005002', '', 0, 2, 0, 'stock:adjust:reason:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); + +DROP TABLE IF EXISTS `tbl_stock_adjust_reason`; +CREATE TABLE `tbl_stock_adjust_reason` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `available` tinyint(1) NOT NULL COMMENT '状态', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '库存调整原因' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of tbl_stock_adjust_reason +-- ---------------------------- +INSERT INTO `tbl_stock_adjust_reason` VALUES ('1', '001', '初始化数据', 1, '系统内置', '系统管理员', '1', '2023-04-18 14:04:34', '系统管理员', '1', '2023-04-18 14:04:53'); +INSERT INTO `tbl_stock_adjust_reason` VALUES ('2', '002', '损溢', 1, '系统内置', '系统管理员', '1', '2023-04-18 14:04:34', '系统管理员', '1', '2023-04-18 14:04:53'); +INSERT INTO `tbl_stock_adjust_reason` VALUES ('3', '003', '其他', 1, '系统内置', '系统管理员', '1', '2023-04-18 14:04:34', '系统管理员', '1', '2023-04-18 14:04:53'); + +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005003', '3000005003', 'StockAdjustSheet', '库存调整', NULL, 0, '/sc/stock/adjust/stock/index', NULL, '3000005', '/stock', 0, 1, 0, 'stock:adjust:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005003001', '3000005003001', '', '新增库存调整单', NULL, 0, '', NULL, '3000005003', '', 0, 2, 0, 'stock:adjust:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005003002', '3000005003002', '', '修改库存调整单', NULL, 0, '', NULL, '3000005003', '', 0, 2, 0, 'stock:adjust:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005003003', '3000005003003', '', '删除库存调整单', NULL, 0, '', NULL, '3000005003', '', 0, 2, 0, 'stock:adjust:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005003004', '3000005003004', '', '导出库存调整单', NULL, 0, '', NULL, '3000005003', '', 0, 2, 0, 'stock:adjust:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000005003005', '3000005003005', '', '审核库存调整单', NULL, 0, '', NULL, '3000005003', '', 0, 2, 0, 'stock:adjust:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); + +DROP TABLE IF EXISTS `tbl_stock_adjust_sheet`; +CREATE TABLE `tbl_stock_adjust_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '业务单据号', + `sc_id` varchar(32) NOT NULL COMMENT '仓库ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + `reason_id` varchar(32) NOT NULL COMMENT '调整原因ID', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) DEFAULT NULL COMMENT '审核人', + `approve_time` datetime DEFAULT NULL COMMENT '审核时间', + `refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `sc_id` (`sc_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存调整单'; + +DROP TABLE IF EXISTS `tbl_stock_adjust_sheet_detail`; +CREATE TABLE `tbl_stock_adjust_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '单据ID', + `product_id` varchar(32) NOT NULL COMMENT '商品ID', + `stock_num` int(11) NOT NULL COMMENT '调整库存数量', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='库存调整单明细'; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.3__sc_transfer.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.3__sc_transfer.sql new file mode 100644 index 0000000..be50159 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.3__sc_transfer.sql @@ -0,0 +1,74 @@ +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000006', '3000006', 'ScTransferOrder', '仓库调拨', NULL, 0, '/sc/stock/transfer/index', NULL, '3000', '/transfer', 0, 1, 0, 'stock:sc-transfer:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000006001', '3000006001', '', '新增仓库调拨单', NULL, 0, '', NULL, '3000006', '', 0, 2, 0, 'stock:sc-transfer:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000006002', '3000006002', '', '修改仓库调拨单', NULL, 0, '', NULL, '3000006', '', 0, 2, 0, 'stock:sc-transfer:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000006003', '3000006003', '', '删除仓库调拨单', NULL, 0, '', NULL, '3000006', '', 0, 2, 0, 'stock:sc-transfer:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000006004', '3000006004', '', '导出仓库调拨单', NULL, 0, '', NULL, '3000006', '', 0, 2, 0, 'stock:sc-transfer:export', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000006005', '3000006005', '', '审核仓库调拨单', NULL, 0, '', NULL, '3000006', '', 0, 2, 0, 'stock:sc-transfer:approve', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('3000006006', '3000006006', '', '仓库调拨单收货', NULL, 0, '', NULL, '3000006', '', 0, 2, 0, 'stock:sc-transfer:receive', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +ALTER TABLE `tbl_retail_out_sheet_detail_lot` +DROP COLUMN `cost_un_tax_amount`; + +ALTER TABLE `tbl_sale_out_sheet_detail_lot` +DROP COLUMN `cost_un_tax_amount`; + +ALTER TABLE `tbl_product_stock_log` +DROP COLUMN `ori_un_tax_price`, +DROP COLUMN `cur_un_tax_price`, +DROP COLUMN `un_tax_amount`; + +ALTER TABLE `tbl_product_stock` +DROP COLUMN `un_tax_price`, +DROP COLUMN `un_tax_amount`; + +DROP TABLE IF EXISTS `tbl_sc_transfer_order`; +CREATE TABLE `tbl_sc_transfer_order` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单号', + `source_sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '转出仓库ID', + `target_sc_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '转入仓库ID', + `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '调拨数量', + `total_amount` decimal(24, 2) NOT NULL DEFAULT 0.00 COMMENT '调拨成本金额', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + `approve_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人', + `approve_time` datetime NULL DEFAULT NULL COMMENT '审核时间', + `status` tinyint(3) NOT NULL COMMENT '状态', + `refuse_reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `code`(`code`) USING BTREE, + INDEX `source_sc_id`(`source_sc_id`) USING BTREE, + INDEX `target_sc_id`(`target_sc_id`) USING BTREE, + INDEX `create_time`(`create_time`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '仓库调拨单' ROW_FORMAT = Dynamic; + +CREATE TABLE `tbl_sc_transfer_order_detail` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '调拨单ID', + `product_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '商品ID', + `transfer_num` int(11) NOT NULL COMMENT '调拨数量', + `tax_price` decimal(16, 2) NULL DEFAULT NULL COMMENT '成本价', + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `order_no` int(11) NOT NULL COMMENT '排序编号', + `receive_num` int(11) NOT NULL DEFAULT 0 COMMENT '已收货数量', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`) USING BTREE, + INDEX `product_id`(`product_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '仓库调拨单明细' ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS `tbl_sc_transfer_order_detail_receive`; +CREATE TABLE `tbl_sc_transfer_order_detail_receive` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `order_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '调拨单ID', + `detail_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '明细ID', + `receive_num` int(11) NOT NULL COMMENT '收货数量', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `order_id`(`order_id`, `detail_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '仓库调拨单收货明细' ROW_FORMAT = Dynamic; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.4__bundle_product.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.4__bundle_product.sql new file mode 100644 index 0000000..4b7ed0d --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.4__bundle_product.sql @@ -0,0 +1,81 @@ +ALTER TABLE `base_data_product` +ADD COLUMN `product_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '商品类型' AFTER `brand_id`; + +ALTER TABLE `tbl_sale_out_sheet_detail` +ADD COLUMN `ori_bundle_detail_id` varchar(32) NULL COMMENT '组合商品原始明细ID' AFTER `sale_order_detail_id`; +ALTER TABLE `tbl_sale_order_detail` +ADD COLUMN `ori_bundle_detail_id` varchar(32) NULL COMMENT '组合商品原始明细ID' AFTER `out_num`; +ALTER TABLE `tbl_retail_out_sheet_detail` +ADD COLUMN `ori_bundle_detail_id` varchar(32) NULL COMMENT '组合商品原始明细ID' AFTER `return_num`; + +DROP TABLE IF EXISTS `base_data_product_bundle`; +CREATE TABLE `base_data_product_bundle` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `main_product_id` varchar(32) NOT NULL COMMENT '主商品ID', + `product_id` varchar(32) NOT NULL COMMENT '单品ID', + `bundle_num` int(11) NOT NULL COMMENT '包含数量', + `sale_price` decimal(24,2) NOT NULL COMMENT '销售价', + `retail_price` decimal(24,2) NOT NULL COMMENT '零售价', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `main_product_id` (`main_product_id`,`product_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='组合商品'; + +DROP TABLE IF EXISTS `tbl_sale_out_sheet_detail_bundle`; +CREATE TABLE `tbl_sale_out_sheet_detail_bundle` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '出库单ID', + `detail_id` varchar(32) NOT NULL COMMENT '明细ID', + `main_product_id` varchar(32) NOT NULL COMMENT '组合商品ID', + `order_num` int(11) NOT NULL DEFAULT '0' COMMENT '组合商品数量', + `product_id` varchar(32) NOT NULL COMMENT '单品ID', + `product_order_num` int(11) NOT NULL COMMENT '单品数量', + `product_ori_price` decimal(16,2) NOT NULL COMMENT '单品原价', + `product_tax_price` decimal(16,2) NOT NULL COMMENT '单品含税价格', + `product_tax_rate` varchar(16) NOT NULL COMMENT '单品税率', + `product_detail_id` varchar(32) DEFAULT NULL COMMENT '单品明细ID', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`product_detail_id`) USING BTREE, + KEY `detail_id` (`detail_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售出库单组合商品明细'; + +DROP TABLE IF EXISTS `tbl_sale_order_detail_bundle`; +CREATE TABLE `tbl_sale_order_detail_bundle` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `order_id` varchar(32) NOT NULL COMMENT '销售单ID', + `detail_id` varchar(32) NOT NULL COMMENT '明细ID', + `main_product_id` varchar(32) NOT NULL COMMENT '组合商品ID', + `order_num` int(11) NOT NULL DEFAULT '0' COMMENT '组合商品数量', + `product_id` varchar(32) NOT NULL COMMENT '单品ID', + `product_order_num` int(11) NOT NULL COMMENT '单品数量', + `product_ori_price` decimal(16,2) NOT NULL COMMENT '单品原价', + `product_tax_price` decimal(16,2) NOT NULL COMMENT '单品含税价格', + `product_tax_rate` varchar(16) NOT NULL COMMENT '单品税率', + `product_detail_id` varchar(32) DEFAULT NULL COMMENT '单品明细ID', + PRIMARY KEY (`id`), + UNIQUE KEY `order_id` (`order_id`,`product_detail_id`) USING BTREE, + KEY `detail_id` (`detail_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售单组合商品明细'; + +DROP TABLE IF EXISTS `tbl_retail_out_sheet_detail_bundle`; +CREATE TABLE `tbl_retail_out_sheet_detail_bundle` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '出库单ID', + `detail_id` varchar(32) NOT NULL COMMENT '明细ID', + `main_product_id` varchar(32) NOT NULL COMMENT '组合商品ID', + `order_num` int(11) NOT NULL DEFAULT '0' COMMENT '组合商品数量', + `product_id` varchar(32) NOT NULL COMMENT '单品ID', + `product_order_num` int(11) NOT NULL COMMENT '单品数量', + `product_ori_price` decimal(16,2) NOT NULL COMMENT '单品原价', + `product_tax_price` decimal(16,2) NOT NULL COMMENT '单品含税价格', + `product_tax_rate` varchar(16) NOT NULL COMMENT '单品税率', + `product_detail_id` varchar(32) DEFAULT NULL COMMENT '单品明细ID', + PRIMARY KEY (`id`), + UNIQUE KEY `sheet_id` (`sheet_id`,`product_detail_id`) USING BTREE, + KEY `detail_id` (`detail_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='零售出库单组合商品明细'; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.5__logistics.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.5__logistics.sql new file mode 100644 index 0000000..980ca45 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.5__logistics.sql @@ -0,0 +1,376 @@ +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000010', '2000010', 'LogisticsCompany', '物流公司', NULL, 0, '/base-data/logistics/company/index', NULL, '2000', '/logistics/company', 0, 1, 0, 'base-data:logistics-company:query', 1, 1, '', '系统管理员', '1', '2021-07-05 21:59:35', '系统管理员', '1', '2021-07-05 21:59:36'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000010001', '2000010001', '', '新增物流公司', NULL, 0, '', NULL, '2000010', '', 0, 2, 0, 'base-data:logistics-company:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('2000010002', '2000010002', '', '修改物流公司', NULL, 0, '', NULL, '2000010', '', 0, 2, 0, 'base-data:logistics-company:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-07-04 00:34:23'); +ALTER TABLE `base_data_product` +ADD COLUMN `weight` decimal(16, 2) NULL COMMENT '重量(kg)' AFTER `unit`, +ADD COLUMN `volume` decimal(16, 2) NULL COMMENT '体积(cm3)' AFTER `weight`; + +ALTER TABLE `sys_menu` +ADD COLUMN `sys_module_id` varchar(32) NULL COMMENT '系统模块ID' AFTER `parent_id`; + +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000001001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000001002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000001003'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000002001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000002002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000002003'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000003'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000003001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000003002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000004'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000004001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000004002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000004003'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000005'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000005001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000005002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000005003'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000006'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000007'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000007001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000007002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000007003'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000008'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000008001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000008002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000009'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010001'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010002'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010003'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010004'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010005'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010006'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010007'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010008'; +UPDATE `sys_menu` SET `sys_module_id` = '2' WHERE `id` = '1000010009'; +UPDATE `sys_menu` SET `sys_module_id` = '1' WHERE `id` = '1000011'; +UPDATE `sys_menu` SET `sys_module_id` = '1' WHERE `id` = '1000011001'; +UPDATE `sys_menu` SET `sys_module_id` = '1' WHERE `id` = '1000011002'; +UPDATE `sys_menu` SET `sys_module_id` = '14' WHERE `id` = '1000012'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000002'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000002001'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000002002'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000002003'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000004'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000004001'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000004002'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000004003'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000005'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000005001'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000005002'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000005003'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000006'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000006001'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000006002'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000006003'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000007'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000007001'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000007002'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000007003'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000008'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000008001'; +UPDATE `sys_menu` SET `sys_module_id` = '3' WHERE `id` = '2000008002'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000009'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000009001'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000009002'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000009003'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000009004'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000010'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000010001'; +UPDATE `sys_menu` SET `sys_module_id` = '15' WHERE `id` = '2000010002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001001001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001001002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001001003'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001002001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001002002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001002003'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001003'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001003001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001003002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001003003'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001003004'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001003005'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001004'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001004001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001004002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001004003'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001004004'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001004005'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001005'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001005001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001005002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001005003'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001006'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001006001'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001006002'; +UPDATE `sys_menu` SET `sys_module_id` = '4' WHERE `id` = '2001006003'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002001'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002002'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002002001'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002002002'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002002003'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002002004'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002002005'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002002006'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002003'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002003001'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002003002'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002003003'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002003004'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002003005'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002003006'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002004'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002004001'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002004002'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002004003'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002004004'; +UPDATE `sys_menu` SET `sys_module_id` = '5' WHERE `id` = '2002004005'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003001'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003002'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003002001'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003002002'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003002003'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003002004'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003002005'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003003'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003003001'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003003002'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003003003'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003003004'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003003005'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003004'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003004001'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003004002'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003004003'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003004004'; +UPDATE `sys_menu` SET `sys_module_id` = '6' WHERE `id` = '2003004005'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004001'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004002'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004002001'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004002002'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004002003'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004002004'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004002005'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004003'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004003001'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004003002'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004003003'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004003004'; +UPDATE `sys_menu` SET `sys_module_id` = '7' WHERE `id` = '2004003005'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000001'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000001001'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000003'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000003001'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004001'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004002'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004002001'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004002002'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004002003'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004002004'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003001'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003002'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003003'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003004'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003005'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003006'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004003007'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004004'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004004001'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004004002'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004004003'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004004004'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004004005'; +UPDATE `sys_menu` SET `sys_module_id` = '9' WHERE `id` = '3000004004006'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005001'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005001001'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005001002'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005001003'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005001004'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005001005'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005002'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005002001'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005002002'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005003'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005003001'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005003002'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005003003'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005003004'; +UPDATE `sys_menu` SET `sys_module_id` = '10' WHERE `id` = '3000005003005'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000006'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000006001'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000006002'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000006003'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000006004'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000006005'; +UPDATE `sys_menu` SET `sys_module_id` = '8' WHERE `id` = '3000006006'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000001001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000001002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000001003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000002001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000002002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000002003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000003001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000003002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000003003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000003004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000003005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000004001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000004002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000004003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000004004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000004005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000005001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000005002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000005003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000005004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000005005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000006'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000006001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000006002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000006003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000006004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000006005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000007'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000008'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000009'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000009001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000009002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000009003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000009004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000009005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000010'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000010001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000010002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000010003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000010004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000010005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000011'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000011001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000011002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000011003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000011004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000011005'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000012'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000012001'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000012002'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000012003'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000012004'; +UPDATE `sys_menu` SET `sys_module_id` = '11' WHERE `id` = '4000012005'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000001'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000002'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000003'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000004'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000005'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000006'; +UPDATE `sys_menu` SET `sys_module_id` = '12' WHERE `id` = '9000007'; +UPDATE `sys_menu` SET `sys_module_id` = '13' WHERE `id` = '9001'; +UPDATE `sys_menu` SET `sys_module_id` = '13' WHERE `id` = '9001001'; +UPDATE `sys_menu` SET `sys_module_id` = '13' WHERE `id` = '9001002'; +UPDATE `sys_menu` SET `title` = '库存数量调整' WHERE `id` = '3000005003'; +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1000011003', '1000011003', '', '授权模块', NULL, 0, '', NULL, '1000011', '1', '', 0, 2, 0, 'system:tenant:module', 0, 1, '', '系统管理员', '1', '2022-08-18 14:31:12', '系统管理员', '1', '2022-08-18 14:31:12'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1001', '1001', 'Platform', '平台管理', 'a-menu', NULL, '', NULL, '0001', '1', '/platform', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +UPDATE `sys_menu` SET `parent_id` = '1001' WHERE `id` = '1000011'; +UPDATE `sys_menu` SET `parent_id` = '1001' WHERE `id` = '1000012'; + +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000', '5000', 'Logistics', '物流管理', 'a-menu', NULL, '', NULL, '0001', '15', '/logistics', 0, 0, 0, '', 1, 1, '', '系统管理员', '1', '2021-07-04 00:22:05', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000001', '5000001', 'LogisticsSheet', '物流单管理', NULL, 0, '/sc/logistics/sheet/index', NULL, '5000', '15', '/sheet', 0, 1, 0, 'logistics:sheet:query', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000001001', '5000001001', '', '新增物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:add', 1, 1, '', '系统管理员', '1', '2021-05-12 22:50:27', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000001002', '5000001002', '', '修改物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:modify', 1, 1, '', '系统管理员', '1', '2021-05-12 23:23:33', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000001003', '5000001003', '', '删除物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:delete', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000001004', '5000001004', '', '物流单发货', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:delivery', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000001005', '5000001005', '', '导入物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:import', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('5000001006', '5000001006', '', '导出物流单', NULL, 0, '', NULL, '5000001', '15', '', 0, 2, 0, 'logistics:sheet:export', 1, 1, '', '系统管理员', '1', '2021-05-12 23:24:36', '系统管理员', '1', '2021-07-04 00:34:23'); +ALTER TABLE `tbl_sale_config` +ADD COLUMN `out_stock_require_logistics` tinyint(1) NOT NULL DEFAULT 0 COMMENT '销售出库单是否需要物流单' AFTER `sale_return_multiple_relate_out_stock`; +ALTER TABLE `tbl_retail_config` +ADD COLUMN `retail_out_sheet_require_logistics` tinyint(1) NOT NULL DEFAULT 0 COMMENT '零售出库单是否需要发货' AFTER `retail_return_require_member`; + +DROP TABLE IF EXISTS `base_data_logistics_company`; +CREATE TABLE `base_data_logistics_company` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `contact` varchar(100) DEFAULT NULL COMMENT '联系人', + `telephone` varchar(20) DEFAULT NULL COMMENT '联系电话', + `city_id` varchar(32) DEFAULT NULL COMMENT '地区ID', + `address` varchar(200) DEFAULT NULL COMMENT '地址', + `available` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='物流公司'; + +DROP TABLE IF EXISTS `tbl_logistics_sheet`; +CREATE TABLE `tbl_logistics_sheet` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `code` varchar(32) NOT NULL COMMENT '业务单据号', + `logistics_no` varchar(100) DEFAULT NULL COMMENT '物流单号', + `logistics_company_id` varchar(32) NOT NULL COMMENT '物流公司ID', + `sender_name` varchar(100) NOT NULL COMMENT '寄件人姓名', + `sender_telephone` varchar(20) NOT NULL COMMENT '寄件人联系电话', + `sender_province_id` varchar(32) NOT NULL COMMENT '寄件人省', + `sender_city_id` varchar(32) NOT NULL COMMENT '寄件人市', + `sender_district_id` varchar(32) NOT NULL COMMENT '寄件人区', + `sender_address` varchar(200) NOT NULL COMMENT '寄件人地址', + `receiver_name` varchar(100) NOT NULL COMMENT '收件人姓名', + `receiver_telephone` varchar(20) NOT NULL COMMENT '收件人联系电话', + `receiver_province_id` varchar(32) NOT NULL COMMENT '收件人省', + `receiver_city_id` varchar(32) NOT NULL COMMENT '收件人市', + `receiver_district_id` varchar(32) NOT NULL COMMENT '收件人区', + `receiver_address` varchar(200) NOT NULL COMMENT '收件人地址', + `total_weight` decimal(16,2) DEFAULT NULL COMMENT '总重量(kg)', + `total_volume` decimal(16,2) DEFAULT NULL COMMENT '总体积(cm3)', + `total_amount` decimal(16,2) DEFAULT NULL COMMENT '物流费', + `status` tinyint(3) NOT NULL COMMENT '状态', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '备注', + `delivery_by` varchar(32) DEFAULT NULL COMMENT '发货人', + `delivery_time` datetime DEFAULT NULL COMMENT '发货时间', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `logistics_no` (`logistics_no`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='物流单'; + +DROP TABLE IF EXISTS `tbl_logistics_sheet_detail`; +CREATE TABLE `tbl_logistics_sheet_detail` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `sheet_id` varchar(32) NOT NULL COMMENT '物流单ID', + `biz_id` varchar(32) NOT NULL COMMENT '业务单据ID', + `biz_type` tinyint(3) NOT NULL COMMENT '业务类型', + PRIMARY KEY (`id`), + UNIQUE KEY ```biz_id``` (`biz_id`,`biz_type`) USING BTREE, + KEY `sheet_id` (`sheet_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='物流单明细'; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.6__custom_page.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.6__custom_page.sql new file mode 100644 index 0000000..9448b79 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.6__custom_page.sql @@ -0,0 +1,34 @@ +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('9000008', '9000008', 'CustomPage', '自定义页面', NULL, 0, '/development/custom/page/index', NULL, '9000', '12', '/custom/page', 0, 1, 0, '', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `icon`, `component_type`, `component`, `request_param`, `parent_id`, `sys_module_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES ('1001001', '1001001', 'OnelineCode', '在线开发', 'a-menu', 0, '/iframes/index', NULL, '1001', '1', '/online-code?src=${magic-api.base-url}${magic-api.web}/index.html', 0, 1, 0, 'system:online-code:config', 1, 1, '', '系统管理员', '1', '2021-05-08 18:37:01', '系统管理员', '1', '2021-12-09 17:54:42'); +DROP TABLE IF EXISTS `gen_custom_page_category`; +CREATE TABLE `gen_custom_page_category` ( + `id` varchar(32) NOT NULL COMMENT 'ID', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父级ID', + `code` varchar(20) NOT NULL COMMENT '编号', + `name` varchar(20) NOT NULL COMMENT '名称', + `create_by` varchar(32) NOT NULL COMMENT '创建人', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义页面分类'; +DROP TABLE IF EXISTS `gen_custom_page`; +CREATE TABLE `gen_custom_page` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(20) NOT NULL COMMENT '名称', + `category_id` varchar(32) DEFAULT NULL COMMENT '分类ID', + `page_code` longtext NOT NULL COMMENT '页面代码', + `script_code` longtext COMMENT '脚本代码', + `description` varchar(200) DEFAULT NULL COMMENT '备注', + `create_by` varchar(32) NOT NULL COMMENT '创建人ID', + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_by` varchar(32) NOT NULL COMMENT '修改人ID', + `update_by_id` varchar(32) NOT NULL COMMENT '修改人ID', + `update_time` datetime NOT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + KEY `category_id` (`category_id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='自定义页面'; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.7__upload_to_oss.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.7__upload_to_oss.sql new file mode 100644 index 0000000..ea3b8d0 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.7__upload_to_oss.sql @@ -0,0 +1,7 @@ +ALTER TABLE `sys_parameter` +MODIFY COLUMN `pm_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '值' AFTER `pm_key`; +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (9, 'upload.type', 'LOCAL', '上传类型,分为LOCAL、OSS、COS、OBS。LOCAL:服务器本地存储。OSS:阿里云对象存储。COS:腾讯云对象存储。OBS:华为云对象存储', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 10:38:10'); +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (11, 'upload.obs.config', '{\"customUrl\":\"\",\"endpoint\":\"yourEndpoint\",\"ak\":\"yourAccessKeyId\",\"sk\":\"yourAccessKeySecret\",\"bucketName\":\"yourBucketName\"}', '华为云对象存储配置信息,upload.type=OBS时生效。customUrl为自定义域名(需带协议)为空代表不使用自定义域名,示例值:https://www.lframework.com。其他参数均在华为云控台获取。', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 10:38:10'); +DELETE FROM `sys_parameter` WHERE `id` = 7 AND `pm_key` = 'sms.ali'; +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (10, 'upload.oss.config', '{\"customUrl\":\"\",\"endpoint\":\"yourEndpoint\",\"internalEndPoint\":\"\",\"accessKeyId\":\"yourAccessKeyId\",\"accessKeySecret\":\"yourAccessKeySecret\",\"bucketName\":\"yourBucketName\"}', '阿里云对象存储配置信息,upload.type=OSS时生效,注意:当服务器与OSS同一地域时,建议填写internalEndPoint,此值表示内网endpoint,在上传时会优先使用内网endpoint。customUrl为自定义域名(需带协议)为空代表不使用自定义域名,示例值:https://www.lframework.com。其他参数均在阿里云控台获取。', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 10:38:10'); +INSERT INTO `sys_parameter` (`id`, `pm_key`, `pm_value`, `description`, `create_by`, `create_by_id`, `create_time`, `update_by`, `update_by_id`, `update_time`) VALUES (12, 'upload.cos.config', '{\"customUrl\":\"yourCustomUrl\",\"region\":\"yourRegion\",\"secretId\":\"yourSecretId\",\"secretKey\":\"yourSecretKey\",\"bucketName\":\"yourBucketName\"}', '腾讯云对象存储配置信息,upload.type=COS时生效。customUrl为下载文件时的域名,如果使用自定义域名,示例值:https://www.lframework.com,如果不使用自定义域名,那么就填写COS的访问域名。其他参数均在腾讯云控台获取。', '系统管理员', '1', '2023-06-27 10:38:05', '系统管理员', '1', '2023-06-27 14:48:02'); diff --git a/xingyun-api/src/main/resources/db/migration/tenant/V1.8__v3.sql b/xingyun-api/src/main/resources/db/migration/tenant/V1.8__v3.sql new file mode 100644 index 0000000..7f00b40 --- /dev/null +++ b/xingyun-api/src/main/resources/db/migration/tenant/V1.8__v3.sql @@ -0,0 +1,49 @@ +ALTER TABLE `sw_file_box` ADD COLUMN `content_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ContentType' AFTER `url`; +ALTER TABLE `sw_file_box` MODIFY COLUMN `url` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'Url' AFTER `name`; +ALTER TABLE `sw_file_box` ADD COLUMN `file_type` tinyint(3) NOT NULL COMMENT '文件类型' AFTER `content_type`; +ALTER TABLE `sw_file_box` ADD COLUMN `file_size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件大小' AFTER `file_type`; +ALTER TABLE `sw_file_box` ADD COLUMN `file_path` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件路径' AFTER `file_size`; +ALTER TABLE `sw_file_box` ADD COLUMN `file_suffix` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件后缀' AFTER `file_path`; +ALTER TABLE `sw_file_box` DROP COLUMN `available`; +DELETE FROM `sys_menu` WHERE `id` = '0001'; +DELETE FROM `sys_menu` WHERE `id` = '2001003'; +DELETE FROM `sys_menu` WHERE `id` = '2001003001'; +DELETE FROM `sys_menu` WHERE `id` = '2001003002'; +DELETE FROM `sys_menu` WHERE `id` = '2001003003'; +DELETE FROM `sys_menu` WHERE `id` = '2001003004'; +DELETE FROM `sys_menu` WHERE `id` = '2001003005'; +DELETE FROM `sys_menu` WHERE `id` = '2001006'; +DELETE FROM `sys_menu` WHERE `id` = '2001006001'; +DELETE FROM `sys_menu` WHERE `id` = '2001006002'; +DELETE FROM `sys_menu` WHERE `id` = '2001006003'; +DELETE FROM `sys_menu` WHERE `id` = '9000006'; +DELETE FROM `sys_menu` WHERE `id` = '9000007'; +DELETE FROM `sys_menu` WHERE `id` = '9001002'; +UPDATE `sys_menu` SET `code` = '1000', `name` = 'System', `title` = '系统管理', `icon` = 'ant-design:setting-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '2', `path` = '/system', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-04 00:22:05', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:01:09' WHERE `id` = '1000'; +UPDATE `sys_menu` SET `code` = '1000001', `name` = 'Menu', `title` = '菜单管理', `icon` = NULL, `component_type` = 0, `component` = '/system/menu/index', `request_param` = NULL, `parent_id` = '1000', `sys_module_id` = '2', `path` = '/menu', `no_cache` = 0, `display` = 1, `hidden` = 0, `permission` = 'system:menu:query', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-05-08 18:37:01', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:01:09' WHERE `id` = '1000001'; +UPDATE `sys_menu` SET `code` = '1000001001', `name` = '', `title` = '新增菜单', `icon` = NULL, `component_type` = 0, `component` = '', `request_param` = NULL, `parent_id` = '1000001', `sys_module_id` = '2', `path` = '', `no_cache` = 0, `display` = 2, `hidden` = 0, `permission` = 'system:menu:add', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-05-12 22:50:27', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:01:09' WHERE `id` = '1000001001'; +UPDATE `sys_menu` SET `code` = '1000001002', `name` = '', `title` = '修改菜单', `icon` = NULL, `component_type` = 0, `component` = '', `request_param` = NULL, `parent_id` = '1000001', `sys_module_id` = '2', `path` = '', `no_cache` = 0, `display` = 2, `hidden` = 0, `permission` = 'system:menu:modify', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-05-12 23:23:33', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:00:27' WHERE `id` = '1000001002'; +UPDATE `sys_menu` SET `code` = '1000001003', `name` = '', `title` = '删除菜单', `icon` = NULL, `component_type` = 0, `component` = '', `request_param` = NULL, `parent_id` = '1000001', `sys_module_id` = '2', `path` = '', `no_cache` = 0, `display` = 2, `hidden` = 0, `permission` = 'system:menu:delete', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-05-12 23:24:36', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:00:27' WHERE `id` = '1000001003'; +UPDATE `sys_menu` SET `code` = '1000002', `name` = 'Dept', `title` = '部门管理', `icon` = NULL, `component_type` = 0, `component` = '/system/dept/index', `request_param` = NULL, `parent_id` = '1000', `sys_module_id` = '2', `path` = '/dept', `no_cache` = 0, `display` = 1, `hidden` = 0, `permission` = 'system:dept:query', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:09:27', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:00:27' WHERE `id` = '1000002'; +UPDATE `sys_menu` SET `code` = '1000002001', `name` = '', `title` = '新增部门', `icon` = NULL, `component_type` = 0, `component` = '', `request_param` = NULL, `parent_id` = '1000002', `sys_module_id` = '2', `path` = '', `no_cache` = 0, `display` = 2, `hidden` = 0, `permission` = 'system:dept:add', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-06-27 01:33:31', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:00:27' WHERE `id` = '1000002001'; +UPDATE `sys_menu` SET `code` = '1000002002', `name` = '', `title` = '修改部门', `icon` = NULL, `component_type` = 0, `component` = '', `request_param` = NULL, `parent_id` = '1000002', `sys_module_id` = '2', `path` = '', `no_cache` = 0, `display` = 2, `hidden` = 0, `permission` = 'system:dept:modify', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-06-27 01:33:47', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:00:27' WHERE `id` = '1000002002'; +UPDATE `sys_menu` SET `code` = '1000002003', `name` = '', `title` = '部门权限', `icon` = NULL, `component_type` = 0, `component` = '', `request_param` = NULL, `parent_id` = '1000002', `sys_module_id` = '2', `path` = '', `no_cache` = 0, `display` = 2, `hidden` = 0, `permission` = 'system:dept:permission', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-06-27 01:33:47', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2023-10-27 17:00:27' WHERE `id` = '1000002003'; +UPDATE `sys_menu` SET `code` = '1000012', `name` = 'OpenDomain', `title` = '开放域', `icon` = NULL, `component_type` = 0, `component` = '/system/open-domain/index', `request_param` = NULL, `parent_id` = '1001', `sys_module_id` = '14', `path` = '/open-domain', `no_cache` = 0, `display` = 1, `hidden` = 0, `permission` = 'system:open-domain:config', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-05-08 18:37:01', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-12-09 17:54:42' WHERE `id` = '1000012'; +UPDATE `sys_menu` SET `code` = '1001', `name` = 'Platform', `title` = '平台管理', `icon` = 'ant-design:global-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '1', `path` = '/platform', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-04 00:22:05', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-04 00:34:23' WHERE `id` = '1001'; +UPDATE `sys_menu` SET `code` = '1001001', `name` = 'OnelineCode', `title` = '在线开发', `icon` = NULL, `component_type` = 0, `component` = '/iframes/index', `request_param` = NULL, `parent_id` = '1001', `sys_module_id` = '1', `path` = '/online-code?src=${magic-api.base-url}${magic-api.web}/index.html', `no_cache` = 0, `display` = 1, `hidden` = 0, `permission` = 'system:online-code:config', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-05-08 18:37:01', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-12-09 17:54:42' WHERE `id` = '1001001'; +UPDATE `sys_menu` SET `code` = '2000', `name` = 'BaseData', `title` = '基础信息管理', `icon` = 'ant-design:container-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '3', `path` = '/base-data', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '2000'; +UPDATE `sys_menu` SET `code` = '2001', `name` = 'Product', `title` = '商品中心', `icon` = 'ant-design:appstore-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '4', `path` = '/product', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '2001'; +UPDATE `sys_menu` SET `code` = '2002', `name` = 'Purchase', `title` = '采购管理', `icon` = 'ant-design:money-collect-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '5', `path` = '/purchase', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '2002'; +UPDATE `sys_menu` SET `code` = '2003', `name` = 'Sale', `title` = '销售管理', `icon` = 'ant-design:rocket-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '6', `path` = '/sale', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '2003'; +UPDATE `sys_menu` SET `code` = '2004', `name` = 'Retail', `title` = '零售管理', `icon` = 'ant-design:flag-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '7', `path` = '/retail', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '2004'; +UPDATE `sys_menu` SET `code` = '3000', `name` = 'StockManage', `title` = '库存管理', `icon` = 'ant-design:hdd-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '8', `path` = '/stock', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '3000'; +UPDATE `sys_menu` SET `code` = '3000004', `name` = 'TakeStock', `title` = '库存盘点', `icon` = 'ant-design:monitor-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '9', `path` = '/take', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '3000004'; +UPDATE `sys_menu` SET `code` = '3000005', `name` = 'StockAdjust', `title` = '库存调整', `icon` = 'ant-design:thunderbolt-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '10', `path` = '/take-adjust', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '3000005'; +UPDATE `sys_menu` SET `code` = '4000', `name` = 'SettleManage', `title` = '结算管理', `icon` = 'ant-design:credit-card-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '11', `path` = '/settle', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '4000'; +UPDATE `sys_menu` SET `code` = '4000007', `name` = 'SupplierSettleManage', `title` = '供应商结算', `icon` = NULL, `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = '4000', `sys_module_id` = '11', `path` = '/supplier', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '4000007'; +UPDATE `sys_menu` SET `code` = '4000008', `name` = 'CustomerSettleManage', `title` = '客户结算', `icon` = NULL, `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = '4000', `sys_module_id` = '11', `path` = '/customer', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-05 01:21:35', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-05 01:21:39' WHERE `id` = '4000008'; +UPDATE `sys_menu` SET `code` = '5000', `name` = 'Logistics', `title` = '物流管理', `icon` = 'ant-design:gift-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '15', `path` = '/logistics', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-04 00:22:05', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-04 00:34:23' WHERE `id` = '5000'; +UPDATE `sys_menu` SET `code` = '9000', `name` = 'Development', `title` = '开发管理', `icon` = 'ant-design:tool-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '12', `path` = '/development', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-04 00:22:05', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-04 00:34:23' WHERE `id` = '9000'; +UPDATE `sys_menu` SET `code` = '9001', `name` = 'SmartWork', `title` = '便捷办公', `icon` = 'ant-design:read-outlined', `component_type` = NULL, `component` = '', `request_param` = NULL, `parent_id` = NULL, `sys_module_id` = '13', `path` = '/smart-work', `no_cache` = 0, `display` = 0, `hidden` = 0, `permission` = '', `is_special` = 1, `available` = 1, `description` = '', `create_by` = '系统管理员', `create_by_id` = '1', `create_time` = '2021-07-04 00:22:05', `update_by` = '系统管理员', `update_by_id` = '1', `update_time` = '2021-07-04 00:34:23' WHERE `id` = '9001'; +ALTER TABLE `op_logs` + MODIFY COLUMN `log_type` int(11) NOT NULL COMMENT '类别' AFTER `name`; \ No newline at end of file diff --git a/xingyun-api/src/main/resources/magic-editor-config.js b/xingyun-api/src/main/resources/magic-editor-config.js new file mode 100644 index 0000000..f582920 --- /dev/null +++ b/xingyun-api/src/main/resources/magic-editor-config.js @@ -0,0 +1,21 @@ +var MAGIC_EDITOR_CONFIG = { + title: '在线开发平台', + header: { + skin: false, // 屏蔽皮肤按钮 + document: false, // 屏蔽文档按钮 + repo: false, // 屏蔽gitee和github + qqGroup: false // 屏蔽加入QQ群 + }, + getMagicTokenValue: function(){ + return this.getCookie('X-Auth-Token'); + }, + getCookie: function(name) { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = cookies[i].trim().split('='); + if (cookie[0] === name) { + return decodeURIComponent(cookie[1]); + } + } + } +} \ No newline at end of file diff --git a/xingyun-api/src/main/resources/scripts/start.sh b/xingyun-api/src/main/resources/scripts/start.sh new file mode 100644 index 0000000..b38807f --- /dev/null +++ b/xingyun-api/src/main/resources/scripts/start.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +export BUILD_ID=dontkillme +if [ -z $JAVA_HOME ] ; +then +echo "JAVA_HOME is not exist, please check" +exit 1 +fi +export APP_HOME_BIN_PATH=$(cd `dirname $0`; pwd) +export APP_HOME=${APP_HOME_BIN_PATH%/bin} + +$JAVA_HOME/bin/java -jar -server -Xmx256m -XX:MaxPermSize=32m -XX:MaxNewSize=32m $APP_HOME/@build.finalName@.jar >/dev/null 2>&1 & \ No newline at end of file diff --git a/xingyun-api/src/main/resources/scripts/stop.sh b/xingyun-api/src/main/resources/scripts/stop.sh new file mode 100644 index 0000000..260e4e2 --- /dev/null +++ b/xingyun-api/src/main/resources/scripts/stop.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +export APP_HOME_BIN_PATH=$(cd `dirname $0`; pwd) +export APP_HOME=${APP_HOME_BIN_PATH%/bin} + +export C_PID=`ps -ef | grep java | grep $APP_HOME | grep -v grep | awk '{print $2}'` + +if [ ! -z "$C_PID" ]; then + kill -15 $C_PID; +fi \ No newline at end of file diff --git a/xingyun-basedata/pom.xml b/xingyun-basedata/pom.xml new file mode 100644 index 0000000..25fbfc1 --- /dev/null +++ b/xingyun-basedata/pom.xml @@ -0,0 +1,21 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-basedata + 【${project.artifactId}】基础数据服务层 + + + + com.lframework + xingyun-core + + + diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/AddressSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/AddressSelectorBo.java new file mode 100644 index 0000000..d96ad74 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/AddressSelectorBo.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.basedata.bo.address; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AddressSelectorBo extends BaseBo
{ + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 地址类型 + */ + @ApiModelProperty("地址类型") + @EnumConvert + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String telephone; + + /** + * 省ID + */ + @ApiModelProperty("省ID") + private String provinceId; + + /** + * 省名称 + */ + @ApiModelProperty("省名称") + private String provinceName; + + /** + * 市ID + */ + @ApiModelProperty("市ID") + private String cityId; + + /** + * 市名称 + */ + @ApiModelProperty("市名称") + private String cityName; + + /** + * 区ID + */ + @ApiModelProperty("区ID") + private String districtId; + + /** + * 区名称 + */ + @ApiModelProperty("区名称") + private String districtName; + + /** + * 地区全称 + */ + @ApiModelProperty("地区全称") + private String areaFullName; + + /** + * 详细地址 + */ + @ApiModelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ApiModelProperty("是否默认地址") + private Boolean isDefault; + + public AddressSelectorBo() { + + } + + public AddressSelectorBo(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + this.areaFullName = + this.provinceName + StringPool.CITY_SPLIT + this.cityName + StringPool.CITY_SPLIT + + this.districtName; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/GetAddressBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/GetAddressBo.java new file mode 100644 index 0000000..e9fcbba --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/GetAddressBo.java @@ -0,0 +1,161 @@ +package com.lframework.xingyun.basedata.bo.address; + +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetAddressBo extends BaseBo
{ + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 实体ID + */ + @ApiModelProperty("实体ID") + private String entityId; + + /** + * 实体名称 + */ + @ApiModelProperty("实体名称") + private String entityName; + + /** + * 实体类型 + */ + @ApiModelProperty("实体类型") + @EnumConvert + private Integer entityType; + + /** + * 地址类型 + */ + @ApiModelProperty("地址类型") + @EnumConvert + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String telephone; + + /** + * 省ID + */ + @ApiModelProperty("省ID") + private String provinceId; + + /** + * 省名称 + */ + @ApiModelProperty("省名称") + private String provinceName; + + /** + * 市ID + */ + @ApiModelProperty("市ID") + private String cityId; + + /** + * 市名称 + */ + @ApiModelProperty("市名称") + private String cityName; + + /** + * 区ID + */ + @ApiModelProperty("区ID") + private String districtId; + + /** + * 区名称 + */ + @ApiModelProperty("区名称") + private String districtName; + + /** + * 详细地址 + */ + @ApiModelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ApiModelProperty("是否默认地址") + private Boolean isDefault; + + public GetAddressBo() { + + } + + public GetAddressBo(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + if (dto.getEntityType() == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getEntityId()); + this.entityName = sc.getName(); + } else if (dto.getEntityType() == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getEntityId()); + this.entityName = customer.getName(); + } else if (dto.getEntityType() == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getEntityId()); + this.entityName = supplier.getName(); + } else if (dto.getEntityType() == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getEntityId()); + this.entityName = member.getName(); + } else if (dto.getEntityType() == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getEntityId()); + this.entityName = shop.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/QueryAddressBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/QueryAddressBo.java new file mode 100644 index 0000000..a4e0188 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/address/QueryAddressBo.java @@ -0,0 +1,174 @@ +package com.lframework.xingyun.basedata.bo.address; + +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryAddressBo extends BaseBo
{ + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 实体ID + */ + @ApiModelProperty("实体ID") + private String entityId; + + /** + * 实体名称 + */ + @ApiModelProperty("实体名称") + private String entityName; + + /** + * 实体类型 + */ + @ApiModelProperty("实体类型") + @EnumConvert + private Integer entityType; + + /** + * 地址类型 + */ + @ApiModelProperty("地址类型") + @EnumConvert + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String telephone; + + /** + * 省ID + */ + @ApiModelProperty("省ID") + private String provinceId; + + /** + * 省名称 + */ + @ApiModelProperty("省名称") + private String provinceName; + + /** + * 市ID + */ + @ApiModelProperty("市ID") + private String cityId; + + /** + * 市名称 + */ + @ApiModelProperty("市名称") + private String cityName; + + /** + * 区ID + */ + @ApiModelProperty("区ID") + private String districtId; + + /** + * 区名称 + */ + @ApiModelProperty("区名称") + private String districtName; + + /** + * 详细地址 + */ + @ApiModelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ApiModelProperty("是否默认地址") + private Boolean isDefault; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + public QueryAddressBo() { + + } + + public QueryAddressBo(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + if (dto.getEntityType() == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getEntityId()); + this.entityName = sc.getName(); + } else if (dto.getEntityType() == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getEntityId()); + this.entityName = customer.getName(); + } else if (dto.getEntityType() == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getEntityId()); + this.entityName = supplier.getName(); + } else if (dto.getEntityType() == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getEntityId()); + this.entityName = member.getName(); + } else if (dto.getEntityType() == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getEntityId()); + this.entityName = shop.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/CustomerSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/CustomerSelectorBo.java new file mode 100644 index 0000000..1453d3c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/CustomerSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.customer; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Customer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CustomerSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public CustomerSelectorBo() { + + } + + public CustomerSelectorBo(Customer dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/GetCustomerBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/GetCustomerBo.java new file mode 100644 index 0000000..cd6d2c8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/GetCustomerBo.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.basedata.bo.customer; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetCustomerBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 助记码 + */ + @ApiModelProperty("助记码") + private String mnemonicCode; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + private String email; + + /** + * 邮编 + */ + @ApiModelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ApiModelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private List city; + + /** + * 地区名称 + */ + @ApiModelProperty("地区名称") + private String cityName; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 结账方式 + */ + @ApiModelProperty("结账方式") + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ApiModelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ApiModelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ApiModelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ApiModelProperty("银行账号") + private String accountNo; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetCustomerBo() { + + } + + public GetCustomerBo(Customer dto) { + + super(dto); + } + + @Override + public BaseBo convert(Customer dto) { + + return super.convert(dto, GetCustomerBo::getSettleType); + } + + @Override + protected void afterInit(Customer dto) { + + if (dto.getSettleType() != null) { + this.settleType = dto.getSettleType().getCode(); + } + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/QueryCustomerBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/QueryCustomerBo.java new file mode 100644 index 0000000..365fbd4 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/customer/QueryCustomerBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.basedata.bo.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Customer; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryCustomerBo() { + + } + + public QueryCustomerBo(Customer dto) { + + super(dto); + } + + @Override + protected void afterInit(Customer dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/GetLogisticsCompanyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/GetLogisticsCompanyBo.java new file mode 100644 index 0000000..bdb896f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/GetLogisticsCompanyBo.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.basedata.bo.logistics.company; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetLogisticsCompanyBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private List city; + + /** + * 地区名称 + */ + @ApiModelProperty("地区名称") + private String cityName; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetLogisticsCompanyBo() { + + } + + public GetLogisticsCompanyBo(LogisticsCompany dto) { + + super(dto); + } + + @Override + protected void afterInit(LogisticsCompany dto) { + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/LogisticsCompanySelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/LogisticsCompanySelectorBo.java new file mode 100644 index 0000000..714fcb9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/LogisticsCompanySelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.logistics.company; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class LogisticsCompanySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public LogisticsCompanySelectorBo() { + + } + + public LogisticsCompanySelectorBo(LogisticsCompany dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/QueryLogisticsCompanyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/QueryLogisticsCompanyBo.java new file mode 100644 index 0000000..cb76019 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/logistics/company/QueryLogisticsCompanyBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.basedata.bo.logistics.company; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryLogisticsCompanyBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryLogisticsCompanyBo() { + + } + + public QueryLogisticsCompanyBo(LogisticsCompany dto) { + + super(dto); + } + + @Override + protected void afterInit(LogisticsCompany dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/GetMemberBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/GetMemberBo.java new file mode 100644 index 0000000..890397a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/GetMemberBo.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.basedata.bo.member; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDate; +import lombok.Data; + +@Data +public class GetMemberBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 性别 + */ + @ApiModelProperty("性别") + private Integer gender; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + private String email; + + /** + * 出生日期 + */ + @ApiModelProperty("出生日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate birthday; + + /** + * 入会日期 + */ + @ApiModelProperty("入会日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate joinDay; + + /** + * 所属门店ID + */ + @ApiModelProperty("所属门店ID") + private String shopId; + + /** + * 所属门店名称 + */ + @ApiModelProperty("所属门店名称") + private String shopName; + + /** + * 所属导购ID + */ + @ApiModelProperty("所属导购ID") + private String guiderId; + + /** + * 所属导购名称 + */ + @ApiModelProperty("所属导购名称") + private String guiderName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetMemberBo() { + + } + + public GetMemberBo(Member dto) { + + super(dto); + } + + @Override + public BaseBo convert(Member dto) { + + return super.convert(dto, GetMemberBo::getGender); + } + + @Override + protected void afterInit(Member dto) { + + this.gender = dto.getGender().getCode(); + + if (!StringUtil.isBlank(dto.getShopId())) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getShopId()); + this.shopName = shop.getName(); + } + + if (!StringUtil.isBlank(dto.getGuiderId())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto guider = userService.findById(dto.getGuiderId()); + this.guiderName = guider.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/MemberSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/MemberSelectorBo.java new file mode 100644 index 0000000..734bf7f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/MemberSelectorBo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.basedata.bo.member; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Member; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class MemberSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public MemberSelectorBo(Member dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/QueryMemberBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/QueryMemberBo.java new file mode 100644 index 0000000..9a4f387 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/member/QueryMemberBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.basedata.bo.member; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Member; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryMemberBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryMemberBo() { + + } + + public QueryMemberBo(Member dto) { + + super(dto); + } + + @Override + protected void afterInit(Member dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/GetPayTypeBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/GetPayTypeBo.java new file mode 100644 index 0000000..03efdf9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/GetPayTypeBo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.basedata.bo.paytype; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PayType; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetPayTypeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 是否记录内容 + */ + @ApiModelProperty("是否记录内容") + private Boolean recText; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetPayTypeBo() { + + } + + public GetPayTypeBo(PayType dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/PayTypeSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/PayTypeSelectorBo.java new file mode 100644 index 0000000..215e7b6 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/PayTypeSelectorBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.bo.paytype; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PayType; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PayTypeSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 是否记录内容 + */ + @ApiModelProperty("是否记录内容") + private Boolean recText; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public PayTypeSelectorBo() { + + } + + public PayTypeSelectorBo(PayType dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/QueryPayTypeBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/QueryPayTypeBo.java new file mode 100644 index 0000000..f869efa --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/paytype/QueryPayTypeBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.basedata.bo.paytype; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.PayType; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPayTypeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryPayTypeBo() { + + } + + public QueryPayTypeBo(PayType dto) { + + super(dto); + } + + @Override + protected void afterInit(PayType dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/GetProductBrandBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/GetProductBrandBo.java new file mode 100644 index 0000000..1cf8f35 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/GetProductBrandBo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetProductBrandBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 简称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * logo + */ + @ApiModelProperty("logo") + private String logo; + + /** + * 简介 + */ + @ApiModelProperty("简介") + private String introduction; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetProductBrandBo() { + + } + + public GetProductBrandBo(ProductBrand dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductBrandSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductBrandSelectorBo.java new file mode 100644 index 0000000..f41c329 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductBrandSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ProductBrandSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public ProductBrandSelectorBo() { + + } + + public ProductBrandSelectorBo(ProductBrand dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductCategorySelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductCategorySelectorBo.java new file mode 100644 index 0000000..a540cc0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/ProductCategorySelectorBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ProductCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public ProductCategorySelectorBo() { + + } + + public ProductCategorySelectorBo(ProductCategory dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/QueryProductBrandBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/QueryProductBrandBo.java new file mode 100644 index 0000000..aed56bc --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/brand/QueryProductBrandBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.bo.product.brand; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryProductBrandBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public QueryProductBrandBo() { + + } + + public QueryProductBrandBo(ProductBrand dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/GetProductCategoryBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/GetProductCategoryBo.java new file mode 100644 index 0000000..5674873 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/GetProductCategoryBo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.basedata.bo.product.category; + +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetProductCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 父级名称 + */ + @ApiModelProperty("父级名称") + private String parentName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetProductCategoryBo() { + + } + + public GetProductCategoryBo(ProductCategory dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductCategory dto) { + + if (!StringUtil.isBlank(this.getParentId())) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory parentCategory = productCategoryService.findById(this.getParentId()); + if (!ObjectUtil.isNull(parentCategory)) { + this.setParentName(parentCategory.getName()); + } + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/ProductCategoryTreeBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/ProductCategoryTreeBo.java new file mode 100644 index 0000000..eeef7e7 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/category/ProductCategoryTreeBo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.basedata.bo.product.category; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ProductCategoryTreeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public ProductCategoryTreeBo() { + + } + + public ProductCategoryTreeBo(ProductCategory dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java new file mode 100644 index 0000000..0fd52d2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/GetProductBo.java @@ -0,0 +1,306 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.entity.ProductRetail; +import com.lframework.xingyun.basedata.entity.ProductSale; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductRetailService; +import com.lframework.xingyun.basedata.service.product.ProductSaleService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 简称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 重量(kg) + */ + @ApiModelProperty("重量(kg)") + private BigDecimal weight; + + /** + * 体积(cm3) + */ + @ApiModelProperty("体积(cm3)") + private BigDecimal volume; + + /** + * 进项税率(%) + */ + @ApiModelProperty("进项税率(%)") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @ApiModelProperty("销项税率(%)") + private BigDecimal saleTaxRate; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 商品类型 + */ + @ApiModelProperty("商品类型") + @EnumConvert + private Integer productType; + + /** + * 单品 + */ + @ApiModelProperty("单品") + private List productBundles; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @ApiModelProperty("销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @ApiModelProperty("零售价") + private BigDecimal retailPrice; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 属性 + */ + @ApiModelProperty("属性") + private List properties; + + public GetProductBo() { + + } + + public GetProductBo(Product dto) { + + super(dto); + } + + @Override + public BaseBo convert(Product dto) { + + return super.convert(dto, GetProductBo::getProperties); + } + + @Override + protected void afterInit(Product dto) { + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(dto.getCategoryId()); + this.categoryName = productCategory.getName(); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(dto.getBrandId()); + this.brandName = productBrand.getName(); + + if (dto.getProductType() == ProductType.BUNDLE) { + ProductBundleService productBundleService = ApplicationUtil.getBean( + ProductBundleService.class); + List bundles = productBundleService.getByMainProductId(dto.getId()); + this.productBundles = bundles.stream().map(ProductBundleBo::new).collect(Collectors.toList()); + } + + ProductPurchaseService productPurchaseService = ApplicationUtil.getBean( + ProductPurchaseService.class); + ProductPurchase productPurchase = productPurchaseService.getById(dto.getId()); + this.purchasePrice = productPurchase.getPrice(); + + ProductSaleService productSaleService = ApplicationUtil.getBean(ProductSaleService.class); + ProductSale productSale = productSaleService.getById(dto.getId()); + this.salePrice = productSale.getPrice(); + + ProductRetailService productRetailService = ApplicationUtil.getBean( + ProductRetailService.class); + ProductRetail productRetail = productRetailService.getById(dto.getId()); + this.retailPrice = productRetail.getPrice(); + + ProductPropertyRelationService productPropertyRelationService = ApplicationUtil.getBean( + ProductPropertyRelationService.class); + List propertyRelationDtos = productPropertyRelationService.getByProductId( + dto.getId()); + if (!CollectionUtil.isEmpty(propertyRelationDtos)) { + this.properties = new ArrayList<>(); + for (ProductPropertyRelationDto property : propertyRelationDtos) { + if (property.getPropertyColumnType() == ColumnType.MULTIPLE) { + PropertyBo propertyBo = this.properties.stream() + .filter(t -> t.getId().equals(property.getPropertyId())).findFirst().orElse(null); + if (propertyBo == null) { + this.properties.add(new PropertyBo(property)); + } else { + propertyBo.setText(propertyBo.getText().concat(StringPool.STR_SPLIT) + .concat(property.getPropertyItemId())); + propertyBo.setTextStr(propertyBo.getTextStr().concat(StringPool.STR_SPLIT_CN) + .concat(property.getPropertyText())); + } + } else { + this.properties.add(new PropertyBo(property)); + } + } + } + } + + @Data + public static class PropertyBo extends BaseBo { + + /** + * 属性ID + */ + @ApiModelProperty("属性ID") + private String id; + + /** + * 属性名 + */ + @ApiModelProperty("属性名") + private String name; + + /** + * 字段类型 + */ + @ApiModelProperty("字段类型") + private Integer columnType; + + /** + * 属性值 + */ + @ApiModelProperty("属性值") + private String text; + + /** + * 属性文本 + */ + @ApiModelProperty("属性文本") + private String textStr; + + public PropertyBo() { + + } + + public PropertyBo(ProductPropertyRelationDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductPropertyRelationDto dto) { + + return super.convert(dto, PropertyBo::getColumnType); + } + + @Override + protected void afterInit(ProductPropertyRelationDto dto) { + + this.id = dto.getPropertyId(); + this.name = dto.getPropertyName(); + this.text = dto.getPropertyColumnType() == ColumnType.CUSTOM ? dto.getPropertyText() + : dto.getPropertyItemId(); + this.textStr = dto.getPropertyText(); + this.columnType = dto.getPropertyColumnType().getCode(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductBundleBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductBundleBo.java new file mode 100644 index 0000000..f033441 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductBundleBo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class ProductBundleBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单品ID + */ + @ApiModelProperty("单品ID") + private String productId; + + /** + * 包含数量 + */ + @ApiModelProperty("包含数量") + private Integer bundleNum; + + /** + * 销售价 + */ + @ApiModelProperty("销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @ApiModelProperty("零售价") + private BigDecimal retailPrice; + + public ProductBundleBo() { + } + + public ProductBundleBo(ProductBundle dto) { + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductSelectorBo.java new file mode 100644 index 0000000..2ad4c61 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/ProductSelectorBo.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ProductSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 商品类型 + */ + @ApiModelProperty("商品类型") + @EnumConvert + private Integer productType; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public ProductSelectorBo() { + + } + + public ProductSelectorBo(Product dto) { + + super(dto); + } + + @Override + protected void afterInit(Product dto) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(dto.getCategoryId()); + this.categoryName = productCategory.getName(); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand brand = productBrandService.findById(dto.getBrandId()); + this.brandName = brand.getName(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java new file mode 100644 index 0000000..c755cfe --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/info/QueryProductBo.java @@ -0,0 +1,109 @@ +package com.lframework.xingyun.basedata.bo.product.info; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 名称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 商品类型 + */ + @ApiModelProperty("商品类型") + @EnumConvert + private Integer productType; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryProductBo() { + + } + + public QueryProductBo(Product dto) { + + super(dto); + } + + @Override + protected void afterInit(Product dto) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(dto.getCategoryId()); + this.categoryName = productCategory.getName(); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand brand = productBrandService.findById(dto.getBrandId()); + this.brandName = brand.getName(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/GetProductPropertyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/GetProductPropertyBo.java new file mode 100644 index 0000000..24e213b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/GetProductPropertyBo.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.basedata.bo.product.property; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.enums.PropertyType; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetProductPropertyBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 是否必填 + */ + @ApiModelProperty("是否必填") + private Boolean isRequired; + + /** + * 录入类型 + */ + @ApiModelProperty("录入类型") + private Integer columnType; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + private Integer columnDataType; + + /** + * 属性类别 + */ + @ApiModelProperty("属性类别") + private Integer propertyType; + + /** + * 类目 + */ + @ApiModelProperty("类目") + private List categories; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetProductPropertyBo() { + + } + + public GetProductPropertyBo(ProductProperty dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductProperty dto) { + + this.columnType = dto.getColumnType().getCode(); + this.propertyType = dto.getPropertyType().getCode(); + if (dto.getColumnDataType() != null) { + this.columnDataType = dto.getColumnDataType().getCode(); + } + + if (dto.getPropertyType() == PropertyType.APPOINT) { + ProductCategoryPropertyService productCategoryPropertyService = ApplicationUtil.getBean( + ProductCategoryPropertyService.class); + List categoryPropertyList = productCategoryPropertyService.getByPropertyId( + dto.getId()); + + this.categories = categoryPropertyList.stream().map(ProductCategoryProperty::getCategoryId) + .collect(Collectors.toList()); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/ProductPropertyModelorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/ProductPropertyModelorBo.java new file mode 100644 index 0000000..6ee6551 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/ProductPropertyModelorBo.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.basedata.bo.product.property; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class ProductPropertyModelorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 是否必填 + */ + @ApiModelProperty("是否必填") + private Boolean isRequired; + + /** + * 可选项,当columnType != CUSTOM时 不为空 + */ + @ApiModelProperty("可选项,当columnType != CUSTOM时 不为空") + private List items; + + /** + * 显示值 当columnType != CUSTOM时,此值为items项ID 当columnType == CUSTOM时,此值为录入值 + */ + @ApiModelProperty("显示值 当columnType != CUSTOM时,此值为items项ID 当columnType == CUSTOM时,此值为录入值") + private String text; + + /** + * 录入类型 + */ + @ApiModelProperty("录入类型") + private Integer columnType; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + private Integer columnDataType; + + /** + * 属性类别 + */ + @ApiModelProperty("属性类别") + private Integer propertyType; + + public ProductPropertyModelorBo() { + + } + + public ProductPropertyModelorBo(ProductPropertyModelorDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductPropertyModelorDto dto) { + + return super.convert(dto, ProductPropertyModelorBo::getItems, ProductPropertyModelorBo::getColumnType, + ProductPropertyModelorBo::getColumnDataType, ProductPropertyModelorBo::getPropertyType); + } + + @Override + protected void afterInit(ProductPropertyModelorDto dto) { + + if (!CollectionUtil.isEmpty(dto.getItems())) { + this.items = dto.getItems().stream().map(ProductPropertyItemModelorBo::new).collect(Collectors.toList()); + } + + this.columnType = dto.getColumnType().getCode(); + if (dto.getColumnDataType() != null) { + this.columnDataType = dto.getColumnDataType().getCode(); + } + + this.propertyType = dto.getPropertyType().getCode(); + } + + @Data + public static class ProductPropertyItemModelorBo + extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public ProductPropertyItemModelorBo() { + + } + + public ProductPropertyItemModelorBo(ProductPropertyModelorDto.ProductPropertyItemModelorDto dto) { + + super(dto); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/QueryProductPropertyBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/QueryProductPropertyBo.java new file mode 100644 index 0000000..f29d752 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/QueryProductPropertyBo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.basedata.bo.product.property; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryProductPropertyBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 是否必填 + */ + @ApiModelProperty("是否必填") + private Boolean isRequired; + + /** + * 录入类型 + */ + @ApiModelProperty("录入类型") + private Integer columnType; + + /** + * 属性类别 + */ + @ApiModelProperty("属性类别") + private Integer propertyType; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public QueryProductPropertyBo() { + + } + + public QueryProductPropertyBo(ProductProperty dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductProperty dto) { + + this.columnType = dto.getColumnType().getCode(); + this.propertyType = dto.getPropertyType().getCode(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/GetProductPropertyItemBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/GetProductPropertyItemBo.java new file mode 100644 index 0000000..c68676f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/GetProductPropertyItemBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.bo.product.property.item; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetProductPropertyItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetProductPropertyItemBo() { + + } + + public GetProductPropertyItemBo(ProductPropertyItem dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/QueryProductPropertyItemBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/QueryProductPropertyItemBo.java new file mode 100644 index 0000000..1326480 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/product/property/item/QueryProductPropertyItemBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.bo.product.property.item; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryProductPropertyItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public QueryProductPropertyItemBo() { + + } + + public QueryProductPropertyItemBo(ProductPropertyItem dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/GetShopBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/GetShopBo.java new file mode 100644 index 0000000..256466b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/GetShopBo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.basedata.bo.shop; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.template.core.dto.DeptDto; +import com.lframework.xingyun.template.core.service.DeptService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * 门店 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetShopBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 所属部门ID + */ + @ApiModelProperty("所属部门ID") + private String deptId; + + /** + * 所属部门名称 + */ + @ApiModelProperty("所属部门名称") + private String deptName; + + /** + * 经度 + */ + @ApiModelProperty("经度") + private BigDecimal lng; + + /** + * 纬度 + */ + @ApiModelProperty("纬度") + private BigDecimal lat; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetShopBo() { + + } + + public GetShopBo(Shop dto) { + + super(dto); + } + + @Override + protected void afterInit(Shop dto) { + if (!StringUtil.isBlank(dto.getDeptId())) { + DeptService deptService = ApplicationUtil.getBean(DeptService.class); + + DeptDto dept = deptService.findById(dto.getDeptId()); + + this.deptName = dept.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/QueryShopBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/QueryShopBo.java new file mode 100644 index 0000000..a10f8dc --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/QueryShopBo.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.basedata.bo.shop; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.template.core.dto.DeptDto; +import com.lframework.xingyun.template.core.service.DeptService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 门店 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryShopBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 所属部门名称 + */ + @ApiModelProperty("所属部门名称") + private String deptName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryShopBo() { + + } + + public QueryShopBo(Shop dto) { + + super(dto); + } + + @Override + protected void afterInit(Shop dto) { + if (!StringUtil.isBlank(dto.getDeptId())) { + DeptService deptService = ApplicationUtil.getBean(DeptService.class); + + DeptDto dept = deptService.findById(dto.getDeptId()); + + this.deptName = dept.getName(); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/ShopSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/ShopSelectorBo.java new file mode 100644 index 0000000..322e70e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/shop/ShopSelectorBo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.bo.shop; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Shop; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 门店选择器 Bo + *

+ * + * @author zmj + */ +@Data +public class ShopSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public ShopSelectorBo() { + + } + + public ShopSelectorBo(Shop dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/GetStoreCenterBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/GetStoreCenterBo.java new file mode 100644 index 0000000..8755762 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/GetStoreCenterBo.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.basedata.bo.storecenter; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetStoreCenterBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @ApiModelProperty("联系人手机号码") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private List city; + + /** + * 地区名称 + */ + @ApiModelProperty("地区名称") + private String cityName; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 仓库人数 + */ + @ApiModelProperty("仓库人数") + private Integer peopleNum; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetStoreCenterBo() { + + } + + public GetStoreCenterBo(StoreCenter dto) { + + super(dto); + } + + @Override + protected void afterInit(StoreCenter dto) { + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/QueryStoreCenterBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/QueryStoreCenterBo.java new file mode 100644 index 0000000..972ee16 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/QueryStoreCenterBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.basedata.bo.storecenter; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryStoreCenterBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryStoreCenterBo() { + + } + + public QueryStoreCenterBo(StoreCenter dto) { + + super(dto); + } + + @Override + protected void afterInit(StoreCenter dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/StoreCenterSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/StoreCenterSelectorBo.java new file mode 100644 index 0000000..362e3e1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/storecenter/StoreCenterSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.storecenter; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class StoreCenterSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public StoreCenterSelectorBo() { + + } + + public StoreCenterSelectorBo(StoreCenter dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/GetSupplierBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/GetSupplierBo.java new file mode 100644 index 0000000..c6b5616 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/GetSupplierBo.java @@ -0,0 +1,185 @@ +package com.lframework.xingyun.basedata.bo.supplier; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSupplierBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 助记码 + */ + @ApiModelProperty("助记码") + private String mnemonicCode; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + private String email; + + /** + * 邮编 + */ + @ApiModelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ApiModelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private List city; + + /** + * 地区名称 + */ + @ApiModelProperty("地区名称") + private String cityName; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 送货周期(天) + */ + @ApiModelProperty("送货周期(天)") + private Integer deliveryCycle; + + /** + * 经营方式 + */ + @ApiModelProperty("经营方式") + private Integer manageType; + + /** + * 结账方式 + */ + @ApiModelProperty("结账方式") + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ApiModelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ApiModelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ApiModelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ApiModelProperty("银行账号") + private String accountNo; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSupplierBo() { + + } + + public GetSupplierBo(Supplier dto) { + + super(dto); + } + + @Override + public BaseBo convert(Supplier dto) { + + return super.convert(dto, GetSupplierBo::getSettleType, GetSupplierBo::getManageType); + } + + @Override + protected void afterInit(Supplier dto) { + + if (dto.getManageType() != null) { + this.manageType = dto.getManageType().getCode(); + } + + if (dto.getSettleType() != null) { + this.settleType = dto.getSettleType().getCode(); + } + + if (!StringUtil.isBlank(dto.getCityId())) { + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List cityList = dicCityService.getChainById(dto.getCityId()); + this.city = cityList.stream().map(DicCityDto::getId).collect(Collectors.toList()); + + this.cityName = cityList.stream().map(DicCityDto::getName) + .collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/QuerySupplierBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/QuerySupplierBo.java new file mode 100644 index 0000000..c88dbdf --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/QuerySupplierBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.basedata.bo.supplier; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Supplier; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySupplierBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySupplierBo() { + + } + + public QuerySupplierBo(Supplier dto) { + + super(dto); + } + + @Override + protected void afterInit(Supplier dto) { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/SupplierSelectorBo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/SupplierSelectorBo.java new file mode 100644 index 0000000..745e218 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/supplier/SupplierSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.bo.supplier; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.basedata.entity.Supplier; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SupplierSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SupplierSelectorBo() { + + } + + public SupplierSelectorBo(Supplier dto) { + + super(dto); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AddressController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AddressController.java new file mode 100644 index 0000000..edf63b6 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AddressController.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.address.GetAddressBo; +import com.lframework.xingyun.basedata.bo.address.QueryAddressBo; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.excel.address.AddressExportModel; +import com.lframework.xingyun.basedata.excel.address.AddressImportListener; +import com.lframework.xingyun.basedata.excel.address.AddressImportModel; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import com.lframework.xingyun.basedata.vo.address.UpdateAddressVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 地址库 + * + * @author zmj + */ +@Api(tags = "地址库") +@Validated +@RestController +@RequestMapping("/basedata/address") +public class AddressController extends DefaultBaseController { + + @Autowired + private AddressService addressService; + + /** + * 地址列表 + */ + @ApiOperation("地址列表") + @HasPermission({"base-data:address:query", "base-data:address:add", "base-data:address:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryAddressVo vo) { + + PageResult
pageResult = addressService.query(getPageIndex(vo), getPageSize(vo), vo); + + List
datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryAddressBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询地址 + */ + @ApiOperation("查询地址") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:address:query", "base-data:address:add", "base-data:address:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Address data = addressService.findById(id); + if (data == null) { + throw new DefaultClientException("地址不存在!"); + } + + GetAddressBo result = new GetAddressBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增地址 + */ + @ApiOperation("新增地址") + @HasPermission({"base-data:address:add"}) + @PostMapping + public InvokeResult create(@Valid CreateAddressVo vo) { + + addressService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改地址 + */ + @ApiOperation("修改地址") + @HasPermission({"base-data:address:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateAddressVo vo) { + + addressService.update(vo); + + addressService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"base-data:address:export"}) + @PostMapping("/export") + public void export(@Valid QueryAddressVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("地址信息", + AddressExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult
pageResult = addressService.query(pageIndex, getExportSize(), vo); + List
datas = pageResult.getDatas(); + List models = datas.stream().map(AddressExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:address:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("地址导入模板", AddressImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:address:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + AddressImportListener listener = new AddressImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, AddressImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/BaseDataSelectorController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/BaseDataSelectorController.java new file mode 100644 index 0000000..b68b3c0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/BaseDataSelectorController.java @@ -0,0 +1,594 @@ +package com.lframework.xingyun.basedata.controller; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.basedata.bo.address.AddressSelectorBo; +import com.lframework.xingyun.basedata.bo.customer.CustomerSelectorBo; +import com.lframework.xingyun.basedata.bo.logistics.company.LogisticsCompanySelectorBo; +import com.lframework.xingyun.basedata.bo.member.MemberSelectorBo; +import com.lframework.xingyun.basedata.bo.paytype.PayTypeSelectorBo; +import com.lframework.xingyun.basedata.bo.product.brand.ProductBrandSelectorBo; +import com.lframework.xingyun.basedata.bo.product.brand.ProductCategorySelectorBo; +import com.lframework.xingyun.basedata.bo.product.info.ProductSelectorBo; +import com.lframework.xingyun.basedata.bo.shop.ShopSelectorBo; +import com.lframework.xingyun.basedata.bo.storecenter.StoreCenterSelectorBo; +import com.lframework.xingyun.basedata.bo.supplier.SupplierSelectorBo; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; +import com.lframework.xingyun.basedata.vo.shop.ShopSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 基础数据数据选择器 + * + * @author zmj + */ +@Api(tags = "基础数据数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class BaseDataSelectorController extends DefaultBaseController { + + @Autowired + private ProductBrandService productBrandService; + + @Autowired + private ProductCategoryService productCategoryService; + + @Autowired + private MemberService memberService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private CustomerService customerService; + + @Autowired + private ShopService shopService; + + @Autowired + private AddressService addressService; + + @Autowired + private PayTypeService payTypeService; + + @Autowired + private ProductService productService; + + @Autowired + private LogisticsCompanyService logisticsCompanyService; + + /** + * 商品 + */ + @ApiOperation("商品") + @GetMapping("/product") + public InvokeResult> product( + @Valid QueryProductSelectorVo vo) { + + PageResult pageResult = productService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载商品 + */ + @ApiOperation("加载商品") + @PostMapping("/product/load") + public InvokeResult> loadProduct( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> productService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(ProductSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 品牌 + */ + @ApiOperation("品牌") + @GetMapping("/brand") + public InvokeResult> brand( + @Valid QueryProductBrandSelectorVo vo) { + + PageResult pageResult = productBrandService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductBrandSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载品牌 + */ + @ApiOperation("加载品牌") + @PostMapping("/brand/load") + public InvokeResult> loadBrand( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> productBrandService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(ProductBrandSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 类目 + */ + @ApiOperation("类目") + @GetMapping("/category") + public InvokeResult> category( + @Valid QueryProductCategorySelectorVo vo) { + + List datas = productCategoryService.selector(vo); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductCategorySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 加载类目 + */ + @ApiOperation("加载类目") + @PostMapping("/category/load") + public InvokeResult> loadCustomList( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> productCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(ProductCategorySelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 会员 + */ + @ApiOperation("会员") + @GetMapping("/member") + public InvokeResult> selector(@Valid QueryMemberSelectorVo vo) { + + PageResult pageResult = memberService.selector(getPageIndex(vo), getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(MemberSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载会员 + */ + @ApiOperation("加载会员") + @PostMapping("/member/load") + public InvokeResult> loadMember( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> memberService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(MemberSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 仓库 + */ + @ApiOperation("仓库") + @GetMapping("/sc") + public InvokeResult> selector( + @Valid QueryStoreCenterSelectorVo vo) { + + PageResult pageResult = storeCenterService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(StoreCenterSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载仓库 + */ + @ApiOperation("加载仓库") + @PostMapping("/sc/load") + public InvokeResult> loadSc( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> storeCenterService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(StoreCenterSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 供应商 + */ + @ApiOperation("供应商") + @GetMapping("/supplier") + public InvokeResult> selector(@Valid QuerySupplierSelectorVo vo) { + + PageResult pageResult = supplierService.selector(getPageIndex(vo), getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SupplierSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载供应商 + */ + @ApiOperation("加载供应商") + @PostMapping("/supplier/load") + public InvokeResult> loadSupplier( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> supplierService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(SupplierSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 客户 + */ + @ApiOperation("客户") + @GetMapping("/customer") + public InvokeResult> selector(@Valid QueryCustomerSelectorVo vo) { + + PageResult pageResult = customerService.selector(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(CustomerSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载客户 + */ + @ApiOperation("加载客户") + @PostMapping("/customer/load") + public InvokeResult> loadCustomer( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> customerService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(CustomerSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 门店 + */ + @ApiOperation("门店") + @GetMapping("/shop") + public InvokeResult> selector(@Valid ShopSelectorVo vo) { + + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(Shop.class) + .orderByAsc(Shop::getCode); + if (!StringUtil.isEmpty(vo.getCode())) { + queryWrapper.eq(Shop::getCode, vo.getCode()); + } + if (!StringUtil.isEmpty(vo.getName())) { + queryWrapper.like(Shop::getName, vo.getName()); + } + if (vo.getAvailable() != null) { + queryWrapper.eq(Shop::getAvailable, vo.getAvailable()); + } + + Page page = new Page<>(getPageIndex(vo), getPageSize(vo)); + page = shopService.page(page, queryWrapper); + + PageResult pageResult = PageResultUtil.convert(page); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ShopSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载门店 + */ + @ApiOperation("加载门店") + @PostMapping("/shop/load") + public InvokeResult> loadShop( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> shopService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(ShopSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 地址 + */ + @ApiOperation("地址") + @GetMapping("/address") + public InvokeResult> selector(@Valid AddressSelectorVo vo) { + + PageResult
pageResult = addressService.selector(getPageIndex(vo), getPageSize(vo), + vo); + + List
datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(AddressSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载地址 + */ + @ApiOperation("加载地址") + @PostMapping("/address/load") + public InvokeResult> loadAddress( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List
datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> addressService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(AddressSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 默认地址 + */ + @ApiOperation("默认地址") + @GetMapping("/address/default") + public InvokeResult selector( + @NotBlank(message = "实体ID不能为空!") String entityId, + @NotNull(message = "实体类型不能为空!") @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) Integer entityType, + @NotNull(message = "地址类型不能为空!") @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) Integer addressType) { + + Wrapper
queryWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, entityId).eq(Address::getEntityType, entityType) + .eq(Address::getAddressType, addressType) + .eq(Address::getIsDefault, Boolean.TRUE); + Address address = addressService.getOne(queryWrapper); + + return InvokeResultBuilder.success(address == null ? null : new AddressSelectorBo(address)); + } + + /** + * 支付方式 + */ + @ApiOperation("支付方式") + @GetMapping("/paytype") + public InvokeResult> selector(@Valid PayTypeSelectorVo vo) { + + PageResult pageResult = payTypeService.selector(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PayTypeSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载支付方式 + */ + @ApiOperation("加载支付方式") + @PostMapping("/paytype/load") + public InvokeResult> loadPayType( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> payTypeService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(PayTypeSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 物流公司 + */ + @ApiOperation("物流公司") + @GetMapping("/logistics/company") + public InvokeResult> selector( + @Valid QueryLogisticsCompanySelectorVo vo) { + + PageResult pageResult = logisticsCompanyService.selector(getPageIndex(vo), + getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(LogisticsCompanySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载物流公司 + */ + @ApiOperation("加载物流公司") + @PostMapping("/logistics/company/load") + public InvokeResult> loadLogisticsCompany( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> logisticsCompanyService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(LogisticsCompanySelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/CustomerController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/CustomerController.java new file mode 100644 index 0000000..31f561a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/CustomerController.java @@ -0,0 +1,180 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.customer.GetCustomerBo; +import com.lframework.xingyun.basedata.bo.customer.QueryCustomerBo; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.excel.customer.CustomerImportListener; +import com.lframework.xingyun.basedata.excel.customer.CustomerImportModel; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 客户管理 + * + * @author zmj + */ +@Api(tags = "客户管理") +@Validated +@RestController +@RequestMapping("/basedata/customer") +public class CustomerController extends DefaultBaseController { + + @Autowired + private CustomerService customerService; + + /** + * 客户列表 + */ + @ApiOperation("客户列表") + @HasPermission({"base-data:customer:query", "base-data:customer:add", + "base-data:customer:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryCustomerVo vo) { + + PageResult pageResult = customerService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询客户 + */ + @ApiOperation("查询客户") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:customer:query", "base-data:customer:add", + "base-data:customer:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Customer data = customerService.findById(id); + if (data == null) { + throw new DefaultClientException("客户不存在!"); + } + + GetCustomerBo result = new GetCustomerBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用客户 + */ + @ApiOperation("批量停用客户") + @HasPermission({"base-data:customer:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的客户!") @RequestBody List ids) { + + customerService.batchUnable(ids); + + for (String id : ids) { + customerService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用客户 + */ + @ApiOperation("批量启用客户") + @HasPermission({"base-data:customer:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的客户!") @RequestBody List ids) { + + customerService.batchEnable(ids); + + for (String id : ids) { + customerService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增客户 + */ + @ApiOperation("新增客户") + @HasPermission({"base-data:customer:add"}) + @PostMapping + public InvokeResult create(@Valid CreateCustomerVo vo) { + + customerService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改客户 + */ + @ApiOperation("修改客户") + @HasPermission({"base-data:customer:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateCustomerVo vo) { + + customerService.update(vo); + + customerService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:customer:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("客户导入模板", CustomerImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:customer:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + CustomerImportListener listener = new CustomerImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, CustomerImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/LogisticsCompanyController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/LogisticsCompanyController.java new file mode 100644 index 0000000..05d3ae5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/LogisticsCompanyController.java @@ -0,0 +1,158 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.basedata.bo.logistics.company.GetLogisticsCompanyBo; +import com.lframework.xingyun.basedata.bo.logistics.company.QueryLogisticsCompanyBo; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.basedata.vo.logistics.company.CreateLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.UpdateLogisticsCompanyVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 物流公司管理 + * + * @author zmj + */ +@Api(tags = "物流公司管理") +@Validated +@RestController +@RequestMapping("/basedata/logistics/company") +public class LogisticsCompanyController extends DefaultBaseController { + + @Autowired + private LogisticsCompanyService logisticsCompanyService; + + /** + * 物流公司列表 + */ + @ApiOperation("物流公司列表") + @HasPermission({"base-data:logistics-company:query", "base-data:logistics-company:add", + "base-data:logistics-company:modify"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryLogisticsCompanyVo vo) { + + PageResult pageResult = logisticsCompanyService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryLogisticsCompanyBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询物流公司 + */ + @ApiOperation("查询物流公司") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:logistics-company:query", "base-data:logistics-company:add", + "base-data:logistics-company:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + LogisticsCompany data = logisticsCompanyService.findById(id); + if (data == null) { + throw new DefaultClientException("物流公司不存在!"); + } + + GetLogisticsCompanyBo result = new GetLogisticsCompanyBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用物流公司 + */ + @ApiOperation("批量停用物流公司") + @HasPermission({"base-data:logistics-company:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的物流公司!") @RequestBody List ids) { + + logisticsCompanyService.batchUnable(ids); + + for (String id : ids) { + logisticsCompanyService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用物流公司 + */ + @ApiOperation("批量启用物流公司") + @HasPermission({"base-data:logistics-company:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的物流公司!") @RequestBody List ids) { + + logisticsCompanyService.batchEnable(ids); + + for (String id : ids) { + logisticsCompanyService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增物流公司 + */ + @ApiOperation("新增物流公司") + @HasPermission({"base-data:logistics-company:add"}) + @PostMapping + public InvokeResult create(@Valid CreateLogisticsCompanyVo vo) { + + logisticsCompanyService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改物流公司 + */ + @ApiOperation("修改物流公司") + @HasPermission({"base-data:logistics-company:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateLogisticsCompanyVo vo) { + + logisticsCompanyService.update(vo); + + logisticsCompanyService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/MemberController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/MemberController.java new file mode 100644 index 0000000..39efc04 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/MemberController.java @@ -0,0 +1,178 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.member.GetMemberBo; +import com.lframework.xingyun.basedata.bo.member.QueryMemberBo; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.excel.member.MemberImportListener; +import com.lframework.xingyun.basedata.excel.member.MemberImportModel; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.vo.member.CreateMemberVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import com.lframework.xingyun.basedata.vo.member.UpdateMemberVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 会员管理 + * + * @author zmj + */ +@Api(tags = "会员管理") +@Validated +@RestController +@RequestMapping("/basedata/member") +public class MemberController extends DefaultBaseController { + + @Autowired + private MemberService memberService; + + /** + * 会员列表 + */ + @ApiOperation("会员列表") + @HasPermission({"base-data:member:query", "base-data:member:add", "base-data:member:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryMemberVo vo) { + + PageResult pageResult = memberService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryMemberBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询会员 + */ + @ApiOperation("查询会员") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:member:query", "base-data:member:add", "base-data:member:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Member data = memberService.findById(id); + if (data == null) { + throw new DefaultClientException("会员不存在!"); + } + + GetMemberBo result = new GetMemberBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用会员 + */ + @ApiOperation("批量停用会员") + @HasPermission({"base-data:member:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的会员!") @RequestBody List ids) { + + memberService.batchUnable(ids); + + for (String id : ids) { + memberService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用会员 + */ + @ApiOperation("批量启用会员") + @HasPermission({"base-data:member:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的会员!") @RequestBody List ids) { + + memberService.batchEnable(ids); + + for (String id : ids) { + memberService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增会员 + */ + @ApiOperation("新增会员") + @HasPermission({"base-data:member:add"}) + @PostMapping + public InvokeResult create(@Valid CreateMemberVo vo) { + + String id = memberService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改会员 + */ + @ApiOperation("修改会员") + @HasPermission({"base-data:member:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateMemberVo vo) { + + memberService.update(vo); + + memberService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:member:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("会员导入模板", MemberImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:member:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + MemberImportListener listener = new MemberImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, MemberImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PayTypeController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PayTypeController.java new file mode 100644 index 0000000..8c9e3e8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/PayTypeController.java @@ -0,0 +1,115 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.basedata.bo.paytype.GetPayTypeBo; +import com.lframework.xingyun.basedata.bo.paytype.QueryPayTypeBo; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.vo.paytype.CreatePayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.UpdatePayTypeVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 支付方式管理 + * + * @author zmj + */ +@Api(tags = "支付方式管理") +@Validated +@RestController +@RequestMapping("/basedata/paytype") +public class PayTypeController extends DefaultBaseController { + + @Autowired + private PayTypeService payTypeService; + + /** + * 支付方式列表 + */ + @ApiOperation("支付方式列表") + @HasPermission({"base-data:pay-type:query", "base-data:pay-type:add", + "base-data:pay-type:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryPayTypeVo vo) { + + PageResult pageResult = payTypeService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryPayTypeBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询支付方式 + */ + @ApiOperation("查询支付方式") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:pay-type:query", "base-data:pay-type:add", + "base-data:pay-type:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + PayType data = payTypeService.findById(id); + if (data == null) { + throw new DefaultClientException("支付方式不存在!"); + } + + GetPayTypeBo result = new GetPayTypeBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增支付方式 + */ + @ApiOperation("新增支付方式") + @HasPermission({"base-data:pay-type:add"}) + @PostMapping + public InvokeResult create(@Valid CreatePayTypeVo vo) { + + payTypeService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改支付方式 + */ + @ApiOperation("修改支付方式") + @HasPermission({"base-data:pay-type:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdatePayTypeVo vo) { + + payTypeService.update(vo); + + payTypeService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductBrandController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductBrandController.java new file mode 100644 index 0000000..3e62db8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductBrandController.java @@ -0,0 +1,183 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.product.brand.GetProductBrandBo; +import com.lframework.xingyun.basedata.bo.product.brand.QueryProductBrandBo; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.excel.product.brand.ProductBrandImportListener; +import com.lframework.xingyun.basedata.excel.product.brand.ProductBrandImportModel; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.vo.product.brand.CreateProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.UpdateProductBrandVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 品牌管理 + * + * @author zmj + */ +@Api(tags = "品牌管理") +@Validated +@RestController +@RequestMapping("/basedata/product/brand") +public class ProductBrandController extends DefaultBaseController { + + @Autowired + private ProductBrandService productBrandService; + + /** + * 品牌列表 + */ + @ApiOperation("品牌列表") + @HasPermission({"base-data:product:brand:query", "base-data:product:brand:add", + "base-data:product:brand:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductBrandVo vo) { + + PageResult pageResult = productBrandService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryProductBrandBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + + /** + * 查询品牌 + */ + @ApiOperation("查询品牌") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:product:brand:query", "base-data:product:brand:add", + "base-data:product:brand:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductBrand data = productBrandService.findById(id); + if (data == null) { + throw new DefaultClientException("品牌不存在!"); + } + + GetProductBrandBo result = new GetProductBrandBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用品牌 + */ + @ApiOperation("批量停用品牌") + @HasPermission({"base-data:product:brand:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的品牌!") @RequestBody List ids) { + + productBrandService.batchUnable(ids); + + for (String id : ids) { + productBrandService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用品牌 + */ + @ApiOperation("批量启用品牌") + @HasPermission({"base-data:product:brand:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的品牌!") @RequestBody List ids) { + + productBrandService.batchEnable(ids); + + for (String id : ids) { + productBrandService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增品牌 + */ + @ApiOperation("新增品牌") + @HasPermission({"base-data:product:brand:add"}) + @PostMapping + public InvokeResult create(@Valid CreateProductBrandVo vo) { + + productBrandService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改品牌 + */ + @ApiOperation("修改品牌") + @HasPermission({"base-data:product:brand:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateProductBrandVo vo) { + + productBrandService.update(vo); + + productBrandService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:product:brand:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("品牌导入模板", ProductBrandImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:product:brand:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ProductBrandImportListener listener = new ProductBrandImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ProductBrandImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductCategoryController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductCategoryController.java new file mode 100644 index 0000000..e2e454d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductCategoryController.java @@ -0,0 +1,202 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.product.category.GetProductCategoryBo; +import com.lframework.xingyun.basedata.bo.product.category.ProductCategoryTreeBo; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.enums.ProductCategoryNodeType; +import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryImportListener; +import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryImportModel; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.vo.product.category.CreateProductCategoryVo; +import com.lframework.xingyun.basedata.vo.product.category.UpdateProductCategoryVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 类目管理 + * + * @author zmj + */ +@Api(tags = "类目管理") +@Validated +@RestController +@RequestMapping("/basedata/product/category") +public class ProductCategoryController extends DefaultBaseController { + + @Autowired + private ProductCategoryService productCategoryService; + + @Autowired + private RecursionMappingService recursionMappingService; + + /** + * 类目列表 + */ + @ApiOperation("类目列表") + @HasPermission({"base-data:product:category:query", "base-data:product:category:add", + "base-data:product:category:modify"}) + @GetMapping("/query") + public InvokeResult> query() { + + List datas = productCategoryService.getAllProductCategories(); + if (CollectionUtil.isEmpty(datas)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List results = datas.stream().map(ProductCategoryTreeBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 查询类目 + */ + @ApiOperation("查询类目") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:product:category:query", "base-data:product:category:add", + "base-data:product:category:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductCategory data = productCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("类目不存在!"); + } + + GetProductCategoryBo result = new GetProductCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用类目 + */ + @ApiOperation("批量停用类目") + @HasPermission({"base-data:product:category:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的类目!") @RequestBody List ids) { + + productCategoryService.batchUnable(ids); + return InvokeResultBuilder.success(); + } + + /** + * 批量启用类目 + */ + @ApiOperation("批量启用类目") + @HasPermission({"base-data:product:category:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的类目!") @RequestBody List ids) { + + productCategoryService.batchEnable(ids); + + for (String id : ids) { + productCategoryService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增类目 + */ + @ApiOperation("新增类目") + @HasPermission({"base-data:product:category:add"}) + @PostMapping + public InvokeResult create(@Valid CreateProductCategoryVo vo) { + + productCategoryService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改类目 + */ + @ApiOperation("修改类目") + @HasPermission({"base-data:product:category:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateProductCategoryVo vo) { + + productCategoryService.update(vo); + + productCategoryService.cleanCacheByKey(vo.getId()); + + ProductCategory data = productCategoryService.findById(vo.getId()); + if (!vo.getAvailable()) { + if (data.getAvailable()) { + //如果是停用 子节点全部停用 + List childrenIds = recursionMappingService.getNodeChildIds(data.getId(), + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (!CollectionUtil.isEmpty(childrenIds)) { + for (String childrenId : childrenIds) { + productCategoryService.cleanCacheByKey(childrenId); + } + } + } + } else { + if (!data.getAvailable()) { + //如果是启用 父节点全部启用 + List parentIds = recursionMappingService.getNodeParentIds(data.getId(), + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (!CollectionUtil.isEmpty(parentIds)) { + for (String parentId : parentIds) { + productCategoryService.cleanCacheByKey(parentId); + } + } + } + } + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:product:category:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("类目导入模板", ProductCategoryImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:product:category:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ProductCategoryImportListener listener = new ProductCategoryImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ProductCategoryImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductController.java new file mode 100644 index 0000000..d33c77a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductController.java @@ -0,0 +1,150 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.product.info.GetProductBo; +import com.lframework.xingyun.basedata.bo.product.info.QueryProductBo; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.excel.product.ProductImportListener; +import com.lframework.xingyun.basedata.excel.product.ProductImportModel; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.info.CreateProductVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 商品管理 + * + * @author zmj + */ +@Api(tags = "商品管理") +@Validated +@RestController +@RequestMapping("/basedata/product") +public class ProductController extends DefaultBaseController { + + @Autowired + private ProductService productService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + /** + * 商品列表 + */ + @ApiOperation("商品列表") + @HasPermission({"base-data:product:info:query", "base-data:product:info:add", + "base-data:product:info:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductVo vo) { + + PageResult pageResult = productService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 商品详情 + */ + @ApiOperation("商品详情") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:product:info:query", "base-data:product:info:add", + "base-data:product:info:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Product data = productService.findById(id); + + GetProductBo result = new GetProductBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增商品 + */ + @ApiOperation("新增商品") + @HasPermission({"base-data:product:info:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateProductVo vo) { + + productService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改商品 + */ + @ApiOperation("修改商品") + @HasPermission({"base-data:product:info:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateProductVo vo) { + + productService.update(vo); + + productService.cleanCacheByKey(vo.getId()); + + productPropertyRelationService.cleanCacheByKey(vo.getId()); + + productBundleService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:product:info:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("商品导入模板", ProductImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:product:info:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ProductImportListener listener = new ProductImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ProductImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyController.java new file mode 100644 index 0000000..5eb32d5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyController.java @@ -0,0 +1,201 @@ +package com.lframework.xingyun.basedata.controller; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.common.threads.DefaultRunnable; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.basedata.bo.product.property.GetProductPropertyBo; +import com.lframework.xingyun.basedata.bo.product.property.ProductPropertyModelorBo; +import com.lframework.xingyun.basedata.bo.product.property.QueryProductPropertyBo; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.vo.product.property.CreateProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.UpdateProductPropertyVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 属性管理 + * + * @author zmj + */ +@Api(tags = "属性管理") +@Validated +@RestController +@RequestMapping("/basedata/product/property") +public class ProductPropertyController extends DefaultBaseController { + + @Autowired + private ProductPropertyService productPropertyService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + /** + * 属性列表 + */ + @ApiOperation("属性列表") + @HasPermission({"base-data:product:property:query", "base-data:product:property:add", + "base-data:product:property:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductPropertyVo vo) { + + PageResult pageResult = productPropertyService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryProductPropertyBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询属性 + */ + @ApiOperation("查询属性") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:product:property:query", "base-data:product:property:add", + "base-data:product:property:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductProperty data = productPropertyService.findById(id); + if (data == null) { + throw new DefaultClientException("属性不存在!"); + } + + GetProductPropertyBo result = new GetProductPropertyBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用属性 + */ + @ApiOperation("批量停用属性") + @HasPermission({"base-data:product:property:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的属性!") @RequestBody List ids) { + + productPropertyService.batchUnable(ids); + + for (String id : ids) { + productPropertyService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用属性 + */ + @ApiOperation("批量启用属性") + @HasPermission({"base-data:product:property:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的属性!") @RequestBody List ids) { + + productPropertyService.batchEnable(ids); + + for (String id : ids) { + productPropertyService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增属性 + */ + @ApiOperation("新增属性") + @HasPermission({"base-data:product:property:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateProductPropertyVo vo) { + + productPropertyService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改属性 + */ + @ApiOperation("修改属性") + @HasPermission({"base-data:product:property:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateProductPropertyVo vo) { + + productPropertyService.update(vo); + + productPropertyService.cleanCacheByKey(vo.getId()); + + ThreadUtil.execAsync(new DefaultRunnable((() -> { + Wrapper relationWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class).select(ProductPropertyRelation::getProductId) + .eq(ProductPropertyRelation::getPropertyId, vo.getId()) + .groupBy(ProductPropertyRelation::getProductId); + List relations = productPropertyRelationService.list( + relationWrapper); + + productPropertyRelationService.cleanCacheByKeys( + relations.stream().map(ProductPropertyRelation::getProductId).collect( + Collectors.toList())); + }))); + + return InvokeResultBuilder.success(); + } + + /** + * 属性模型 + */ + @ApiOperation("属性模型") + @ApiImplicitParam(value = "类目ID", name = "categoryId", paramType = "query", required = true) + @GetMapping("/modelor/category") + public InvokeResult> getModelorByCategory( + @NotBlank(message = "类目ID不能为空!") String categoryId) { + + List datas = productPropertyService.getModelorByCategoryId( + categoryId); + + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ProductPropertyModelorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyItemController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyItemController.java new file mode 100644 index 0000000..97ba132 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ProductPropertyItemController.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.basedata.bo.product.property.item.GetProductPropertyItemBo; +import com.lframework.xingyun.basedata.bo.product.property.item.QueryProductPropertyItemBo; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.service.product.ProductPropertyItemService; +import com.lframework.xingyun.basedata.vo.product.property.item.CreateProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.UpdateProductPropertyItemVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 属性值管理 + * + * @author zmj + */ +@Api(tags = "属性值管理") +@Validated +@RestController +@RequestMapping("/basedata/product/property/item") +public class ProductPropertyItemController extends DefaultBaseController { + + @Autowired + private ProductPropertyItemService productPropertyItemService; + + /** + * 属性值列表 + */ + @ApiOperation("属性值列表") + @HasPermission({"base-data:product:property-item:query", "base-data:product:property-item:add", + "base-data:product:property-item:modify"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryProductPropertyItemVo vo) { + + PageResult pageResult = productPropertyItemService.query(getPageIndex(vo), + getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryProductPropertyItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询属性值 + */ + @ApiOperation("查询属性值") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:product:property-item:query", "base-data:product:property-item:add", + "base-data:product:property-item:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + ProductPropertyItem data = productPropertyItemService.findById(id); + if (data == null) { + throw new DefaultClientException("属性值不存在!"); + } + + GetProductPropertyItemBo result = new GetProductPropertyItemBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增属性值 + */ + @ApiOperation("新增属性值") + @HasPermission({"base-data:product:property-item:add"}) + @PostMapping + public InvokeResult create(@Valid CreateProductPropertyItemVo vo) { + + productPropertyItemService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改属性值 + */ + @ApiOperation("修改属性值") + @HasPermission({"base-data:product:property-item:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateProductPropertyItemVo vo) { + + productPropertyItemService.update(vo); + + productPropertyItemService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ShopController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ShopController.java new file mode 100644 index 0000000..bb44612 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/ShopController.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.shop.GetShopBo; +import com.lframework.xingyun.basedata.bo.shop.QueryShopBo; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.excel.shop.ShopImportListener; +import com.lframework.xingyun.basedata.excel.shop.ShopImportModel; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.vo.shop.CreateShopVo; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import com.lframework.xingyun.basedata.vo.shop.UpdateShopVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 门店 Controller + * + * @author zmj + */ +@Api(tags = "门店") +@Validated +@RestController +@RequestMapping("/basedata/shop") +public class ShopController extends DefaultBaseController { + + @Autowired + private ShopService shopService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"base-data:shop:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryShopVo vo) { + + PageResult pageResult = shopService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryShopBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:shop:query"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + Shop data = shopService.findById(id); + if (data == null) { + throw new DefaultClientException("门店不存在!"); + } + + GetShopBo result = new GetShopBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"base-data:shop:add"}) + @PostMapping + public InvokeResult create(@Valid CreateShopVo vo) { + + shopService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"base-data:shop:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateShopVo vo) { + + shopService.update(vo); + + shopService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:shop:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("门店导入模板", ShopImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:shop:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ShopImportListener listener = new ShopImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ShopImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/StoreCenterController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/StoreCenterController.java new file mode 100644 index 0000000..c0ac2c8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/StoreCenterController.java @@ -0,0 +1,181 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.storecenter.GetStoreCenterBo; +import com.lframework.xingyun.basedata.bo.storecenter.QueryStoreCenterBo; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.excel.storecenter.StoreCenterImportListener; +import com.lframework.xingyun.basedata.excel.storecenter.StoreCenterImportModel; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.vo.storecenter.CreateStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.UpdateStoreCenterVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 仓库管理 + * + * @author zmj + */ +@Api(tags = "仓库管理") +@Validated +@RestController +@RequestMapping("/basedata/storecenter") +public class StoreCenterController extends DefaultBaseController { + + @Autowired + private StoreCenterService storeCenterService; + + /** + * 仓库列表 + */ + @ApiOperation("仓库列表") + @HasPermission({"base-data:store-center:query", "base-data:store-center:add", + "base-data:store-center:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryStoreCenterVo vo) { + + PageResult pageResult = storeCenterService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryStoreCenterBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询仓库 + */ + @ApiOperation("查询仓库") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:store-center:query", "base-data:store-center:add", + "base-data:store-center:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + StoreCenter data = storeCenterService.findById(id); + if (data == null) { + throw new DefaultClientException("仓库不存在!"); + } + + GetStoreCenterBo result = new GetStoreCenterBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用仓库 + */ + @ApiOperation("批量停用仓库") + @HasPermission({"base-data:store-center:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的仓库!") @RequestBody List ids) { + + storeCenterService.batchUnable(ids); + + for (String id : ids) { + storeCenterService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用仓库 + */ + @ApiOperation("批量启用仓库") + @HasPermission({"base-data:store-center:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的仓库!") @RequestBody List ids) { + + storeCenterService.batchEnable(ids); + + for (String id : ids) { + storeCenterService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增仓库 + */ + @ApiOperation("新增仓库") + @HasPermission({"base-data:store-center:add"}) + @PostMapping + public InvokeResult create(@Valid CreateStoreCenterVo vo) { + + storeCenterService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改仓库 + */ + @ApiOperation("修改仓库") + @HasPermission({"base-data:store-center:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateStoreCenterVo vo) { + + storeCenterService.update(vo); + + storeCenterService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:store-center:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("仓库导入模板", StoreCenterImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:store-center:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + StoreCenterImportListener listener = new StoreCenterImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, StoreCenterImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/SupplierController.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/SupplierController.java new file mode 100644 index 0000000..ec45a25 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/SupplierController.java @@ -0,0 +1,181 @@ +package com.lframework.xingyun.basedata.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.basedata.bo.supplier.GetSupplierBo; +import com.lframework.xingyun.basedata.bo.supplier.QuerySupplierBo; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.excel.supplier.SupplierImportListener; +import com.lframework.xingyun.basedata.excel.supplier.SupplierImportModel; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.supplier.CreateSupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.UpdateSupplierVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 供应商管理 + * + * @author zmj + */ +@Api(tags = "供应商管理") +@Validated +@RestController +@RequestMapping("/basedata/supplier") +public class SupplierController extends DefaultBaseController { + + @Autowired + private SupplierService supplierService; + + /** + * 供应商列表 + */ + @ApiOperation("供应商列表") + @HasPermission({"base-data:supplier:query", "base-data:supplier:add", + "base-data:supplier:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySupplierVo vo) { + + PageResult pageResult = supplierService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QuerySupplierBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询供应商 + */ + @ApiOperation("查询供应商") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"base-data:supplier:query", "base-data:supplier:add", + "base-data:supplier:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + Supplier data = supplierService.findById(id); + if (data == null) { + throw new DefaultClientException("供应商不存在!"); + } + + GetSupplierBo result = new GetSupplierBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用供应商 + */ + @ApiOperation("批量停用供应商") + @HasPermission({"base-data:supplier:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的供应商!") @RequestBody List ids) { + + supplierService.batchUnable(ids); + + for (String id : ids) { + supplierService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用供应商 + */ + @ApiOperation("批量启用供应商") + @HasPermission({"base-data:supplier:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的供应商!") @RequestBody List ids) { + + supplierService.batchEnable(ids); + + for (String id : ids) { + supplierService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增供应商 + */ + @ApiOperation("新增供应商") + @HasPermission({"base-data:supplier:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSupplierVo vo) { + + supplierService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改供应商 + */ + @ApiOperation("修改供应商") + @HasPermission({"base-data:supplier:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSupplierVo vo) { + + supplierService.update(vo); + + supplierService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"base-data:supplier:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("供应商导入模板", SupplierImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"base-data:supplier:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + SupplierImportListener listener = new SupplierImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, SupplierImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/ProductPropertyRelationDto.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/ProductPropertyRelationDto.java new file mode 100644 index 0000000..ad50910 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/ProductPropertyRelationDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.dto.product; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.ColumnType; +import java.io.Serializable; +import lombok.Data; + +@Data +public class ProductPropertyRelationDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "ProductPropertyRelationDto"; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 属性ID + */ + private String propertyId; + + /** + * 属性值ID + */ + private String propertyItemId; + + /** + * 字段类型 + */ + private ColumnType propertyColumnType; + + /** + * 属性名称 + */ + private String propertyName; + + /** + * 属性值 + */ + private String propertyText; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/property/ProductPropertyModelorDto.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/property/ProductPropertyModelorDto.java new file mode 100644 index 0000000..498227d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/dto/product/property/ProductPropertyModelorDto.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.basedata.dto.product.property; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class ProductPropertyModelorDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 是否必填 + */ + private Boolean isRequired; + + /** + * 可选项,当columnType != CUSTOM时 不为空 + */ + private List items; + + /** + * 显示值 当columnType != CUSTOM时,此值为items项ID 当columnType == CUSTOM时,此值为录入值 + */ + private String text; + + /** + * 录入类型 + */ + private ColumnType columnType; + + /** + * 数据类型 + */ + private ColumnDataType columnDataType; + + /** + * 属性类别 + */ + private PropertyType propertyType; + + @Data + public static class ProductPropertyItemModelorDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Address.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Address.java new file mode 100644 index 0000000..2083bb0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Address.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-03-26 + */ +@Data +@TableName("base_data_address") +public class Address extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Address"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 实体ID + */ + private String entityId; + + /** + * 实体类型 + */ + private AddressEntityType entityType; + + /** + * 地址类型 + */ + private AddressType addressType; + + /** + * 姓名 + */ + private String name; + + /** + * 手机号 + */ + private String telephone; + + /** + * 省 + */ + private String provinceId; + + /** + * 市 + */ + private String cityId; + + /** + * 区 + */ + private String districtId; + + /** + * 详细地址 + */ + private String address; + + /** + * 是否默认地址 + */ + private Boolean isDefault; + + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Customer.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Customer.java new file mode 100644 index 0000000..9e55217 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Customer.java @@ -0,0 +1,158 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.SettleType; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-10 + */ +@Data +@TableName("base_data_customer") +public class Customer extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "CustomerDto"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 助记码 + */ + private String mnemonicCode; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 邮编 + */ + private String zipCode; + + /** + * 传真 + */ + private String fax; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 结账方式 + */ + private SettleType settleType; + + /** + * 统一社会信用代码 + */ + private String creditCode; + + /** + * 纳税人识别号 + */ + private String taxIdentifyNo; + + /** + * 开户银行 + */ + private String bankName; + + /** + * 户名 + */ + private String accountName; + + /** + * 银行账号 + */ + private String accountNo; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/LogisticsCompany.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/LogisticsCompany.java new file mode 100644 index 0000000..f5063f5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/LogisticsCompany.java @@ -0,0 +1,106 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-03-26 + */ +@Data +@TableName("base_data_logistics_company") +public class LogisticsCompany extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "LogisticsCompany"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Member.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Member.java new file mode 100644 index 0000000..8a42dba --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Member.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.template.core.enums.Gender; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_member") +public class Member extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Member"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 性别 + */ + private Gender gender; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 出生日期 + */ + private LocalDate birthday; + + /** + * 入会日期 + */ + private LocalDate joinDay; + + /** + * 所属门店 + */ + private String shopId; + + /** + * 所属导购 + */ + private String guiderId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PayType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PayType.java new file mode 100644 index 0000000..0ec2172 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/PayType.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-30 + */ +@Data +@TableName("base_data_pay_type") +public class PayType extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PayType"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 是否记录内容 + */ + private Boolean recText; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Product.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Product.java new file mode 100644 index 0000000..8c3ed0c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Product.java @@ -0,0 +1,144 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.ProductType; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 商品 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product") +public class Product extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "Product"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 简称 + */ + private String shortName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 商品类型 + */ + private ProductType productType; + + /** + * 进项税率(%) + */ + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + private BigDecimal saleTaxRate; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 重量(kg) + */ + private BigDecimal weight; + + /** + * 体积(cm3) + */ + private BigDecimal volume; + + /** + * 状态 + */ + private Boolean available; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBrand.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBrand.java new file mode 100644 index 0000000..0529ac2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBrand.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-06 + */ +@Data +@TableName("base_data_product_brand") +public class ProductBrand extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductBrand"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 简称 + */ + private String shortName; + + /** + * logo + */ + private String logo; + + /** + * 简介 + */ + private String introduction; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBundle.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBundle.java new file mode 100644 index 0000000..f33e513 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductBundle.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 组合商品 + *

+ * + * @author zmj + * @since 2023-05-25 + */ +@Data +@TableName("base_data_product_bundle") +public class ProductBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductBundle"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 主商品ID + */ + private String mainProductId; + + /** + * 单品ID + */ + private String productId; + + /** + * 包含数量 + */ + private Integer bundleNum; + + /** + * 销售价 + */ + private BigDecimal salePrice; + + /** + * 零售价 + */ + private BigDecimal retailPrice; + + + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategory.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategory.java new file mode 100644 index 0000000..91ab6f1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategory.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-05 + */ +@Data +@TableName("base_data_product_category") +public class ProductCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductCategory"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 父级ID + */ + private String parentId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategoryProperty.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategoryProperty.java new file mode 100644 index 0000000..50fec93 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductCategoryProperty.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-05 + */ +@Data +@TableName("base_data_product_category_property") +public class ProductCategoryProperty extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductCategoryPropertyDto"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 商品属性ID + */ + private String propertyId; + + /** + * 商品类目ID + */ + private String categoryId; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductProperty.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductProperty.java new file mode 100644 index 0000000..c39483d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductProperty.java @@ -0,0 +1,108 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-30 + */ +@Data +@TableName("base_data_product_property") +public class ProductProperty extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductProperty"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 是否必填 + */ + private Boolean isRequired; + + /** + * 录入类型 + */ + private ColumnType columnType; + + /** + * 数据类型 + */ + private ColumnDataType columnDataType; + + /** + * 属性类别 + */ + private PropertyType propertyType; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyItem.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyItem.java new file mode 100644 index 0000000..fe8591d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyItem.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-08-08 + */ +@Data +@TableName("base_data_product_property_item") +public class ProductPropertyItem extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "ProductPropertyItem"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 属性ID + */ + private String propertyId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyRelation.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyRelation.java new file mode 100644 index 0000000..5571e20 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPropertyRelation.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-08-05 + */ +@Data +@TableName("base_data_product_property_relation") +public class ProductPropertyRelation extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 商品属性ID + */ + private String propertyId; + + /** + * 属性值ID + */ + private String propertyItemId; + + /** + * 商品属性值 + */ + private String propertyText; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPurchase.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPurchase.java new file mode 100644 index 0000000..112289c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductPurchase.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product_purchase") +public class ProductPurchase extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 采购价 + */ + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductRetail.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductRetail.java new file mode 100644 index 0000000..fc744fb --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductRetail.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product_retail") +public class ProductRetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 零售价 + */ + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductSale.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductSale.java new file mode 100644 index 0000000..f51ed01 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/ProductSale.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_product_sale") +public class ProductSale extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 销售价 + */ + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Shop.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Shop.java new file mode 100644 index 0000000..85f2f1d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Shop.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 门店 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_shop") +public class Shop extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Shop"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 所属部门ID + */ + private String deptId; + + /** + * 经度 + */ + private BigDecimal lng; + + /** + * 纬度 + */ + private BigDecimal lat; + + /** + * 备注 + */ + private String description; + + /** + * 状态 + */ + private Boolean available; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/StoreCenter.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/StoreCenter.java new file mode 100644 index 0000000..58185e7 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/StoreCenter.java @@ -0,0 +1,110 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-07 + */ +@Data +@TableName("base_data_store_center") +public class StoreCenter extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "StoreCenter"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系人手机号码 + */ + private String telephone; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 仓库人数 + */ + private Integer peopleNum; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Supplier.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Supplier.java new file mode 100644 index 0000000..490d647 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/entity/Supplier.java @@ -0,0 +1,167 @@ +package com.lframework.xingyun.basedata.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-11 + */ +@Data +@TableName("base_data_supplier") +public class Supplier extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "Supplier"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 助记码 + */ + private String mnemonicCode; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 电子邮箱 + */ + private String email; + + /** + * 邮编 + */ + private String zipCode; + + /** + * 传真 + */ + private String fax; + + /** + * 地区ID + */ + private String cityId; + + /** + * 地址 + */ + private String address; + + /** + * 送货周期(天) + */ + private Integer deliveryCycle; + + /** + * 经营方式 + */ + private ManageType manageType; + + /** + * 结账方式 + */ + private SettleType settleType; + + /** + * 统一社会信用代码 + */ + private String creditCode; + + /** + * 纳税人识别号 + */ + private String taxIdentifyNo; + + /** + * 开户银行 + */ + private String bankName; + + /** + * 户名 + */ + private String accountName; + + /** + * 银行账号 + */ + private String accountNo; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressEntityType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressEntityType.java new file mode 100644 index 0000000..effdf8b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressEntityType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum AddressEntityType implements BaseEnum { + SC(1, "仓库"), CUSTOMER(2, "客户"), SUPPLIER(3, "供应商"), MEMBER(4, "会员"), SHOP(5, "门店"); + + @EnumValue + private final Integer code; + + private final String desc; + + AddressEntityType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressType.java new file mode 100644 index 0000000..6dbf702 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/AddressType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum AddressType implements BaseEnum { + DELIVERY(1, "发货地址"), RECEIVE(2, "收货地址"); + + @EnumValue + private final Integer code; + + private final String desc; + + AddressType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/BaseDataOpLogType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/BaseDataOpLogType.java new file mode 100644 index 0000000..c1663ef --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/BaseDataOpLogType.java @@ -0,0 +1,7 @@ +package com.lframework.xingyun.basedata.enums; + +public interface BaseDataOpLogType { + + // 基础信息 + int BASE_DATA = 1000; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnDataType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnDataType.java new file mode 100644 index 0000000..add247a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnDataType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum ColumnDataType implements BaseEnum { + INT(1, "整数型"), FLOAT(2, "浮点型"), STRING(3, "字符型"), DATE(4, "日期型"), TIME(5, "时间型"), DATE_TIME(6, + "日期时间型"); + + @EnumValue + private final Integer code; + + private final String desc; + + ColumnDataType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnType.java new file mode 100644 index 0000000..ac92313 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ColumnType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum ColumnType implements BaseEnum { + MULTIPLE(1, "多选"), SINGLE(2, "单选"), CUSTOM(3, "手动录入"); + + @EnumValue + private final Integer code; + + private final String desc; + + ColumnType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/InvoiceType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/InvoiceType.java new file mode 100644 index 0000000..e639ebb --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/InvoiceType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum InvoiceType implements BaseEnum { + NORMAL(1, "增值税普通发票"), SPECIAL(2, "增值税专用发票"), NORMAL_OR_SPECIAL(3, "增值税专用发票或增值税普通发票"), + ; + + @EnumValue + private final Integer code; + + private final String desc; + + InvoiceType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ManageType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ManageType.java new file mode 100644 index 0000000..e4e23ea --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ManageType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum ManageType implements BaseEnum { + DISTRIBUTION(1, "经销"); + + @EnumValue + private final Integer code; + + private final String desc; + + ManageType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductCategoryNodeType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductCategoryNodeType.java new file mode 100644 index 0000000..437a0ad --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductCategoryNodeType.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.basedata.enums; + +import com.lframework.xingyun.template.core.enums.NodeType; +import java.io.Serializable; +import org.springframework.stereotype.Component; + +@Component +public final class ProductCategoryNodeType implements NodeType, Serializable { + + private static final long serialVersionUID = 1L; + + @Override + public Integer getCode() { + + return 2; + } + + @Override + public String getDesc() { + + return "商品类目"; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductType.java new file mode 100644 index 0000000..5dfea32 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/ProductType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum ProductType implements BaseEnum { + NORMAL(1, "普通商品"), BUNDLE(2, "组合商品"); + + @EnumValue + private final Integer code; + + private final String desc; + + ProductType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/PropertyType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/PropertyType.java new file mode 100644 index 0000000..919ba4d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/PropertyType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum PropertyType implements BaseEnum { + COMMON(1, "通用属性"), APPOINT(2, "指定类目属性"), NONE(3, "无"); + + @EnumValue + private final Integer code; + + private final String desc; + + PropertyType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/SettleType.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/SettleType.java new file mode 100644 index 0000000..d7fc2e9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/SettleType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleType implements BaseEnum { + ARBITRARILY(1, "任意指定"), CASH_ON_DELIVERY(2, "货到付款"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/TaxRate.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/TaxRate.java new file mode 100644 index 0000000..5b35c5e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/enums/TaxRate.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum TaxRate implements BaseEnum { + RATE17(17, "17%"), RATE11(11, "11%"), RATE6(6, "6%"), RATE3(3, "3%"), RATE0(0, "0%"), FREE(-1, + "免税"); + + @EnumValue + private final Integer code; + + private final String desc; + + TaxRate(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportModel.java new file mode 100644 index 0000000..c6af8e9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressExportModel.java @@ -0,0 +1,134 @@ +package com.lframework.xingyun.basedata.excel.address; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import lombok.Data; + +@Data +public class AddressExportModel extends BaseBo
implements ExcelModel { + + /** + * 实体名称 + */ + @ExcelProperty("实体名称") + private String entityName; + + /** + * 实体类型 + */ + @ExcelProperty("实体类型") + private String entityType; + + /** + * 地址类型 + */ + @ExcelProperty("地址类型") + private String addressType; + + /** + * 姓名 + */ + @ExcelProperty("姓名") + private String name; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 省 + */ + @ExcelProperty("省") + private String provinceName; + + /** + * 市 + */ + @ExcelProperty("市") + private String cityName; + + /** + * 区 + */ + @ExcelProperty("区") + private String districtName; + + /** + * 详细地址 + */ + @ExcelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ExcelProperty("是否默认地址") + private String isDefault; + + public AddressExportModel() { + + } + + public AddressExportModel(Address dto) { + + super(dto); + } + + @Override + protected void afterInit(Address dto) { + if (dto.getEntityType() == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getEntityId()); + this.entityName = sc.getName(); + } else if (dto.getEntityType() == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getEntityId()); + this.entityName = customer.getName(); + } else if (dto.getEntityType() == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getEntityId()); + this.entityName = supplier.getName(); + } else if (dto.getEntityType() == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getEntityId()); + this.entityName = member.getName(); + } else if (dto.getEntityType() == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Shop shop = shopService.findById(dto.getEntityId()); + this.entityName = shop.getName(); + } + + this.entityType = dto.getEntityType().getDesc(); + this.addressType = dto.getAddressType().getDesc(); + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto province = dicCityService.findById(dto.getProvinceId()); + this.provinceName = province.getName(); + + DicCityDto city = dicCityService.findById(dto.getCityId()); + this.cityName = city.getName(); + + DicCityDto district = dicCityService.findById(dto.getDistrictId()); + this.districtName = district.getName(); + + this.isDefault = dto.getIsDefault() ? "是" : "否"; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportListener.java new file mode 100644 index 0000000..eb1c2c5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportListener.java @@ -0,0 +1,192 @@ +package com.lframework.xingyun.basedata.excel.address; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class AddressImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(AddressImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getEntityCode())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“实体编号”不能为空"); + } + AddressEntityType entityType = EnumUtil.getByDesc(AddressEntityType.class, + data.getEntityType()); + if (entityType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体类型”只能填写“" + CollectionUtil.join( + EnumUtil.getDescs(AddressEntityType.class), "、") + "”"); + } + data.setEntityTypeEnum(entityType); + if (entityType == AddressEntityType.SC) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getEntityCode()); + StoreCenter sc = storeCenterService.getOne(queryWrapper); + if (sc == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(sc.getId()); + } else if (entityType == AddressEntityType.CUSTOMER) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Customer.class) + .eq(Customer::getCode, data.getEntityCode()); + Customer customer = customerService.getOne(queryWrapper); + if (customer == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(customer.getId()); + } else if (entityType == AddressEntityType.SUPPLIER) { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getEntityCode()); + Supplier supplier = supplierService.getOne(queryWrapper); + if (supplier == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(supplier.getId()); + } else if (entityType == AddressEntityType.MEMBER) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, data.getEntityCode()); + Member member = memberService.getOne(queryWrapper); + if (member == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(member.getId()); + } else if (entityType == AddressEntityType.SHOP) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, data.getEntityCode()); + Shop shop = shopService.getOne(queryWrapper); + if (shop == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实体编号”不存在"); + } + data.setEntityId(shop.getId()); + } + AddressType addressType = EnumUtil.getByDesc(AddressType.class, + data.getAddressType()); + if (addressType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地址类型”只能填写“" + CollectionUtil.join( + EnumUtil.getDescs(AddressType.class), "、") + "”"); + } + data.setAddressTypeEnum(addressType); + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“姓名”不能为空"); + } + if (StringUtil.isBlank(data.getTelephone())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“联系电话”不能为空"); + } + if (StringUtil.isBlank(data.getCity())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”不能为空"); + } + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + if (StringUtil.isBlank(data.getAddress())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“详细地址”不能为空"); + } + if (StringUtil.isBlank(data.getIsDefault())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否默认地址”不能为空"); + } + + if (!"是".equals(data.getIsDefault()) && !"否".equals(data.getIsDefault())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否默认地址”只能填写“是、否”"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + AddressService addressService = ApplicationUtil.getBean(AddressService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + AddressImportModel data = datas.get(i); + CreateAddressVo createAddressVo = new CreateAddressVo(); + createAddressVo.setEntityId(data.getEntityId()); + createAddressVo.setEntityType(data.getEntityTypeEnum().getCode()); + createAddressVo.setAddressType(data.getAddressTypeEnum().getCode()); + createAddressVo.setName(data.getName()); + createAddressVo.setTelephone(data.getTelephone()); + createAddressVo.setCityId(data.getAreaId()); + createAddressVo.setAddress(data.getAddress()); + createAddressVo.setIsDefault("是".equals(data.getIsDefault())); + + try { + addressService.create(createAddressVo); + } catch (Exception e) { + throw new DefaultClientException( + "第" + (i + 1) + "行新增失败,失败原因:" + e.getMessage()); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportModel.java new file mode 100644 index 0000000..103f1c5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/address/AddressImportModel.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.basedata.excel.address; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import lombok.Data; + +@Data +public class AddressImportModel implements ExcelModel { + + /** + * 实体编号 + */ + @ExcelRequired + @ExcelProperty("实体编号") + private String entityCode; + + /** + * 实体ID + */ + @ExcelIgnore + private String entityId; + + /** + * 实体类型 + */ + @ExcelRequired + @ExcelProperty("实体类型") + private String entityType; + + /** + * 实体类型枚举 + */ + @ExcelIgnore + private AddressEntityType entityTypeEnum; + + /** + * 地址类型 + */ + @ExcelRequired + @ExcelProperty("地址类型") + private String addressType; + + /** + * 地址类型枚举 + */ + @ExcelIgnore + private AddressType addressTypeEnum; + + /** + * 姓名 + */ + @ExcelRequired + @ExcelProperty("姓名") + private String name; + + /** + * 联系电话 + */ + @ExcelRequired + @ExcelProperty("联系电话") + private String telephone; + + /** + * 地区 + */ + @ExcelRequired + @ExcelProperty("地区") + private String city; + + /** + * 地区ID + */ + @ExcelIgnore + private String areaId; + + /** + * 详细地址 + */ + @ExcelRequired + @ExcelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ExcelRequired + @ExcelProperty("是否默认地址") + private String isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportListener.java new file mode 100644 index 0000000..3a74ced --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportListener.java @@ -0,0 +1,160 @@ +package com.lframework.xingyun.basedata.excel.customer; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class CustomerImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(CustomerImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Customer.class) + .eq(Customer::getCode, data.getCode()); + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + if (customerService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (StringUtil.isBlank(data.getMnemonicCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“助记码”不能为空"); + } + if (StringUtil.isBlank(data.getSettleType())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结账方式”不能为空"); + } + SettleType settleType = EnumUtil.getByDesc(SettleType.class, data.getSettleType()); + if (settleType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结账方式”只能填写“" + + CollectionUtil.join( + EnumUtil.getDescs(SettleType.class), "、") + "”"); + } + data.setSettleTypeEnum(settleType); + + if (!StringUtil.isBlank(data.getCity())) { + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + } + + if (!StringUtil.isEmpty(data.getEmail())) { + if (!RegUtil.isMatch(PatternPool.EMAIL, data.getEmail())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“电子邮箱”格式有误"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + CustomerImportModel data = datas.get(i); + + Customer record = new Customer(); + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setMnemonicCode(data.getMnemonicCode()); + record.setContact(data.getContact()); + record.setTelephone(data.getTelephone()); + record.setEmail(data.getEmail()); + record.setZipCode(data.getZipCode()); + record.setFax(data.getFax()); + record.setCityId(data.getAreaId()); + record.setAddress(data.getAddress()); + record.setSettleType(data.getSettleTypeEnum()); + record.setCreditCode(data.getCreditCode()); + record.setTaxIdentifyNo(data.getTaxIdentifyNo()); + record.setBankName(data.getBankName()); + record.setAccountName(data.getAccountName()); + record.setAccountNo(data.getAccountNo()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + customerService.save(record); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportModel.java new file mode 100644 index 0000000..373cab2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/customer/CustomerImportModel.java @@ -0,0 +1,136 @@ +package com.lframework.xingyun.basedata.excel.customer; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.enums.SettleType; +import lombok.Data; + +@Data +public class CustomerImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 助记码 + */ + @ExcelRequired + @ExcelProperty("助记码") + private String mnemonicCode; + + /** + * 联系人 + */ + @ExcelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ExcelProperty("电子邮箱") + private String email; + + /** + * 邮编 + */ + @ExcelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ExcelProperty("传真") + private String fax; + + /** + * 地区 + */ + @ExcelProperty("地区") + private String city; + + /** + * 地区ID + */ + @ExcelIgnore + private String areaId; + + /** + * 地址 + */ + @ExcelProperty("地址") + private String address; + + /** + * 结账方式 + */ + @ExcelRequired + @ExcelProperty("结账方式") + private String settleType; + + /** + * 结账方式枚举 + */ + @ExcelIgnore + private SettleType settleTypeEnum; + + /** + * 统一社会信用代码 + */ + @ExcelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ExcelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ExcelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ExcelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ExcelProperty("银行账号") + private String accountNo; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportListener.java new file mode 100644 index 0000000..cad50ba --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportListener.java @@ -0,0 +1,154 @@ +package com.lframework.xingyun.basedata.excel.member; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.enums.Gender; +import com.lframework.xingyun.template.core.service.UserService; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class MemberImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(MemberImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, data.getCode()); + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + if (memberService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (StringUtil.isBlank(data.getGender())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“性别”不能为空"); + } + + Gender gender = EnumUtil.getByDesc(Gender.class, data.getGender()); + if (gender == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“性别”只能填写“" + CollectionUtil.join( + EnumUtil.getDescs(Gender.class), "、") + "”"); + } + data.setGenderEnum(gender); + + if (!StringUtil.isEmpty(data.getEmail())) { + if (!RegUtil.isMatch(PatternPool.EMAIL, data.getEmail())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“电子邮箱”格式有误"); + } + } + + if (!StringUtil.isEmpty(data.getShopCode())) { + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, data.getShopCode()); + Shop shop = shopService.getOne(queryWrapper); + if (shop == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“所属门店编号”不存在"); + } + data.setShopId(shop.getId()); + } + + if (!StringUtil.isEmpty(data.getGuiderCode())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto guider = userService.findByCode(data.getGuiderCode()); + if (guider == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“所属导购编号”不存在"); + } + data.setGuiderId(guider.getId()); + } + + if (data.getJoinDay() == null) { + data.setJoinDay(new Date()); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + MemberImportModel data = datas.get(i); + + Member record = new Member(); + record.setId(IdUtil.getId()); + + if (!StringUtil.isBlank(data.getTelephone())) { + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getTelephone, data.getTelephone()) + .ne(Member::getId, record.getId()); + if (memberService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + (i + 1) + "行“联系电话”重复,请重新输入"); + } + } + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setGender(data.getGenderEnum()); + record.setTelephone(data.getTelephone()); + record.setEmail(data.getEmail()); + record.setBirthday(DateUtil.toLocalDate(data.getBirthday())); + record.setJoinDay(DateUtil.toLocalDate(data.getJoinDay())); + record.setShopId(data.getShopId()); + record.setGuiderId(data.getGuiderId()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + record.setAvailable(Boolean.TRUE); + + data.setId(record.getId()); + + memberService.save(record); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportModel.java new file mode 100644 index 0000000..dd5e7ad --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/member/MemberImportModel.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.basedata.excel.member; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.xingyun.template.core.enums.Gender; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.util.Date; +import lombok.Data; + +@Data +public class MemberImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 性别 + */ + @ExcelRequired + @ExcelProperty("性别") + private String gender; + + /** + * 性别 + */ + @ExcelIgnore + private Gender genderEnum; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ExcelProperty("电子邮箱") + private String email; + + /** + * 出生日期 + */ + @ExcelProperty("出生日期") + private Date birthday; + + /** + * 入会日期 + */ + @ExcelProperty("入会日期") + private Date joinDay; + + /** + * 所属门店ID + */ + @ExcelIgnore + private String shopId; + + /** + * 所属门店编号 + */ + @ExcelProperty("所属门店编号") + private String shopCode; + + /** + * 所属导购ID + */ + @ExcelIgnore + private String guiderId; + + /** + * 所属导购编号 + */ + @ExcelProperty("所属导购编号") + private String guiderCode; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportListener.java new file mode 100644 index 0000000..f209fdf --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportListener.java @@ -0,0 +1,274 @@ +package com.lframework.xingyun.basedata.excel.product; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductRetailService; +import com.lframework.xingyun.basedata.service.product.ProductSaleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ProductImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ProductImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getCode()); + ProductService productService = ApplicationUtil.getBean(ProductService.class); + if (productService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getCode()); + Product product = productService.getOne(queryWrapper); + + if (StringUtil.isBlank(data.getSkuCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“SKU编号”不能为空"); + } + + LambdaQueryWrapper checkSkuCodeWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getSkuCode, data.getSkuCode()); + if (product != null) { + checkSkuCodeWrapper.ne(Product::getId, product.getId()); + if (product.getProductType() != ProductType.NORMAL) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行商品类型必须为" + + ProductType.NORMAL.getDesc() + ",请检查"); + } + } + + if (productService.count(checkSkuCodeWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“SKU编号”重复,请检查"); + } + + if (StringUtil.isBlank(data.getCategoryCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“类目编号”不能为空"); + } + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + Wrapper queryProductCategoryWrapper = Wrappers.lambdaQuery( + ProductCategory.class).eq(ProductCategory::getCode, data.getCategoryCode()); + ProductCategory productCategory = productCategoryService.getOne(queryProductCategoryWrapper); + if (productCategory == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“类目编号”不存在,请检查"); + } + + if (StringUtil.isBlank(data.getBrandCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“品牌编号”不能为空"); + } + data.setCategoryId(productCategory.getId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean( + ProductBrandService.class); + Wrapper queryProductBrandWrapper = Wrappers.lambdaQuery( + ProductBrand.class).eq(ProductBrand::getCode, data.getBrandCode()); + ProductBrand productBrand = productBrandService.getOne(queryProductBrandWrapper); + if (productBrand == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“品牌编号”不存在,请检查"); + } + data.setBrandId(productBrand.getId()); + + if (data.getTaxRate() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“进项税率(%)”不能为空"); + } + + if (NumberUtil.lt(data.getTaxRate(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“进项税率(%)”不允许小于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getTaxRate(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“进项税率(%)”必须为整数"); + } + + if (data.getSaleTaxRate() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销项税率(%)”不能为空"); + } + + if (NumberUtil.lt(data.getSaleTaxRate(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销项税率(%)”不允许小于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getSaleTaxRate(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销项税率(%)”必须为整数"); + } + + if (data.getPurchasePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价(元)”不能为空"); + } + + if (!NumberUtil.isNumberPrecision(data.getPurchasePrice(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价(元)”最多允许2位小数"); + } + if (NumberUtil.lt(data.getPurchasePrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价(元)”不允许小于0"); + } + + if (data.getSalePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售价(元)”不能为空"); + } + + if (!NumberUtil.isNumberPrecision(data.getSalePrice(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售价(元)”最多允许2位小数"); + } + if (NumberUtil.lt(data.getSalePrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售价(元)”不允许小于0"); + } + + if (data.getRetailPrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售价(元)”不能为空"); + } + + if (!NumberUtil.isNumberPrecision(data.getRetailPrice(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售价(元)”最多允许2位小数"); + } + if (NumberUtil.lt(data.getRetailPrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售价(元)”不允许小于0"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ProductImportModel data = datas.get(i); + + Wrapper checkSkuCodeWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getSkuCode, data.getSkuCode()).ne(Product::getCode, data.getCode()); + if (productService.count(checkSkuCodeWrapper) > 0) { + throw new DefaultClientException("第" + (i + 1) + "行“商品SKU编号”重复,请重新输入"); + } + + Product record = new Product(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + if (StringUtil.isNotBlank(data.getShortName())) { + record.setShortName(data.getShortName()); + } + record.setSkuCode(data.getSkuCode()); + record.setExternalCode(data.getExternalCode()); + record.setCategoryId(data.getCategoryId()); + record.setBrandId(data.getBrandId()); + if (data.getTaxRate() != null) { + record.setTaxRate(data.getTaxRate()); + } + if (data.getSaleTaxRate() != null) { + record.setSaleTaxRate(data.getSaleTaxRate()); + } + record.setSpec(data.getSpec()); + record.setUnit(data.getUnit()); + record.setProductType(ProductType.NORMAL); + + record.setAvailable(Boolean.TRUE); + + productService.save(record); + data.setId(record.getId()); + + if (data.getPurchasePrice() != null) { + ProductPurchaseService productPurchaseService = ApplicationUtil.getBean( + ProductPurchaseService.class); + CreateProductPurchaseVo createProductPurchaseVo = new CreateProductPurchaseVo(); + createProductPurchaseVo.setId(data.getId()); + createProductPurchaseVo.setPrice(data.getPurchasePrice()); + + productPurchaseService.create(createProductPurchaseVo); + } + + if (data.getSalePrice() != null) { + ProductSaleService productSaleService = ApplicationUtil.getBean(ProductSaleService.class); + CreateProductSaleVo createProductSaleVo = new CreateProductSaleVo(); + createProductSaleVo.setId(data.getId()); + createProductSaleVo.setPrice(data.getSalePrice()); + + productSaleService.create(createProductSaleVo); + } + + if (data.getRetailPrice() != null) { + ProductRetailService productRetailService = ApplicationUtil.getBean( + ProductRetailService.class); + CreateProductRetailVo createProductRetailVo = new CreateProductRetailVo(); + createProductRetailVo.setId(data.getId()); + createProductRetailVo.setPrice(data.getRetailPrice()); + + productRetailService.create(createProductRetailVo); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportModel.java new file mode 100644 index 0000000..bb0c6de --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/ProductImportModel.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.basedata.excel.product; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class ProductImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 简称 + */ + @ExcelProperty("简称") + private String shortName; + + /** + * SKU编号 + */ + @ExcelRequired + @ExcelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ExcelProperty("外部编号") + private String externalCode; + + /** + * 类目ID + */ + @ExcelIgnore + private String categoryId; + + /** + * 类目编号 + */ + @ExcelRequired + @ExcelProperty("类目编号") + private String categoryCode; + + /** + * 品牌ID + */ + @ExcelIgnore + private String brandId; + + /** + * 品牌编号 + */ + @ExcelRequired + @ExcelProperty("品牌编号") + private String brandCode; + + /** + * 进项税率(%) + */ + @ExcelRequired + @ExcelProperty("进项税率(%)") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @ExcelRequired + @ExcelProperty("销项税率(%)") + private BigDecimal saleTaxRate; + + /** + * 规格 + */ + @ExcelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ExcelProperty("单位") + private String unit; + + /** + * 采购价 + */ + @ExcelRequired + @ExcelProperty("采购价(元)") + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + @ExcelRequired + @ExcelProperty("销售价(元)") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @ExcelRequired + @ExcelProperty("零售价(元)") + private BigDecimal retailPrice; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportListener.java new file mode 100644 index 0000000..d15d704 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportListener.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.basedata.excel.product.brand; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ProductBrandImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ProductBrandImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getCode, data.getCode()); + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + if (productBrandService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ProductBrandImportModel data = datas.get(i); + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getName, data.getName()).ne(ProductBrand::getCode, data.getCode()); + if (productBrandService.count(checkNameWrapper) > 0) { + throw new DefaultClientException( + "第" + (i + 1) + "行“名称”重复,请重新输入"); + } + + ProductBrand record = new ProductBrand(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setShortName(data.getShortName()); + record.setIntroduction(StringUtil.isBlank(data.getIntroduction()) ? StringPool.EMPTY_STR + : data.getIntroduction()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + productBrandService.save(record); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportModel.java new file mode 100644 index 0000000..2d96935 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/brand/ProductBrandImportModel.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.excel.product.brand; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class ProductBrandImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 简称 + */ + @ExcelProperty("简称") + private String shortName; + + /** + * 简介 + */ + @ExcelProperty("简介") + private String introduction; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportListener.java new file mode 100644 index 0000000..1bf3248 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportListener.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.basedata.excel.product.category; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ProductCategoryImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ProductCategoryImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getCode()); + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + if (productCategoryService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (!StringUtil.isBlank(data.getParentCode())) { + Wrapper queryParentWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getParentCode()); + ProductCategory parent = productCategoryService.getOne(queryParentWrapper); + if (parent == null) { + // 检查是不是新导入的 + if (this.datas.stream().noneMatch(t -> t.getCode().equals(data.getParentCode()))) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“上级类目编号”不存在"); + } + } + + // 不允许改变上级类目 + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getCode()); + ProductCategory productCategory = productCategoryService.getOne(queryWrapper); + if (productCategory != null) { + ProductCategory parentCategory = StringUtil.isBlank(productCategory.getParentId()) ? null + : productCategoryService.getById(productCategory.getParentId()); + if (parentCategory == null || !parentCategory.getCode().equals(data.getParentCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“上级类目编号”有误,不允许修改类目的归属关系"); + } + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ProductCategoryImportModel data = datas.get(i); + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getName, data.getName()) + .ne(ProductCategory::getCode, data.getCode()); + if (productCategoryService.count(checkNameWrapper) > 0) { + throw new DefaultClientException( + "第" + (i + 1) + "行“名称”重复,请重新输入"); + } + + ProductCategory record = new ProductCategory(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + if (!StringUtil.isBlank(data.getParentCode())) { + Wrapper queryParentWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, data.getParentCode()); + ProductCategory parent = productCategoryService.getOne(queryParentWrapper); + if (parent == null) { + throw new DefaultClientException("第" + (i + 1) + "行“上级类目编号”不存在"); + } + if (record.getId().equals(parent.getId())) { + throw new DefaultClientException( + "第" + (i + 1) + "行“上级类目编号”与“编号”相同,请重新输入"); + } + record.setParentId(parent.getId()); + } + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + //这里要与上级类目的状态保持一致 + Boolean available = Boolean.TRUE; + if (StringUtil.isNotBlank(record.getParentId())) { + ProductCategory parentCategory = productCategoryService.findById(record.getParentId()); + available = parentCategory.getAvailable(); + } + record.setAvailable(available); + + productCategoryService.save(record); + productCategoryService.saveRecursion(record.getId(), record.getParentId()); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportModel.java new file mode 100644 index 0000000..982928e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/product/category/ProductCategoryImportModel.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.excel.product.category; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class ProductCategoryImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 上级类目编号 + */ + @ExcelProperty("上级类目编号") + private String parentCode; + + /** + * 上级类目ID + */ + @ExcelIgnore + private String parentId; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportListener.java new file mode 100644 index 0000000..d672eae --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportListener.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.basedata.excel.shop; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.template.core.dto.DeptDto; +import com.lframework.xingyun.template.core.service.DeptService; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ShopImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(ShopImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Shop.class) + .eq(Shop::getCode, data.getCode()); + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + if (shopService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (!StringUtil.isBlank(data.getDeptCode())) { + DeptService deptService = ApplicationUtil.getBean(DeptService.class); + DeptDto dept = deptService.findByCode(data.getDeptCode()); + if (dept == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“所属部门编号”不存在"); + } + data.setDeptId(dept.getId()); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + ShopService shopService = ApplicationUtil.getBean(ShopService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + ShopImportModel data = datas.get(i); + + Shop record = new Shop(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setDeptId(data.getDeptId()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + shopService.save(record); + + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportModel.java new file mode 100644 index 0000000..efdc865 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/shop/ShopImportModel.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.basedata.excel.shop; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class ShopImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 所属部门编号 + */ + @ExcelProperty("所属部门编号") + private String deptCode; + + /** + * 所属部门ID + */ + @ExcelIgnore + private String deptId; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportListener.java new file mode 100644 index 0000000..7fcf1d5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportListener.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.basedata.excel.storecenter; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class StoreCenterImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(StoreCenterImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getCode()); + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + if (storeCenterService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (!StringUtil.isBlank(data.getCity())) { + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + } + + if (data.getPeopleNum() != null) { + if (data.getPeopleNum() < 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库人数”不允许小于0"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + StoreCenterImportModel data = datas.get(i); + + StoreCenter record = new StoreCenter(); + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setContact(data.getContact()); + record.setTelephone(data.getTelephone()); + record.setCityId(data.getAreaId()); + record.setAddress(data.getAddress()); + record.setPeopleNum(data.getPeopleNum()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + record.setAvailable(Boolean.TRUE); + + storeCenterService.save(record); + data.setId(record.getId()); + + this.setSuccessProcessByIndex(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportModel.java new file mode 100644 index 0000000..57559a1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/storecenter/StoreCenterImportModel.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.basedata.excel.storecenter; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import lombok.Data; + +@Data +public class StoreCenterImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 联系人 + */ + @ExcelProperty("联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @ExcelProperty("联系人手机号码") + private String telephone; + + /** + * 地区 + */ + @ExcelProperty("地区") + private String city; + + /** + * 仓库地址 + */ + @ExcelProperty("仓库地址") + private String address; + + /** + * 仓库人数 + */ + @ExcelProperty("仓库人数") + private Integer peopleNum; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 地区的ID + */ + @ExcelIgnore + private String areaId; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportListener.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportListener.java new file mode 100644 index 0000000..48537c5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportListener.java @@ -0,0 +1,184 @@ +package com.lframework.xingyun.basedata.excel.supplier; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import java.util.ArrayList; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class SupplierImportListener extends ExcelImportListener { + + private List checkList = new ArrayList<>(); + + @Override + protected void doInvoke(SupplierImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”不能为空"); + } + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“编号”必须由字母、数字、“-_.”组成,长度不能超过20位"); + } + if (checkList.contains(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”与第" + (checkList.indexOf(data.getCode()) + 1) + "行重复"); + } + checkList.add(data.getCode()); + Wrapper checkWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getCode()); + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + if (supplierService.count(checkWrapper) > 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“编号”已存在"); + } + if (StringUtil.isBlank(data.getName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“名称”不能为空"); + } + if (StringUtil.isBlank(data.getMnemonicCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“助记码”不能为空"); + } + if (StringUtil.isBlank(data.getSettleType())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结账方式”不能为空"); + } + SettleType settleType = EnumUtil.getByDesc(SettleType.class, data.getSettleType()); + if (settleType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“结账方式”只能填写“" + + CollectionUtil.join( + EnumUtil.getDescs(SettleType.class), "、") + "”"); + } + data.setSettleTypeEnum(settleType); + + if (StringUtil.isBlank(data.getManageType())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“经营方式”不能为空"); + } + ManageType manageType = EnumUtil.getByDesc(ManageType.class, data.getManageType()); + if (manageType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“经营方式”只能填写“" + + CollectionUtil.join( + EnumUtil.getDescs(ManageType.class), "、") + "”"); + } + data.setManageTypeEnum(manageType); + + if (!StringUtil.isBlank(data.getCity())) { + String[] arr = data.getCity().split("/"); + if (arr.length != 3) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + + "行“地区”格式错误,应为省/市/区(县),例如:北京市/市辖区/东城区"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto province = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName().equals(arr[0])) + .findFirst().orElse(null); + if (province == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,省份不存在"); + } + DicCityDto city = allCitys.stream() + .filter(t -> province.getId().equals(t.getParentId()) && t.getName().equals(arr[1])) + .findFirst().orElse(null); + if (city == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,市不存在"); + } + DicCityDto area = allCitys.stream() + .filter(t -> city.getId().equals(t.getParentId()) && t.getName().equals(arr[2])) + .findFirst().orElse(null); + if (area == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“地区”错误,区(县)不存在"); + } + + data.setAreaId(area.getId()); + } + + if (!StringUtil.isEmpty(data.getEmail())) { + if (!RegUtil.isMatch(PatternPool.EMAIL, data.getEmail())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“电子邮箱”格式有误"); + } + } + + if (data.getDeliveryCycle() != null) { + if (data.getDeliveryCycle() <= 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“送货周期(天)”必须大于0"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + SupplierImportModel data = datas.get(i); + + Supplier record = new Supplier(); + + record.setId(IdUtil.getId()); + + record.setCode(data.getCode()); + record.setName(data.getName()); + record.setMnemonicCode(data.getMnemonicCode()); + record.setContact(data.getContact()); + record.setTelephone(data.getTelephone()); + record.setEmail(data.getEmail()); + record.setZipCode(data.getZipCode()); + record.setFax(data.getFax()); + record.setCityId(data.getAreaId()); + record.setAddress(data.getAddress()); + record.setDeliveryCycle(data.getDeliveryCycle()); + record.setManageType(data.getManageTypeEnum()); + record.setSettleType(data.getSettleTypeEnum()); + record.setCreditCode(data.getCreditCode()); + record.setTaxIdentifyNo(data.getTaxIdentifyNo()); + record.setBankName(data.getBankName()); + record.setAccountName(data.getAccountName()); + record.setAccountNo(data.getAccountNo()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + record.setAvailable(Boolean.TRUE); + + supplierService.save(record); + data.setId(record.getId()); + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportModel.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportModel.java new file mode 100644 index 0000000..06c8247 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/excel/supplier/SupplierImportModel.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.basedata.excel.supplier; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import lombok.Data; + +@Data +public class SupplierImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 编号 + */ + @ExcelRequired + @ExcelProperty("编号") + private String code; + + /** + * 名称 + */ + @ExcelRequired + @ExcelProperty("名称") + private String name; + + /** + * 助记码 + */ + @ExcelRequired + @ExcelProperty("助记码") + private String mnemonicCode; + + /** + * 联系人 + */ + @ExcelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ExcelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ExcelProperty("电子邮箱") + private String email; + + /** + * 邮编 + */ + @ExcelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ExcelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ExcelProperty("地区") + private String city; + + /** + * 地区ID + */ + @ExcelIgnore + private String areaId; + + /** + * 地址 + */ + @ExcelProperty("地址") + private String address; + + /** + * 送货周期(天) + */ + @ExcelProperty("送货周期(天)") + private Integer deliveryCycle; + + /** + * 经营方式 + */ + @ExcelRequired + @ExcelProperty("经营方式") + private String manageType; + + /** + * 经营方式枚举 + */ + @ExcelIgnore + private ManageType manageTypeEnum; + + /** + * 结账方式 + */ + @ExcelRequired + @ExcelProperty(value = "结账方式") + private String settleType; + + /** + * 结账方式枚举 + */ + @ExcelIgnore + private SettleType settleTypeEnum; + + /** + * 统一社会信用代码 + */ + @ExcelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ExcelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ExcelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ExcelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ExcelProperty("银行账号") + private String accountNo; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/address/AddressServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/address/AddressServiceImpl.java new file mode 100644 index 0000000..3bf1371 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/address/AddressServiceImpl.java @@ -0,0 +1,164 @@ +package com.lframework.xingyun.basedata.impl.address; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.mappers.AddressMapper; +import com.lframework.xingyun.basedata.service.address.AddressService; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import com.lframework.xingyun.basedata.vo.address.UpdateAddressVo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import com.lframework.xingyun.template.core.annotations.OpLog; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class AddressServiceImpl extends BaseMpServiceImpl + implements AddressService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult
query(Integer pageIndex, Integer pageSize, QueryAddressVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List
datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List
query(QueryAddressVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult
selector(Integer pageIndex, Integer pageSize, AddressSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List
datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = Address.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Address findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增地址,ID:{}, 编号:{}", params = {"#_result", + "#vo.code"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateAddressVo vo) { + + if (vo.getIsDefault()) { + Wrapper
checkWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, vo.getEntityId()) + .eq(Address::getAddressType, vo.getAddressType()).eq(Address::getIsDefault, Boolean.TRUE); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("实体已存在默认地址,不允许再新增默认地址!"); + } + } + + Address data = new Address(); + data.setId(IdUtil.getId()); + data.setEntityId(vo.getEntityId()); + data.setEntityType(EnumUtil.getByCode(AddressEntityType.class, vo.getEntityType())); + data.setAddressType(EnumUtil.getByCode(AddressType.class, vo.getAddressType())); + data.setName(vo.getName()); + data.setTelephone(vo.getTelephone()); + DicCityDto district = dicCityService.findById(vo.getCityId()); + data.setDistrictId(district.getId()); + DicCityDto city = dicCityService.findById(district.getParentId()); + data.setCityId(city.getId()); + DicCityDto province = dicCityService.findById(city.getParentId()); + data.setProvinceId(province.getId()); + data.setAddress(vo.getAddress()); + data.setIsDefault(vo.getIsDefault()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改地址,ID:{}, 编号:{}", params = {"#vo.id", + "#vo.code"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateAddressVo vo) { + + Address data = getBaseMapper().selectById(vo.getId()); + if (data == null) { + throw new DefaultClientException("地址不存在!"); + } + if (vo.getIsDefault()) { + Wrapper
checkWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, vo.getEntityId()) + .eq(Address::getAddressType, vo.getAddressType()).eq(Address::getIsDefault, Boolean.TRUE) + .ne(Address::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("实体已存在默认地址,不允许再新增默认地址!"); + } + } + data.setEntityId(vo.getEntityId()); + data.setEntityType(EnumUtil.getByCode(AddressEntityType.class, vo.getEntityType())); + data.setAddressType(EnumUtil.getByCode(AddressType.class, vo.getAddressType())); + data.setName(vo.getName()); + data.setTelephone(vo.getTelephone()); + DicCityDto district = dicCityService.findById(vo.getCityId()); + data.setDistrictId(district.getId()); + DicCityDto city = dicCityService.findById(district.getParentId()); + data.setCityId(city.getId()); + DicCityDto province = dicCityService.findById(city.getParentId()); + data.setProvinceId(province.getId()); + data.setAddress(vo.getAddress()); + data.setIsDefault(vo.getIsDefault()); + + getBaseMapper().updateAllColumnById(data); + } + + @Override + public Address getDefaultAddress(String entityId, Integer entityType, Integer addressType) { + Wrapper
queryWrapper = Wrappers.lambdaQuery(Address.class) + .eq(Address::getEntityId, entityId).eq(Address::getEntityType, entityType) + .eq(Address::getAddressType, addressType).eq(Address::getIsDefault, Boolean.TRUE); + return this.getOne(queryWrapper); + } + + @CacheEvict(value = Address.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/customer/CustomerServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/customer/CustomerServiceImpl.java new file mode 100644 index 0000000..9698a0d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/customer/CustomerServiceImpl.java @@ -0,0 +1,240 @@ +package com.lframework.xingyun.basedata.impl.customer; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.mappers.CustomerMapper; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class CustomerServiceImpl extends BaseMpServiceImpl implements + CustomerService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryCustomerVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Customer.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Customer findById(String id) { + + return getBaseMapper().selectById(id); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, QueryCustomerSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用客户,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Customer.class) + .set(Customer::getAvailable, Boolean.FALSE).in(Customer::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用客户,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Customer.class) + .set(Customer::getAvailable, Boolean.TRUE).in(Customer::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增客户,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Customer.class).eq(Customer::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Customer data = new Customer(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getMnemonicCode())) { + data.setMnemonicCode(vo.getMnemonicCode()); + } + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getEmail())) { + data.setEmail(vo.getEmail()); + } + if (!StringUtil.isBlank(vo.getZipCode())) { + data.setZipCode(vo.getZipCode()); + } + if (!StringUtil.isBlank(vo.getFax())) { + data.setFax(vo.getFax()); + } + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + data.setSettleType(EnumUtil.getByCode(SettleType.class, vo.getSettleType())); + if (!StringUtil.isBlank(vo.getCreditCode())) { + data.setCreditCode(vo.getCreditCode()); + } + if (!StringUtil.isBlank(vo.getTaxIdentifyNo())) { + data.setTaxIdentifyNo(vo.getTaxIdentifyNo()); + } + if (!StringUtil.isBlank(vo.getBankName())) { + data.setBankName(vo.getBankName()); + } + if (!StringUtil.isBlank(vo.getAccountName())) { + data.setAccountName(vo.getAccountName()); + } + if (!StringUtil.isBlank(vo.getAccountNo())) { + data.setAccountNo(vo.getAccountNo()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改客户,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerVo vo) { + + Customer data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("客户不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Customer.class).eq(Customer::getCode, vo.getCode()) + .ne(Customer::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Customer.class) + .set(Customer::getCode, vo.getCode()).set(Customer::getName, vo.getName()) + .set(Customer::getMnemonicCode, !StringUtil.isBlank(vo.getMnemonicCode()) ? vo.getMnemonicCode() : null) + .set(Customer::getContact, !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(Customer::getTelephone, !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(Customer::getAddress, !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(Customer::getEmail, !StringUtil.isBlank(vo.getEmail()) ? vo.getEmail() : null) + .set(Customer::getZipCode, !StringUtil.isBlank(vo.getZipCode()) ? vo.getZipCode() : null) + .set(Customer::getFax, !StringUtil.isBlank(vo.getFax()) ? vo.getFax() : null) + .set(Customer::getAddress, !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(Customer::getCreditCode, !StringUtil.isBlank(vo.getCreditCode()) ? vo.getCreditCode() : null) + .set(Customer::getTaxIdentifyNo, + !StringUtil.isBlank(vo.getTaxIdentifyNo()) ? vo.getTaxIdentifyNo() : null) + .set(Customer::getBankName, !StringUtil.isBlank(vo.getBankName()) ? vo.getBankName() : null) + .set(Customer::getAccountName, !StringUtil.isBlank(vo.getAccountName()) ? vo.getAccountName() : null) + .set(Customer::getAccountNo, !StringUtil.isBlank(vo.getAccountNo()) ? vo.getAccountNo() : null) + .set(Customer::getAvailable, vo.getAvailable()).set(Customer::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(Customer::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(Customer::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(Customer::getCityId, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = Customer.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/logistics/LogisticsCompanyServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/logistics/LogisticsCompanyServiceImpl.java new file mode 100644 index 0000000..84e4066 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/logistics/LogisticsCompanyServiceImpl.java @@ -0,0 +1,211 @@ +package com.lframework.xingyun.basedata.impl.logistics; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.mappers.LogisticsCompanyMapper; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.basedata.vo.logistics.company.CreateLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.UpdateLogisticsCompanyVo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class LogisticsCompanyServiceImpl extends + BaseMpServiceImpl implements + LogisticsCompanyService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanyVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryLogisticsCompanyVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = LogisticsCompany.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public LogisticsCompany findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用物流公司,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(LogisticsCompany.class) + .set(LogisticsCompany::getAvailable, Boolean.FALSE).in(LogisticsCompany::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用物流公司,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(LogisticsCompany.class) + .set(LogisticsCompany::getAvailable, Boolean.TRUE).in(LogisticsCompany::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增物流公司,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateLogisticsCompanyVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(LogisticsCompany.class) + .eq(LogisticsCompany::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LogisticsCompany data = new LogisticsCompany(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改物流公司,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateLogisticsCompanyVo vo) { + + LogisticsCompany data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("物流公司不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(LogisticsCompany.class) + .eq(LogisticsCompany::getCode, vo.getCode()) + .ne(LogisticsCompany::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + LogisticsCompany.class) + .set(LogisticsCompany::getCode, vo.getCode()).set(LogisticsCompany::getName, vo.getName()) + .set(LogisticsCompany::getContact, + !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(LogisticsCompany::getTelephone, + !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(LogisticsCompany::getAddress, + !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(LogisticsCompany::getAvailable, vo.getAvailable()) + .set(LogisticsCompany::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(LogisticsCompany::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(LogisticsCompany::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(LogisticsCompany::getCityId, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanySelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = LogisticsCompany.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/member/MemberServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/member/MemberServiceImpl.java new file mode 100644 index 0000000..388eb37 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/member/MemberServiceImpl.java @@ -0,0 +1,217 @@ +package com.lframework.xingyun.basedata.impl.member; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.Gender; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.mappers.MemberMapper; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.vo.member.CreateMemberVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import com.lframework.xingyun.basedata.vo.member.UpdateMemberVo; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class MemberServiceImpl extends BaseMpServiceImpl implements + MemberService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryMemberVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryMemberVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Member.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Member findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用会员,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Member.class) + .set(Member::getAvailable, Boolean.FALSE) + .in(Member::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用会员,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Member.class) + .set(Member::getAvailable, Boolean.TRUE) + .in(Member::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增会员,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateMemberVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getTelephone, vo.getTelephone()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("手机号重复,请重新输入!"); + } + } + + Member data = new Member(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setGender(EnumUtil.getByCode(Gender.class, vo.getGender())); + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getEmail())) { + data.setEmail(vo.getEmail()); + } + if (vo.getBirthday() != null) { + data.setBirthday(vo.getBirthday()); + } + if (vo.getJoinDay() != null) { + data.setJoinDay(vo.getJoinDay()); + } + if (!StringUtil.isBlank(vo.getShopId())) { + data.setShopId(vo.getShopId()); + } + if (!StringUtil.isBlank(vo.getGuiderId())) { + data.setGuiderId(vo.getGuiderId()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改会员,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateMemberVo vo) { + + Member data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("会员不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getCode, vo.getCode()) + .ne(Member::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + checkWrapper = Wrappers.lambdaQuery(Member.class) + .eq(Member::getTelephone, vo.getTelephone()) + .ne(Member::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("手机号重复,请重新输入!"); + } + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Member.class) + .set(Member::getCode, vo.getCode()).set(Member::getName, vo.getName()) + .set(Member::getGender, EnumUtil.getByCode(Gender.class, vo.getGender())) + .set(Member::getTelephone, + !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(Member::getEmail, !StringUtil.isBlank(vo.getEmail()) ? vo.getEmail() : null) + .set(Member::getBirthday, vo.getBirthday() != null ? vo.getBirthday() : null) + .set(Member::getJoinDay, vo.getJoinDay() != null ? vo.getJoinDay() : null) + .set(Member::getShopId, !StringUtil.isBlank(vo.getShopId()) ? vo.getShopId() : null) + .set(Member::getGuiderId, + !StringUtil.isBlank(vo.getGuiderId()) ? vo.getGuiderId() : null) + .set(Member::getAvailable, vo.getAvailable()).set(Member::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(Member::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryMemberSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = Member.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/paytype/PayTypeServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/paytype/PayTypeServiceImpl.java new file mode 100644 index 0000000..bf349bd --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/paytype/PayTypeServiceImpl.java @@ -0,0 +1,153 @@ +package com.lframework.xingyun.basedata.impl.paytype; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.mappers.PayTypeMapper; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.vo.paytype.CreatePayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.UpdatePayTypeVo; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class PayTypeServiceImpl extends BaseMpServiceImpl + implements PayTypeService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryPayTypeVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPayTypeVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, PayTypeSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = PayType.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public PayType findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增支付方式,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePayTypeVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getName, vo.getName()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + PayType data = new PayType(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + data.setRecText(vo.getRecText()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改支付方式,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePayTypeVo vo) { + + PayType data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("支付方式不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, vo.getCode()).ne(PayType::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getName, vo.getName()).ne(PayType::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(PayType.class) + .set(PayType::getCode, vo.getCode()).set(PayType::getName, vo.getName()) + .set(PayType::getAvailable, vo.getAvailable()).set(PayType::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(PayType::getRecText, vo.getRecText()) + .eq(PayType::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = PayType.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBrandServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBrandServiceImpl.java new file mode 100644 index 0000000..032842d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBrandServiceImpl.java @@ -0,0 +1,188 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.mappers.ProductBrandMapper; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.vo.product.brand.CreateProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.UpdateProductBrandVo; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductBrandServiceImpl extends BaseMpServiceImpl + implements ProductBrandService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryProductBrandVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductBrandVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, QueryProductBrandSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = ProductBrand.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductBrand findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用商品品牌,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductBrand.class) + .set(ProductBrand::getAvailable, Boolean.FALSE).in(ProductBrand::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用商品品牌,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductBrand.class) + .set(ProductBrand::getAvailable, Boolean.TRUE).in(ProductBrand::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增商品品牌,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductBrandVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getName, vo.getName()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + ProductBrand data = new ProductBrand(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setShortName(StringUtil.isBlank(vo.getShortName()) ? StringPool.EMPTY_STR : vo.getShortName()); + data.setIntroduction(StringUtil.isBlank(vo.getIntroduction()) ? StringPool.EMPTY_STR : vo.getIntroduction()); + data.setAvailable(Boolean.TRUE); + data.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (!StringUtil.isBlank(vo.getLogo())) { + data.setLogo(vo.getLogo()); + } + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改商品品牌,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductBrandVo vo) { + + ProductBrand data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("品牌不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getCode, vo.getCode()).ne(ProductBrand::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductBrand.class) + .eq(ProductBrand::getName, vo.getName()).ne(ProductBrand::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(ProductBrand.class) + .set(ProductBrand::getCode, vo.getCode()).set(ProductBrand::getName, vo.getName()) + .set(ProductBrand::getShortName, + StringUtil.isBlank(vo.getShortName()) ? StringPool.EMPTY_STR : vo.getShortName()) + .set(ProductBrand::getLogo, StringUtil.isBlank(vo.getLogo()) ? null : vo.getLogo()) + .set(ProductBrand::getIntroduction, + StringUtil.isBlank(vo.getIntroduction()) ? StringPool.EMPTY_STR : vo.getIntroduction()) + .set(ProductBrand::getAvailable, vo.getAvailable()).set(ProductBrand::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(ProductBrand::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = ProductBrand.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBundleServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBundleServiceImpl.java new file mode 100644 index 0000000..6aec307 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductBundleServiceImpl.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.mappers.ProductBundleMapper; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class ProductBundleServiceImpl extends BaseMpServiceImpl + implements ProductBundleService { + + @Cacheable(value = ProductBundle.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null or #result.isEmpty()") + @Override + public List getByMainProductId(String id) { + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductBundle.class) + .eq(ProductBundle::getMainProductId, id); + return this.list(queryWrapper); + } + + @CacheEvict(value = ProductBundle.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryPropertyServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryPropertyServiceImpl.java new file mode 100644 index 0000000..3cef55c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryPropertyServiceImpl.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.mappers.ProductCategoryPropertyMapper; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductCategoryPropertyServiceImpl + extends BaseMpServiceImpl + implements ProductCategoryPropertyService { + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(String categoryId, String propertyId) { + + ProductCategoryProperty record = new ProductCategoryProperty(); + record.setId(IdUtil.getId()); + record.setPropertyId(propertyId); + record.setCategoryId(categoryId); + + getBaseMapper().insert(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByPropertyId(String propertyId) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery( + ProductCategoryProperty.class) + .eq(ProductCategoryProperty::getPropertyId, propertyId); + getBaseMapper().delete(deleteWrapper); + } + + @Override + public List getByPropertyId(String propertyId) { + + return getBaseMapper().getByPropertyId(propertyId); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryServiceImpl.java new file mode 100644 index 0000000..7b59837 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductCategoryServiceImpl.java @@ -0,0 +1,253 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.enums.ProductCategoryNodeType; +import com.lframework.xingyun.basedata.mappers.ProductCategoryMapper; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.vo.product.category.CreateProductCategoryVo; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import com.lframework.xingyun.basedata.vo.product.category.UpdateProductCategoryVo; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductCategoryServiceImpl extends + BaseMpServiceImpl + implements ProductCategoryService { + + @Autowired + private RecursionMappingService recursionMappingService; + + @Override + public List getAllProductCategories() { + + return getBaseMapper().getAllProductCategories(); + } + + @Cacheable(value = ProductCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductCategory findById(String id) { + + return getBaseMapper().selectById(id); + } + + @Override + public List selector(QueryProductCategorySelectorVo vo) { + + return getBaseMapper().selector(vo); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用商品类目,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + List batchIds = new ArrayList<>(); + for (String id : ids) { + List nodeChildIds = recursionMappingService.getNodeChildIds(id, + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (CollectionUtil.isEmpty(nodeChildIds)) { + continue; + } + + batchIds.addAll(nodeChildIds); + } + + batchIds.addAll(ids); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductCategory.class) + .set(ProductCategory::getAvailable, Boolean.FALSE).in(ProductCategory::getId, batchIds); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用商品类目,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + List batchIds = new ArrayList<>(); + for (String id : ids) { + List nodeParentIds = recursionMappingService.getNodeParentIds(id, + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (CollectionUtil.isEmpty(nodeParentIds)) { + continue; + } + + batchIds.addAll(nodeParentIds); + } + + batchIds.addAll(ids); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductCategory.class) + .set(ProductCategory::getAvailable, Boolean.TRUE).in(ProductCategory::getId, batchIds); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增商品类目,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductCategoryVo vo) { + + //查询Code是否重复 + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + //查询Name是否重复 + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getName, vo.getName()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + //如果parentId不为空,查询上级类目是否存在 + if (!StringUtil.isBlank(vo.getParentId())) { + Wrapper checkParentWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getId, vo.getParentId()); + if (getBaseMapper().selectCount(checkParentWrapper) == 0) { + throw new DefaultClientException("上级类目不存在,请检查!"); + } + } + + ProductCategory data = new ProductCategory(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getParentId())) { + data.setParentId(vo.getParentId()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription(vo.getDescription()); + + getBaseMapper().insert(data); + + this.saveRecursion(data.getId(), data.getParentId()); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改商品类目,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductCategoryVo vo) { + + ProductCategory data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("类目不存在!"); + } + + //查询Code是否重复 + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getCode, vo.getCode()).ne(ProductCategory::getId, data.getId()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + //查询Name是否重复 + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductCategory.class) + .eq(ProductCategory::getName, vo.getName()).ne(ProductCategory::getId, data.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductCategory.class) + .set(ProductCategory::getCode, vo.getCode()).set(ProductCategory::getName, vo.getName()) + .set(ProductCategory::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(ProductCategory::getAvailable, vo.getAvailable()) + .eq(ProductCategory::getId, data.getId()); + + getBaseMapper().update(updateWrapper); + + if (!vo.getAvailable()) { + if (data.getAvailable()) { + //如果是停用 子节点全部停用 + List childrenIds = recursionMappingService.getNodeChildIds(data.getId(), + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (!CollectionUtil.isEmpty(childrenIds)) { + this.batchUnable(childrenIds); + } + } + } else { + if (!data.getAvailable()) { + //如果是启用 父节点全部启用 + List parentIds = recursionMappingService.getNodeParentIds(data.getId(), + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (!CollectionUtil.isEmpty(parentIds)) { + this.batchEnable(parentIds); + } + } + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + /** + * 保存递归信息 + * + * @param categoryId + * @param parentId + */ + @Override + public void saveRecursion(String categoryId, String parentId) { + + if (!StringUtil.isBlank(parentId)) { + List parentIds = recursionMappingService.getNodeParentIds(parentId, + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (CollectionUtil.isEmpty(parentIds)) { + parentIds = new ArrayList<>(); + } + parentIds.add(parentId); + + recursionMappingService.saveNode(categoryId, + ApplicationUtil.getBean(ProductCategoryNodeType.class), + parentIds); + } else { + recursionMappingService.saveNode(categoryId, + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + } + } + + @CacheEvict(value = ProductCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyItemServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyItemServiceImpl.java new file mode 100644 index 0000000..510f42e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyItemServiceImpl.java @@ -0,0 +1,155 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.mappers.ProductPropertyItemMapper; +import com.lframework.xingyun.basedata.service.product.ProductPropertyItemService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.vo.product.property.item.CreateProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.UpdateProductPropertyItemVo; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductPropertyItemServiceImpl extends BaseMpServiceImpl + implements ProductPropertyItemService { + + @Autowired + private ProductPropertyService productPropertyService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryProductPropertyItemVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductPropertyItemVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public List getByPropertyId(String propertyId) { + + return getBaseMapper().getByPropertyId(propertyId); + } + + @Cacheable(value = ProductPropertyItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductPropertyItem findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增商品属性值,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPropertyItemVo vo) { + + ProductProperty property = productPropertyService.findById(vo.getPropertyId()); + if (ObjectUtil.isNull(property)) { + throw new DefaultClientException("属性不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, vo.getPropertyId()) + .eq(ProductPropertyItem::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, vo.getPropertyId()) + .eq(ProductPropertyItem::getName, vo.getName()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + ProductPropertyItem data = new ProductPropertyItem(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setPropertyId(vo.getPropertyId()); + data.setAvailable(Boolean.TRUE); + data.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改商品属性值,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductPropertyItemVo vo) { + + ProductPropertyItem data = this.findById(vo.getId()); + if (data == null) { + throw new DefaultClientException("属性值不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, data.getPropertyId()) + .eq(ProductPropertyItem::getCode, vo.getCode()).ne(ProductPropertyItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductPropertyItem.class) + .eq(ProductPropertyItem::getPropertyId, data.getPropertyId()) + .eq(ProductPropertyItem::getName, vo.getName()).ne(ProductPropertyItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductPropertyItem.class) + .set(ProductPropertyItem::getCode, vo.getCode()).set(ProductPropertyItem::getName, vo.getName()) + .set(ProductPropertyItem::getAvailable, vo.getAvailable()).eq(ProductPropertyItem::getId, vo.getId()) + .set(ProductPropertyItem::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = ProductPropertyItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyRelationServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyRelationServiceImpl.java new file mode 100644 index 0000000..e08f220 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyRelationServiceImpl.java @@ -0,0 +1,198 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.mappers.ProductPropertyRelationMapper; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyItemService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.property.realtion.CreateProductPropertyRelationVo; +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductPropertyRelationServiceImpl extends + BaseMpServiceImpl + implements ProductPropertyRelationService { + + @Autowired + private ProductPropertyService productPropertyService; + + @Autowired + private ProductPropertyItemService productPropertyItemService; + + @Autowired + private ProductService productService; + + @Autowired + private ProductCategoryPropertyService productCategoryPropertyService; + + @Cacheable(value = ProductPropertyRelationDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #productId", unless = "#result == null or #result.size() == 0") + @Override + public List getByProductId(String productId) { + + return getBaseMapper().getByProductId(productId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setMultipleToSimple(String propertyId) { + + List datas = getBaseMapper().getByPropertyId(propertyId); + if (!CollectionUtil.isEmpty(datas)) { + + Set checkSet = new HashSet<>(); + for (ProductPropertyRelationDto data : datas) { + if (checkSet.stream() + .anyMatch(t -> t.getProductId().equals(data.getProductId()) && t.getPropertyId() + .equals(data.getPropertyId()))) { + getBaseMapper().deleteById(data.getId()); + } else { + checkSet.add(data); + } + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setCommonToAppoint(String propertyId) { + + List categoryList = productCategoryPropertyService.getByPropertyId( + propertyId); + for (ProductCategoryProperty productCategoryPropertyDto : categoryList) { + getBaseMapper().setCommonToAppoint(propertyId, productCategoryPropertyDto.getCategoryId()); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setAppointToCommon(String propertyId) { + + List propertyItems = productPropertyItemService.getByPropertyId( + propertyId); + if (!CollectionUtil.isEmpty(propertyItems)) { + ProductPropertyItem propertyItem = propertyItems.get(0); + + List productIds = productService.getIdNotInProductProperty(propertyId); + if (!CollectionUtil.isEmpty(productIds)) { + for (String productId : productIds) { + ProductPropertyRelation data = new ProductPropertyRelation(); + data.setId(IdUtil.getId()); + data.setProductId(productId); + data.setPropertyId(propertyItem.getPropertyId()); + data.setPropertyItemId(propertyItem.getId()); + + getBaseMapper().insert(data); + } + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateAppointCategoryId(String propertyId) { + + List propertyItems = productPropertyItemService.getByPropertyId( + propertyId); + if (!CollectionUtil.isEmpty(propertyItems)) { + ProductPropertyItem propertyItem = propertyItems.get(0); + + Wrapper deleteWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class) + .eq(ProductPropertyRelation::getPropertyId, propertyId); + getBaseMapper().delete(deleteWrapper); + + List categoryList = productCategoryPropertyService.getByPropertyId( + propertyId); + for (ProductCategoryProperty productCategoryPropertyDto : categoryList) { + List productIds = productService.getIdByCategoryId( + productCategoryPropertyDto.getCategoryId()); + if (!CollectionUtil.isEmpty(productIds)) { + for (String productId : productIds) { + ProductPropertyRelation data = new ProductPropertyRelation(); + data.setId(IdUtil.getId()); + data.setProductId(productId); + data.setPropertyId(propertyItem.getPropertyId()); + data.setPropertyItemId(propertyItem.getId()); + + getBaseMapper().insert(data); + } + } + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPropertyRelationVo vo) { + + ProductProperty productProperty = productPropertyService.findById(vo.getPropertyId()); + if (productProperty == null) { + throw new DefaultClientException("商品属性不存在!"); + } + + ProductPropertyRelation data = new ProductPropertyRelation(); + data.setId(IdUtil.getId()); + data.setProductId(vo.getProductId()); + data.setPropertyId(productProperty.getId()); + + if (productProperty.getColumnType() != ColumnType.CUSTOM) { + ProductPropertyItem propertyItem = productPropertyItemService.findById( + vo.getPropertyItemId()); + + if (propertyItem == null) { + throw new DefaultClientException("属性值不存在!"); + } + Assert.isTrue(propertyItem.getPropertyId().equals(productProperty.getId())); + + data.setPropertyItemId(propertyItem.getId()); + + } else { + if (StringUtil.isBlank(vo.getPropertyText())) { + throw new DefaultClientException("属性值文本不存在!"); + } + + data.setPropertyText(vo.getPropertyText()); + } + + getBaseMapper().insert(data); + + return data.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByProductId(String productId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery( + ProductPropertyRelation.class).eq(ProductPropertyRelation::getProductId, productId); + getBaseMapper().delete(deleteWrapper); + } + + @CacheEvict(value = ProductPropertyRelationDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyServiceImpl.java new file mode 100644 index 0000000..6fadfae --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPropertyServiceImpl.java @@ -0,0 +1,370 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.ProductCategoryNodeType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import com.lframework.xingyun.basedata.mappers.ProductPropertyMapper; +import com.lframework.xingyun.basedata.service.product.ProductCategoryPropertyService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.vo.product.property.CreateProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.UpdateProductPropertyVo; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductPropertyServiceImpl extends + BaseMpServiceImpl + implements ProductPropertyService { + + @Autowired + private ProductCategoryService productCategoryService; + + @Autowired + private RecursionMappingService recursionMappingService; + + @Autowired + private ProductCategoryPropertyService productCategoryPropertyService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductPropertyVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductPropertyVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = ProductProperty.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public ProductProperty findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用商品属性,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductProperty.class) + .set(ProductProperty::getAvailable, Boolean.FALSE).in(ProductProperty::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用商品属性,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ProductProperty.class) + .set(ProductProperty::getAvailable, Boolean.TRUE).in(ProductProperty::getId, ids); + getBaseMapper().update(updateWrapper); + } + + private List calcCategoryIds(List categoryIds) { + + if (CollectionUtil.isEmpty(categoryIds)) { + return CollectionUtil.emptyList(); + } + + //先整理categoryId,因为可能父级类目和子级类目全传过来了 + Set childCategoryIds = new HashSet<>(); + + for (String categoryId : categoryIds) { + + List children = recursionMappingService.getNodeChildIds(categoryId, + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + if (!CollectionUtil.isEmpty(children)) { + childCategoryIds.addAll(children); + } + } + + //如果传过来的categoryId在childCategoryIds中,则表示categoryId和他的父级节点一起传过来了,需要去除 + List results = categoryIds.stream().filter(t -> !childCategoryIds.contains(t)) + .collect(Collectors.toList()); + + return results; + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增商品属性,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPropertyVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getName, vo.getName()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + if (vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + //如果是指定类目 + if (CollectionUtil.isEmpty(vo.getCategoryIds())) { + throw new InputErrorException("请选择商品类目!"); + } + + for (String categoryId : vo.getCategoryIds()) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + if (productCategory == null) { + throw new InputErrorException("商品类目数据有误,请检查!"); + } + } + + vo.setCategoryIds(this.calcCategoryIds(vo.getCategoryIds())); + } + + ProductProperty data = new ProductProperty(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setIsRequired(vo.getIsRequired()); + data.setColumnType(EnumUtil.getByCode(ColumnType.class, vo.getColumnType())); + if (data.getColumnType() == ColumnType.CUSTOM) { + if (vo.getColumnDataType() == null) { + throw new InputErrorException("数据类型不能为空!"); + } + + data.setColumnDataType(EnumUtil.getByCode(ColumnDataType.class, vo.getColumnDataType())); + } + data.setPropertyType(EnumUtil.getByCode(PropertyType.class, vo.getPropertyType())); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + if (data.getPropertyType() == PropertyType.APPOINT) { + for (String categoryId : vo.getCategoryIds()) { + productCategoryPropertyService.create(categoryId, data.getId()); + } + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改商品属性,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductPropertyVo vo) { + + ProductProperty data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("属性不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getCode, vo.getCode()).ne(ProductProperty::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkNameWrapper = Wrappers.lambdaQuery(ProductProperty.class) + .eq(ProductProperty::getName, vo.getName()).ne(ProductProperty::getId, vo.getId()); + if (getBaseMapper().selectCount(checkNameWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + //如果字段类型是手动录入,那么不允许修改字段类型 + if (data.getColumnType() == ColumnType.CUSTOM) { + if (vo.getColumnType() != ColumnType.CUSTOM.getCode().intValue()) { + throw new InputErrorException("该属性的字段类型为“" + ColumnType.CUSTOM.getDesc() + "”,不允许修改!"); + } + + if (vo.getColumnDataType() == null) { + throw new InputErrorException("请选择数据类型!"); + } + + if (data.getColumnDataType().getCode().intValue() != vo.getColumnDataType()) { + throw new InputErrorException("数据类型不允许修改!"); + } + + if (vo.getPropertyType() != data.getPropertyType().getCode().intValue()) { + throw new InputErrorException("该属性不允许修改属性类别!"); + } + } + + if (data.getColumnType() != ColumnType.CUSTOM + && vo.getColumnType() == ColumnType.CUSTOM.getCode().intValue()) { + //从其他类型更改为手动录入 + throw new InputErrorException("该属性不允许将字段类型修改为“" + ColumnType.CUSTOM.getDesc() + "”!"); + } + + if (data.getPropertyType() != PropertyType.NONE + && vo.getPropertyType() == PropertyType.NONE.getCode() + .intValue()) { + throw new InputErrorException( + "该属性的属性类别为“" + data.getPropertyType().getDesc() + "”,不允许修改为“" + + PropertyType.NONE.getDesc() + "”"); + } + + List oldProductCategoryPropertyList = new ArrayList<>(); + + if (vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + //如果是指定类目 + if (CollectionUtil.isEmpty(vo.getCategoryIds())) { + throw new InputErrorException("请选择商品类目!"); + } + + for (String categoryId : vo.getCategoryIds()) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + if (productCategory == null) { + throw new InputErrorException("商品类目数据有误,请检查!"); + } + } + + vo.setCategoryIds(this.calcCategoryIds(vo.getCategoryIds())); + } + + if (data.getPropertyType() == PropertyType.APPOINT) { + //删除关系 + oldProductCategoryPropertyList = productCategoryPropertyService.getByPropertyId(data.getId()); + productCategoryPropertyService.deleteByPropertyId(data.getId()); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + ProductProperty.class) + .set(ProductProperty::getCode, vo.getCode()).set(ProductProperty::getName, vo.getName()) + .set(ProductProperty::getIsRequired, vo.getIsRequired()) + .set(ProductProperty::getColumnType, vo.getColumnType()) + .set(ProductProperty::getPropertyType, vo.getPropertyType()) + .set(ProductProperty::getAvailable, vo.getAvailable()).set(ProductProperty::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(ProductProperty::getId, vo.getId()); + if (vo.getColumnType() != ColumnType.CUSTOM.getCode().intValue()) { + updateWrapper.set(ProductProperty::getColumnDataType, null); + } else { + updateWrapper.set(ProductProperty::getColumnDataType, vo.getColumnDataType()); + } + + if (vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + for (String categoryId : vo.getCategoryIds()) { + productCategoryPropertyService.create(categoryId, data.getId()); + } + } + + getBaseMapper().update(updateWrapper); + + if (vo.getPropertyType() != PropertyType.NONE.getCode().intValue()) { + if (data.getColumnType() == ColumnType.MULTIPLE + && vo.getColumnType() == ColumnType.SINGLE.getCode() + .intValue()) { + //从多选更改为单选 + productPropertyRelationService.setMultipleToSimple(data.getId()); + } + + if (data.getPropertyType() == PropertyType.COMMON + && vo.getPropertyType() == PropertyType.APPOINT.getCode() + .intValue()) { + //从通用改成指定类目 + productPropertyRelationService.setCommonToAppoint(data.getId()); + + } else if (data.getPropertyType() == PropertyType.APPOINT + && vo.getPropertyType() == PropertyType.COMMON.getCode().intValue()) { + //从指定类目改成通用 + productPropertyRelationService.setAppointToCommon(data.getId()); + } else if (data.getPropertyType() == PropertyType.APPOINT + && vo.getPropertyType() == PropertyType.APPOINT.getCode().intValue()) { + List oldCategoryIds = oldProductCategoryPropertyList.stream() + .map(ProductCategoryProperty::getCategoryId).collect(Collectors.toList()); + + boolean isUpdateCategory = CollectionUtil.isEqualList(oldCategoryIds, vo.getCategoryIds()); + if (isUpdateCategory) { + //更改了类目ID + productPropertyRelationService.updateAppointCategoryId(data.getId()); + } + } + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public List getModelorByCategoryId(String categoryId) { + + List parentCategoryIds = recursionMappingService.getNodeParentIds(categoryId, + ApplicationUtil.getBean(ProductCategoryNodeType.class)); + List categoryIds = new ArrayList<>(parentCategoryIds); + categoryIds.add(categoryId); + List datas = getBaseMapper().getModelorByCategoryId(categoryIds); + return datas; + } + + @CacheEvict(value = ProductProperty.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPurchaseServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPurchaseServiceImpl.java new file mode 100644 index 0000000..0ff3e52 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductPurchaseServiceImpl.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.mappers.ProductPurchaseMapper; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.purchase.UpdateProductPurchaseVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductPurchaseServiceImpl extends + BaseMpServiceImpl + implements ProductPurchaseService { + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "设置商品采购价,ID:{}, 采购价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductPurchaseVo vo) { + + ProductPurchase data = new ProductPurchase(); + data.setId(IdUtil.getId()); + if (!StringUtil.isBlank(vo.getId())) { + data.setId(vo.getId()); + } + + data.setPrice(vo.getPrice()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "设置商品采购价,ID:{}, 采购价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductPurchaseVo vo) { + + if (vo.getPrice() == null) { + throw new InputErrorException("采购价不能为空!"); + } + + if (vo.getPrice().doubleValue() < 0D) { + throw new InputErrorException("采购价必须大于0!"); + } + + getBaseMapper().deleteById(vo.getId()); + + CreateProductPurchaseVo createVo = new CreateProductPurchaseVo(); + createVo.setId(vo.getId()); + createVo.setPrice(vo.getPrice()); + + this.create(createVo); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductRetailServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductRetailServiceImpl.java new file mode 100644 index 0000000..965bdfc --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductRetailServiceImpl.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductRetail; +import com.lframework.xingyun.basedata.mappers.ProductRetailMapper; +import com.lframework.xingyun.basedata.service.product.ProductRetailService; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.retail.UpdateProductRetailVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductRetailServiceImpl extends BaseMpServiceImpl + implements ProductRetailService { + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "设置商品零售价,ID:{}, 零售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductRetailVo vo) { + + ProductRetail data = new ProductRetail(); + data.setId(IdUtil.getId()); + if (!StringUtil.isBlank(vo.getId())) { + data.setId(vo.getId()); + } + + data.setPrice(vo.getPrice()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "设置商品零售价,ID:{}, 零售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductRetailVo vo) { + + if (vo.getPrice() == null) { + throw new InputErrorException("零售价不能为空!"); + } + + if (vo.getPrice().doubleValue() < 0D) { + throw new InputErrorException("零售价必须大于0!"); + } + + getBaseMapper().deleteById(vo.getId()); + + CreateProductRetailVo createVo = new CreateProductRetailVo(); + createVo.setId(vo.getId()); + createVo.setPrice(vo.getPrice()); + + this.create(createVo); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductSaleServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductSaleServiceImpl.java new file mode 100644 index 0000000..7b9ccee --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductSaleServiceImpl.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.ProductSale; +import com.lframework.xingyun.basedata.mappers.ProductSaleMapper; +import com.lframework.xingyun.basedata.service.product.ProductSaleService; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import com.lframework.xingyun.basedata.vo.product.sale.UpdateProductSaleVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductSaleServiceImpl extends BaseMpServiceImpl + implements ProductSaleService { + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "设置商品销售价,ID:{}, 销售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductSaleVo vo) { + + ProductSale data = new ProductSale(); + data.setId(IdUtil.getId()); + if (!StringUtil.isBlank(vo.getId())) { + data.setId(vo.getId()); + } + + data.setPrice(vo.getPrice()); + + getBaseMapper().insert(data); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "设置商品销售价,ID:{}, 销售价:{}", params = {"#vo.id", "#vo.price"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductSaleVo vo) { + + if (vo.getPrice() == null) { + throw new InputErrorException("销售价不能为空!"); + } + + if (vo.getPrice().doubleValue() < 0D) { + throw new InputErrorException("销售价必须大于0!"); + } + + getBaseMapper().deleteById(vo.getId()); + + CreateProductSaleVo createVo = new CreateProductSaleVo(); + createVo.setId(vo.getId()); + createVo.setPrice(vo.getPrice()); + + this.create(createVo); + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java new file mode 100644 index 0000000..8705262 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/product/ProductServiceImpl.java @@ -0,0 +1,552 @@ +package com.lframework.xingyun.basedata.impl.product; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.JsonUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.ProductCategoryNodeType; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.mappers.ProductMapper; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyItemService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyRelationService; +import com.lframework.xingyun.basedata.service.product.ProductPropertyService; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductRetailService; +import com.lframework.xingyun.basedata.service.product.ProductSaleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.info.CreateProductVo; +import com.lframework.xingyun.basedata.vo.product.info.ProductPropertyRelationVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo; +import com.lframework.xingyun.basedata.vo.product.property.realtion.CreateProductPropertyRelationVo; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.purchase.UpdateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.retail.UpdateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import com.lframework.xingyun.basedata.vo.product.sale.UpdateProductSaleVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductServiceImpl extends BaseMpServiceImpl implements + ProductService { + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Autowired + private ProductSaleService productSaleService; + + @Autowired + private ProductRetailService productRetailService; + + @Autowired + private RecursionMappingService recursionMappingService; + + @Autowired + private ProductPropertyService productPropertyService; + + @Autowired + private ProductPropertyItemService productPropertyItemService; + + @Autowired + private ProductPropertyRelationService productPropertyRelationService; + + @Autowired + private ProductBundleService productBundleService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + QueryProductSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public Integer queryCount(QueryProductVo vo) { + + return getBaseMapper().queryCount(vo); + } + + @Cacheable(value = Product.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Product findById(String id) { + + return getBaseMapper().selectById(id); + } + + @Override + public List getIdNotInProductProperty(String propertyId) { + + return getBaseMapper().getIdNotInProductProperty(propertyId); + } + + @Override + public List getIdByCategoryId(String categoryId) { + + return getBaseMapper().getIdByCategoryId(categoryId); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用商品,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Product.class) + .set(Product::getAvailable, Boolean.FALSE).in(Product::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用商品,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Product.class) + .set(Product::getAvailable, Boolean.TRUE).in(Product::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增商品,ID:{}, 编号:{}", params = {"#_result", + "#vo.code"}, autoSaveParams = true) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateProductVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(Product.class).eq(Product::getSkuCode, vo.getSkuCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("商品SKU编号重复,请重新输入!"); + } + + Product data = new Product(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (StringUtil.isNotBlank(vo.getShortName())) { + data.setShortName(vo.getShortName()); + } + data.setSkuCode(vo.getSkuCode()); + if (StringUtil.isNotBlank(vo.getExternalCode())) { + data.setExternalCode(vo.getExternalCode()); + } + + data.setBrandId(vo.getBrandId()); + data.setCategoryId(vo.getCategoryId()); + + if (StringUtil.isNotBlank(vo.getSpec())) { + data.setSpec(vo.getSpec()); + } + + if (StringUtil.isNotBlank(vo.getUnit())) { + data.setUnit(vo.getUnit()); + } + + data.setProductType(EnumUtil.getByCode(ProductType.class, vo.getProductType())); + data.setTaxRate(vo.getTaxRate()); + data.setSaleTaxRate(vo.getSaleTaxRate()); + data.setWeight(vo.getWeight()); + data.setVolume(vo.getVolume()); + + data.setAvailable(Boolean.TRUE); + + getBaseMapper().insert(data); + + // 组合商品 + if (data.getProductType() == ProductType.BUNDLE) { + if (CollectionUtil.isEmpty(vo.getProductBundles())) { + throw new DefaultClientException("单品数据不能为空!"); + } + + BigDecimal salePrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getSalePrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getSalePrice(), salePrice)) { + throw new DefaultClientException("单品的销售价设置错误!"); + } + + BigDecimal retailPrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getRetailPrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getRetailPrice(), retailPrice)) { + throw new DefaultClientException("单品的零售价设置错误!"); + } + + List productBundles = vo.getProductBundles().stream().map(productBundleVo -> { + ProductBundle productBundle = new ProductBundle(); + productBundle.setId(IdUtil.getId()); + productBundle.setMainProductId(data.getId()); + productBundle.setProductId(productBundleVo.getProductId()); + productBundle.setBundleNum(productBundleVo.getBundleNum()); + productBundle.setSalePrice(productBundleVo.getSalePrice()); + productBundle.setRetailPrice(productBundleVo.getRetailPrice()); + + return productBundle; + }).collect(Collectors.toList()); + + productBundleService.saveBatch(productBundles); + } + + if (vo.getPurchasePrice() == null) { + throw new DefaultClientException("采购价不能为空!"); + } + + if (vo.getPurchasePrice().doubleValue() < 0D) { + throw new DefaultClientException("采购价不允许小于0!"); + } + + CreateProductPurchaseVo createProductPurchaseVo = new CreateProductPurchaseVo(); + createProductPurchaseVo.setId(data.getId()); + createProductPurchaseVo.setPrice(vo.getPurchasePrice()); + + productPurchaseService.create(createProductPurchaseVo); + + if (vo.getSalePrice() == null) { + throw new DefaultClientException("销售价不能为空!"); + } + + if (vo.getSalePrice().doubleValue() < 0D) { + throw new DefaultClientException("销售价不允许小于0!"); + } + + CreateProductSaleVo createProductSaleVo = new CreateProductSaleVo(); + createProductSaleVo.setId(data.getId()); + createProductSaleVo.setPrice(vo.getSalePrice()); + + productSaleService.create(createProductSaleVo); + + if (vo.getRetailPrice() == null) { + throw new DefaultClientException("零售价不能为空!"); + } + + if (vo.getRetailPrice().doubleValue() < 0D) { + throw new DefaultClientException("零售价不允许小于0!"); + } + + CreateProductRetailVo createProductRetailVo = new CreateProductRetailVo(); + createProductRetailVo.setId(data.getId()); + createProductRetailVo.setPrice(vo.getRetailPrice()); + + productRetailService.create(createProductRetailVo); + + if (!CollectionUtil.isEmpty(vo.getProperties())) { + // 商品和商品属性的关系 + for (ProductPropertyRelationVo property : vo.getProperties()) { + ProductProperty productProperty = productPropertyService.findById(property.getId()); + if (productProperty == null) { + throw new DefaultClientException("商品属性不存在!"); + } + if (productProperty.getColumnType() == ColumnType.SINGLE) { + ProductPropertyItem propertyItem = productPropertyItemService.findById( + property.getText()); + if (propertyItem == null) { + throw new DefaultClientException("商品属性值不存在!"); + } + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItem.getId()); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } else if (productProperty.getColumnType() == ColumnType.MULTIPLE) { + + List propertyItemIds = JsonUtil.parseList(property.getText(), String.class); + for (String propertyItemId : propertyItemIds) { + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItemId); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } + + } else if (productProperty.getColumnType() == ColumnType.CUSTOM) { + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyText(property.getText()); + productPropertyRelationService.create(createProductPropertyRelationVo); + } else { + throw new DefaultClientException("商品属性字段类型不存在!"); + } + } + } + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改商品,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateProductVo vo) { + + Product data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("商品不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, vo.getCode()).ne(Product::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(Product.class).eq(Product::getSkuCode, vo.getSkuCode()) + .ne(Product::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("商品SKU编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Product.class) + .set(Product::getCode, vo.getCode()).set(Product::getName, vo.getName()) + .set(Product::getAvailable, vo.getAvailable()).set(Product::getSkuCode, vo.getSkuCode()) + .set(Product::getExternalCode, + StringUtil.isBlank(vo.getExternalCode()) ? null : vo.getExternalCode()) + .set(Product::getSpec, StringUtil.isBlank(vo.getSpec()) ? null : vo.getSpec()) + .set(Product::getUnit, StringUtil.isBlank(vo.getUnit()) ? null : vo.getUnit()) + .set(Product::getShortName, + StringUtil.isBlank(vo.getShortName()) ? null : vo.getShortName()) + .set(Product::getCategoryId, + StringUtil.isBlank(vo.getCategoryId()) ? null : vo.getCategoryId()) + .set(Product::getBrandId, StringUtil.isBlank(vo.getBrandId()) ? null : vo.getBrandId()) + .set(Product::getTaxRate, vo.getTaxRate()) + .set(Product::getSaleTaxRate, vo.getSaleTaxRate()) + .set(Product::getWeight, vo.getWeight()) + .set(Product::getVolume, vo.getVolume()) + .eq(Product::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + // 组合商品 + if (data.getProductType() == ProductType.BUNDLE) { + if (CollectionUtil.isEmpty(vo.getProductBundles())) { + throw new DefaultClientException("单品数据不能为空!"); + } + + BigDecimal salePrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getSalePrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getSalePrice(), salePrice)) { + throw new DefaultClientException("单品的销售价设置错误!"); + } + + BigDecimal retailPrice = vo.getProductBundles().stream().map( + productBundleVo -> NumberUtil.mul(productBundleVo.getBundleNum(), + productBundleVo.getRetailPrice())).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(vo.getRetailPrice(), retailPrice)) { + throw new DefaultClientException("单品的零售价设置错误!"); + } + + Wrapper deleteBundleWrapper = Wrappers.lambdaQuery(ProductBundle.class) + .eq(ProductBundle::getMainProductId, data.getId()); + productBundleService.remove(deleteBundleWrapper); + + List productBundles = vo.getProductBundles().stream().map(productBundleVo -> { + ProductBundle productBundle = new ProductBundle(); + productBundle.setId(IdUtil.getId()); + productBundle.setMainProductId(data.getId()); + productBundle.setProductId(productBundleVo.getProductId()); + productBundle.setBundleNum(productBundleVo.getBundleNum()); + productBundle.setSalePrice(productBundleVo.getSalePrice()); + productBundle.setRetailPrice(productBundleVo.getRetailPrice()); + + return productBundle; + }).collect(Collectors.toList()); + + productBundleService.saveBatch(productBundles); + } + + productPropertyRelationService.deleteByProductId(data.getId()); + if (!CollectionUtil.isEmpty(vo.getProperties())) { + // 商品和商品属性的关系 + for (ProductPropertyRelationVo property : vo.getProperties()) { + ProductProperty productProperty = productPropertyService.findById(property.getId()); + if (productProperty == null) { + throw new DefaultClientException("商品属性不存在!"); + } + if (productProperty.getColumnType() == ColumnType.SINGLE) { + ProductPropertyItem propertyItem = productPropertyItemService.findById( + property.getText()); + if (propertyItem == null) { + throw new DefaultClientException("商品属性值不存在!"); + } + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItem.getId()); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } else if (productProperty.getColumnType() == ColumnType.MULTIPLE) { + + List propertyItemIds = JsonUtil.parseList(property.getText(), String.class); + for (String propertyItemId : propertyItemIds) { + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyItemId(propertyItemId); + + productPropertyRelationService.create(createProductPropertyRelationVo); + } + + } else if (productProperty.getColumnType() == ColumnType.CUSTOM) { + + CreateProductPropertyRelationVo createProductPropertyRelationVo = new CreateProductPropertyRelationVo(); + createProductPropertyRelationVo.setProductId(data.getId()); + createProductPropertyRelationVo.setPropertyId(productProperty.getId()); + createProductPropertyRelationVo.setPropertyText(property.getText()); + productPropertyRelationService.create(createProductPropertyRelationVo); + } else { + throw new DefaultClientException("商品属性字段类型不存在!"); + } + } + } + + productPurchaseService.removeById(data.getId()); + + if (vo.getPurchasePrice() != null) { + + UpdateProductPurchaseVo updateProductPurchaseVo = new UpdateProductPurchaseVo(); + updateProductPurchaseVo.setId(data.getId()); + updateProductPurchaseVo.setPrice(vo.getPurchasePrice()); + + productPurchaseService.update(updateProductPurchaseVo); + } + + productSaleService.removeById(data.getId()); + + if (vo.getSalePrice() != null) { + UpdateProductSaleVo updateProductSaleVo = new UpdateProductSaleVo(); + updateProductSaleVo.setId(data.getId()); + updateProductSaleVo.setPrice(vo.getSalePrice()); + + productSaleService.update(updateProductSaleVo); + } + + productRetailService.removeById(data.getId()); + if (vo.getRetailPrice() != null) { + UpdateProductRetailVo updateProductRetailVo = new UpdateProductRetailVo(); + updateProductRetailVo.setId(data.getId()); + updateProductRetailVo.setPrice(vo.getRetailPrice()); + + productRetailService.update(updateProductRetailVo); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public List getByCategoryIds(List categoryIds, Integer productType) { + + if (CollectionUtil.isEmpty(categoryIds)) { + return CollectionUtil.emptyList(); + } + + // 根据categoryIds查询所有叶子节点 + List children = new ArrayList<>(); + for (String categoryId : categoryIds) { + children.addAll(recursionMappingService.getNodeChildIds(categoryId, + ApplicationUtil.getBean(ProductCategoryNodeType.class))); + } + + children.addAll(categoryIds); + + children = children.stream().distinct().collect(Collectors.toList()); + + List datas = getBaseMapper().getByCategoryIds(children, productType); + + return datas; + } + + @Override + public List getByBrandIds(List brandIds, Integer productType) { + + if (CollectionUtil.isEmpty(brandIds)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByBrandIds(brandIds, productType); + } + + @CacheEvict(value = Product.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/shop/ShopServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/shop/ShopServiceImpl.java new file mode 100644 index 0000000..161effc --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/shop/ShopServiceImpl.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.basedata.impl.shop; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.mappers.ShopMapper; +import com.lframework.xingyun.basedata.service.shop.ShopService; +import com.lframework.xingyun.basedata.vo.shop.CreateShopVo; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import com.lframework.xingyun.basedata.vo.shop.UpdateShopVo; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ShopServiceImpl extends BaseMpServiceImpl implements ShopService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryShopVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryShopVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Shop.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Shop findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增门店,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateShopVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Shop.class).eq(Shop::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Shop data = new Shop(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getDeptId())) { + data.setDeptId(vo.getDeptId()); + } + if (vo.getLng() != null) { + data.setLng(vo.getLng()); + } + if (vo.getLat() != null) { + data.setLat(vo.getLat()); + } + if (!StringUtil.isBlank(vo.getDescription())) { + data.setDescription(vo.getDescription()); + } + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改门店,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateShopVo vo) { + + Shop data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("门店不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Shop.class).eq(Shop::getCode, vo.getCode()) + .ne(Shop::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Shop.class) + .set(Shop::getCode, vo.getCode()) + .set(Shop::getName, vo.getName()) + .set(Shop::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId()) + .set(Shop::getLng, vo.getLng() == null ? null : vo.getLng()) + .set(Shop::getLat, vo.getLat() == null ? null : vo.getLat()) + .set(Shop::getAvailable, vo.getAvailable()) + .set(Shop::getDescription, + StringUtil.isBlank(vo.getDescription()) ? null : vo.getDescription()) + .eq(Shop::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = Shop.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/storecenter/StoreCenterServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/storecenter/StoreCenterServiceImpl.java new file mode 100644 index 0000000..43ec42e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/storecenter/StoreCenterServiceImpl.java @@ -0,0 +1,213 @@ +package com.lframework.xingyun.basedata.impl.storecenter; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.mappers.StoreCenterMapper; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.vo.storecenter.CreateStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.UpdateStoreCenterVo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class StoreCenterServiceImpl extends BaseMpServiceImpl + implements StoreCenterService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryStoreCenterVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = StoreCenter.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public StoreCenter findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用仓库,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StoreCenter.class) + .set(StoreCenter::getAvailable, Boolean.FALSE).in(StoreCenter::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用仓库,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StoreCenter.class) + .set(StoreCenter::getAvailable, Boolean.TRUE).in(StoreCenter::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增仓库,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateStoreCenterVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + StoreCenter data = new StoreCenter(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + data.setAvailable(Boolean.TRUE); + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + + if (vo.getPeopleNum() != null) { + if (vo.getPeopleNum() < 0) { + throw new InputErrorException("仓库人数不允许小于0!"); + } + data.setPeopleNum(vo.getPeopleNum()); + } + + data.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改仓库,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateStoreCenterVo vo) { + + StoreCenter data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, vo.getCode()).ne(StoreCenter::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(StoreCenter.class) + .set(StoreCenter::getCode, vo.getCode()).set(StoreCenter::getName, vo.getName()) + .set(StoreCenter::getContact, !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(StoreCenter::getTelephone, !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(StoreCenter::getAvailable, vo.getAvailable()) + .set(StoreCenter::getAddress, !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(StoreCenter::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(StoreCenter::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(StoreCenter::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(StoreCenter::getCityId, null); + } + + if (vo.getPeopleNum() != null) { + if (vo.getPeopleNum() < 0) { + throw new InputErrorException("仓库人数不允许小于0!"); + } + updateWrapper.set(StoreCenter::getPeopleNum, vo.getPeopleNum()); + } else { + updateWrapper.set(StoreCenter::getPeopleNum, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, QueryStoreCenterSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = StoreCenter.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/supplier/SupplierServiceImpl.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/supplier/SupplierServiceImpl.java new file mode 100644 index 0000000..1dfa6ad --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/impl/supplier/SupplierServiceImpl.java @@ -0,0 +1,246 @@ +package com.lframework.xingyun.basedata.impl.supplier; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.basedata.enums.BaseDataOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.mappers.SupplierMapper; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.basedata.vo.supplier.CreateSupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.UpdateSupplierVo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SupplierServiceImpl extends BaseMpServiceImpl implements + SupplierService { + + @Autowired + private DicCityService dicCityService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySupplierVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySupplierVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = Supplier.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public Supplier findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "停用供应商,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Supplier.class) + .set(Supplier::getAvailable, Boolean.FALSE).in(Supplier::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "启用供应商,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(Supplier.class) + .set(Supplier::getAvailable, Boolean.TRUE).in(Supplier::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "新增供应商,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSupplierVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(Supplier.class).eq(Supplier::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Supplier data = new Supplier(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getMnemonicCode())) { + data.setMnemonicCode(vo.getMnemonicCode()); + } + if (!StringUtil.isBlank(vo.getContact())) { + data.setContact(vo.getContact()); + } + if (!StringUtil.isBlank(vo.getTelephone())) { + data.setTelephone(vo.getTelephone()); + } + if (!StringUtil.isBlank(vo.getEmail())) { + data.setEmail(vo.getEmail()); + } + if (!StringUtil.isBlank(vo.getZipCode())) { + data.setZipCode(vo.getZipCode()); + } + if (!StringUtil.isBlank(vo.getFax())) { + data.setFax(vo.getFax()); + } + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + data.setCityId(vo.getCityId()); + } + } + if (!StringUtil.isBlank(vo.getAddress())) { + data.setAddress(vo.getAddress()); + } + if (vo.getDeliveryCycle() != null) { + data.setDeliveryCycle(vo.getDeliveryCycle()); + } + data.setManageType(EnumUtil.getByCode(ManageType.class, vo.getManageType())); + + data.setSettleType(EnumUtil.getByCode(SettleType.class, vo.getSettleType())); + + if (!StringUtil.isBlank(vo.getCreditCode())) { + data.setCreditCode(vo.getCreditCode()); + } + if (!StringUtil.isBlank(vo.getTaxIdentifyNo())) { + data.setTaxIdentifyNo(vo.getTaxIdentifyNo()); + } + if (!StringUtil.isBlank(vo.getBankName())) { + data.setBankName(vo.getBankName()); + } + if (!StringUtil.isBlank(vo.getAccountName())) { + data.setAccountName(vo.getAccountName()); + } + if (!StringUtil.isBlank(vo.getAccountNo())) { + data.setAccountNo(vo.getAccountNo()); + } + data.setAvailable(Boolean.TRUE); + data.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = BaseDataOpLogType.BASE_DATA, name = "修改供应商,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSupplierVo vo) { + + Supplier data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("供应商不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(Supplier.class).eq(Supplier::getCode, vo.getCode()) + .ne(Supplier::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Supplier.class) + .set(Supplier::getCode, vo.getCode()).set(Supplier::getName, vo.getName()) + .set(Supplier::getMnemonicCode, !StringUtil.isBlank(vo.getMnemonicCode()) ? vo.getMnemonicCode() : null) + .set(Supplier::getContact, !StringUtil.isBlank(vo.getContact()) ? vo.getContact() : null) + .set(Supplier::getTelephone, !StringUtil.isBlank(vo.getTelephone()) ? vo.getTelephone() : null) + .set(Supplier::getEmail, !StringUtil.isBlank(vo.getEmail()) ? vo.getEmail() : null) + .set(Supplier::getZipCode, !StringUtil.isBlank(vo.getZipCode()) ? vo.getZipCode() : null) + .set(Supplier::getFax, !StringUtil.isBlank(vo.getFax()) ? vo.getFax() : null) + .set(Supplier::getAddress, !StringUtil.isBlank(vo.getAddress()) ? vo.getAddress() : null) + .set(Supplier::getDeliveryCycle, vo.getDeliveryCycle()) + .set(Supplier::getCreditCode, !StringUtil.isBlank(vo.getCreditCode()) ? vo.getCreditCode() : null) + .set(Supplier::getTaxIdentifyNo, + !StringUtil.isBlank(vo.getTaxIdentifyNo()) ? vo.getTaxIdentifyNo() : null) + .set(Supplier::getBankName, !StringUtil.isBlank(vo.getBankName()) ? vo.getBankName() : null) + .set(Supplier::getAccountName, !StringUtil.isBlank(vo.getAccountName()) ? vo.getAccountName() : null) + .set(Supplier::getAccountNo, !StringUtil.isBlank(vo.getAccountNo()) ? vo.getAccountNo() : null) + .set(Supplier::getAvailable, vo.getAvailable()).set(Supplier::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(Supplier::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getCityId())) { + DicCityDto city = dicCityService.findById(vo.getCityId()); + if (!ObjectUtil.isNull(city)) { + updateWrapper.set(Supplier::getCityId, vo.getCityId()); + } + } else { + updateWrapper.set(Supplier::getCityId, null); + } + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, QuerySupplierSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @CacheEvict(value = Supplier.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AddressMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AddressMapper.java new file mode 100644 index 0000000..2112480 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AddressMapper.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2023-03-26 + */ +public interface AddressMapper extends BaseMapper
{ + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "createTime", alias = "tb", autoParse = true) + }) + List
query(@Param("vo") QueryAddressVo vo); + + /** + * 选择器 + * + * @return + */ + List
selector(@Param("vo") AddressSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CustomerMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CustomerMapper.java new file mode 100644 index 0000000..b860b68 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/CustomerMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-10 + */ +public interface CustomerMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryCustomerVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryCustomerSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/LogisticsCompanyMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/LogisticsCompanyMapper.java new file mode 100644 index 0000000..03b94e0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/LogisticsCompanyMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 物流公司 Mapper 接口 + *

+ * + * @author zmj + * @since 2023-06-02 + */ +public interface LogisticsCompanyMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryLogisticsCompanyVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryLogisticsCompanySelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/MemberMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/MemberMapper.java new file mode 100644 index 0000000..6bfdd72 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/MemberMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface MemberMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryMemberVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryMemberSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PayTypeMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PayTypeMapper.java new file mode 100644 index 0000000..b2de9a9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/PayTypeMapper.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface PayTypeMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryPayTypeVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") PayTypeSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBrandMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBrandMapper.java new file mode 100644 index 0000000..b102495 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBrandMapper.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-06 + */ +public interface ProductBrandMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + }) + List query(@Param("vo") QueryProductBrandVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryProductBrandSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBundleMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBundleMapper.java new file mode 100644 index 0000000..87a0e7b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductBundleMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductBundle; + +/** + *

+ * 组合商品 Mapper 接口 + *

+ * + * @author zmj + * @since 2023-05-26 + */ +public interface ProductBundleMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryMapper.java new file mode 100644 index 0000000..15bea9a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-05 + */ +public interface ProductCategoryMapper extends BaseMapper { + + /** + * 查询全部类目信息 + * + * @return + */ + List getAllProductCategories(); + + /** + * 选择器 + * + * @return + */ + List selector(@Param("vo") QueryProductCategorySelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryPropertyMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryPropertyMapper.java new file mode 100644 index 0000000..5608fbf --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductCategoryPropertyMapper.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-05 + */ +public interface ProductCategoryPropertyMapper extends BaseMapper { + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductMapper.java new file mode 100644 index 0000000..fd6dab8 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductMapper.java @@ -0,0 +1,106 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + @Sorts({ + @Sort(value = "code", alias = "g", autoParse = true), + @Sort(value = "name", alias = "g", autoParse = true), + @Sort(value = "createTime", alias = "g", autoParse = true), + @Sort(value = "updateTime", alias = "g", autoParse = true), + }) + List query(@Param("vo") QueryProductVo vo); + + /** + * 查询商品品种数 + * + * @param vo + * @return + */ + Integer queryCount(@Param("vo") QueryProductVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List selector(@Param("vo") QueryProductSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Product findById(String id); + + /** + * 查询没有属性的ID + * + * @param propertyId + * @return + */ + List getIdNotInProductProperty(String propertyId); + + /** + * 根据类目ID查询 + * + * @param categoryId + * @return + */ + List getIdByCategoryId(String categoryId); + + /** + * 根据类目ID查询 + * + * @param categoryIds + * @return + */ + List getByCategoryIds(@Param("categoryIds") List categoryIds, + @Param("productType") Integer productType); + + /** + * 根据品牌ID查询 + * + * @param brandIds + * @return + */ + List getByBrandIds(@Param("brandIds") List brandIds, + @Param("productType") Integer productType); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyItemMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyItemMapper.java new file mode 100644 index 0000000..c033362 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyItemMapper.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-08-08 + */ +public interface ProductPropertyItemMapper extends BaseMapper { + + /** + * 查询里诶包 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryProductPropertyItemVo vo); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyMapper.java new file mode 100644 index 0000000..c7b778e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyMapper.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.Collection; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductPropertyMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "p", autoParse = true), + @Sort(value = "name", alias = "p", autoParse = true), + }) + List query(@Param("vo") QueryProductPropertyVo vo); + + /** + * 根据商品类目查询 + * + * @param categoryIds + * @return + */ + List getModelorByCategoryId(@Param("categoryIds") Collection categoryIds); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyRelationMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyRelationMapper.java new file mode 100644 index 0000000..c5bdcc1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPropertyRelationMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-08-05 + */ +public interface ProductPropertyRelationMapper extends BaseMapper { + + /** + * 根据商品ID查询 + * + * @param productId + * @return + */ + List getByProductId(String productId); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); + + /** + * 将通用更改为指定类目 + * + * @param propertyId + * @param categoryId + */ + void setCommonToAppoint(@Param("propertyId") String propertyId, @Param("categoryId") String categoryId); + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPurchaseMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPurchaseMapper.java new file mode 100644 index 0000000..44e4ea9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductPurchaseMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductPurchase; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductPurchaseMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductRetailMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductRetailMapper.java new file mode 100644 index 0000000..d10e429 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductRetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductRetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductRetailMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductSaleMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductSaleMapper.java new file mode 100644 index 0000000..a9df969 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ProductSaleMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.ProductSale; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface ProductSaleMapper extends BaseMapper { + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ShopMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ShopMapper.java new file mode 100644 index 0000000..5fa16d9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/ShopMapper.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 门店 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ShopMapper extends BaseMapper { + + /** + * 查询列表 + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryShopVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/StoreCenterMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/StoreCenterMapper.java new file mode 100644 index 0000000..c4582f9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/StoreCenterMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-07 + */ +public interface StoreCenterMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QueryStoreCenterVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QueryStoreCenterSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/SupplierMapper.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/SupplierMapper.java new file mode 100644 index 0000000..89419e9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/SupplierMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-11 + */ +public interface SupplierMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QuerySupplierVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") QuerySupplierSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/address/AddressService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/address/AddressService.java new file mode 100644 index 0000000..0958d5a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/address/AddressService.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.basedata.service.address; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Address; +import com.lframework.xingyun.basedata.vo.address.AddressSelectorVo; +import com.lframework.xingyun.basedata.vo.address.CreateAddressVo; +import com.lframework.xingyun.basedata.vo.address.QueryAddressVo; +import com.lframework.xingyun.basedata.vo.address.UpdateAddressVo; +import java.util.List; + +/** + * 地址库 Service + * + * @author zmj + */ +public interface AddressService extends BaseMpService
{ + + /** + * 查询列表 + * + * @return + */ + PageResult
query(Integer pageIndex, Integer pageSize, QueryAddressVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List
query(QueryAddressVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult
selector(Integer pageIndex, Integer pageSize, + AddressSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Address findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateAddressVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateAddressVo vo); + + /** + * 查询默认地址 + * + * @param entityId + * @param entityType + * @param addressType + * @return + */ + Address getDefaultAddress(String entityId, Integer entityType, Integer addressType); + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/customer/CustomerService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/customer/CustomerService.java new file mode 100644 index 0000000..3ea471d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/customer/CustomerService.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.basedata.service.customer; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.vo.customer.CreateCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerSelectorVo; +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; +import com.lframework.xingyun.basedata.vo.customer.UpdateCustomerVo; +import java.util.Collection; +import java.util.List; + +public interface CustomerService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryCustomerVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Customer findById(String id); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryCustomerSelectorVo vo); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/logistics/LogisticsCompanyService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/logistics/LogisticsCompanyService.java new file mode 100644 index 0000000..2837874 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/logistics/LogisticsCompanyService.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.basedata.service.logistics; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.vo.logistics.company.CreateLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanySelectorVo; +import com.lframework.xingyun.basedata.vo.logistics.company.QueryLogisticsCompanyVo; +import com.lframework.xingyun.basedata.vo.logistics.company.UpdateLogisticsCompanyVo; +import java.util.Collection; +import java.util.List; + +public interface LogisticsCompanyService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanyVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryLogisticsCompanyVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + LogisticsCompany findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateLogisticsCompanyVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateLogisticsCompanyVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + QueryLogisticsCompanySelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/member/MemberService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/member/MemberService.java new file mode 100644 index 0000000..684c95a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/member/MemberService.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.basedata.service.member; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.vo.member.CreateMemberVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberSelectorVo; +import com.lframework.xingyun.basedata.vo.member.QueryMemberVo; +import com.lframework.xingyun.basedata.vo.member.UpdateMemberVo; +import java.util.Collection; +import java.util.List; + +public interface MemberService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryMemberVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryMemberVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Member findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateMemberVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateMemberVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryMemberSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/paytype/PayTypeService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/paytype/PayTypeService.java new file mode 100644 index 0000000..1821fbf --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/paytype/PayTypeService.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.basedata.service.paytype; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.vo.paytype.CreatePayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.PayTypeSelectorVo; +import com.lframework.xingyun.basedata.vo.paytype.QueryPayTypeVo; +import com.lframework.xingyun.basedata.vo.paytype.UpdatePayTypeVo; +import java.util.List; + +public interface PayTypeService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryPayTypeVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPayTypeVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + PayTypeSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PayType findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreatePayTypeVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePayTypeVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBrandService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBrandService.java new file mode 100644 index 0000000..2395681 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBrandService.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.vo.product.brand.CreateProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandSelectorVo; +import com.lframework.xingyun.basedata.vo.product.brand.QueryProductBrandVo; +import com.lframework.xingyun.basedata.vo.product.brand.UpdateProductBrandVo; +import java.util.Collection; +import java.util.List; + +public interface ProductBrandService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductBrandVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductBrandVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + QueryProductBrandSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductBrand findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductBrandVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductBrandVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBundleService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBundleService.java new file mode 100644 index 0000000..92747c2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductBundleService.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import java.util.List; + +public interface ProductBundleService extends BaseMpService { + + /** + * 根据组合商品ID查询 + * @param id + * @return + */ + List getByMainProductId(String id); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryPropertyService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryPropertyService.java new file mode 100644 index 0000000..cea80a9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryPropertyService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductCategoryProperty; +import java.util.List; + +public interface ProductCategoryPropertyService extends BaseMpService { + + /** + * 创建 + * + * @param categoryId + * @param propertyId + * @return + */ + String create(String categoryId, String propertyId); + + /** + * 根据属性ID删除 + * + * @param propertyId + */ + void deleteByPropertyId(String propertyId); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryService.java new file mode 100644 index 0000000..ca2f418 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductCategoryService.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.vo.product.category.CreateProductCategoryVo; +import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo; +import com.lframework.xingyun.basedata.vo.product.category.UpdateProductCategoryVo; +import java.util.Collection; +import java.util.List; + +public interface ProductCategoryService extends BaseMpService { + + /** + * 查询全部类目信息 + * + * @return + */ + List getAllProductCategories(); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductCategory findById(String id); + + /** + * 选择器 + * + * @return + */ + List selector(QueryProductCategorySelectorVo vo); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductCategoryVo vo); + + /** + * 保存关系 + * + * @param categoryId + * @param parentId + */ + void saveRecursion(String categoryId, String parentId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyItemService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyItemService.java new file mode 100644 index 0000000..22b0e72 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyItemService.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductPropertyItem; +import com.lframework.xingyun.basedata.vo.product.property.item.CreateProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.QueryProductPropertyItemVo; +import com.lframework.xingyun.basedata.vo.product.property.item.UpdateProductPropertyItemVo; +import java.util.List; + +public interface ProductPropertyItemService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductPropertyItemVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductPropertyItemVo vo); + + /** + * 根据属性ID查询 + * + * @param propertyId + * @return + */ + List getByPropertyId(String propertyId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductPropertyItem findById(String id); + + /** + * 新增 + * + * @param vo + * @return + */ + String create(CreateProductPropertyItemVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductPropertyItemVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyRelationService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyRelationService.java new file mode 100644 index 0000000..c91bb45 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyRelationService.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.dto.product.ProductPropertyRelationDto; +import com.lframework.xingyun.basedata.entity.ProductPropertyRelation; +import com.lframework.xingyun.basedata.vo.product.property.realtion.CreateProductPropertyRelationVo; +import java.util.List; + +public interface ProductPropertyRelationService extends BaseMpService { + + /** + * 根据商品Id查询 + * + * @param productId + * @return + */ + List getByProductId(String productId); + + /** + * 将多选属性更改为单选属性 + * + * @param propertyId + */ + void setMultipleToSimple(String propertyId); + + /** + * 从通用改为指定类目 + * + * @param propertyId + */ + void setCommonToAppoint(String propertyId); + + /** + * 从指定类目改为通用 + * + * @param propertyId + */ + void setAppointToCommon(String propertyId); + + /** + * 修改指定类目的类目ID + * + * @param propertyId + */ + void updateAppointCategoryId(String propertyId); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductPropertyRelationVo vo); + + /** + * 根据商品Id删除 + * + * @param productId + */ + void deleteByProductId(String productId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyService.java new file mode 100644 index 0000000..742b7c3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPropertyService.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.dto.product.property.ProductPropertyModelorDto; +import com.lframework.xingyun.basedata.entity.ProductProperty; +import com.lframework.xingyun.basedata.vo.product.property.CreateProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.QueryProductPropertyVo; +import com.lframework.xingyun.basedata.vo.product.property.UpdateProductPropertyVo; +import java.util.Collection; +import java.util.List; + +public interface ProductPropertyService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductPropertyVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductPropertyVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ProductProperty findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductPropertyVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductPropertyVo vo); + + /** + * 根据类目ID查询 + * + * @param categoryId + * @return + */ + List getModelorByCategoryId(String categoryId); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPurchaseService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPurchaseService.java new file mode 100644 index 0000000..5e512ad --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductPurchaseService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.vo.product.purchase.CreateProductPurchaseVo; +import com.lframework.xingyun.basedata.vo.product.purchase.UpdateProductPurchaseVo; + +public interface ProductPurchaseService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductPurchaseVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductPurchaseVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductRetailService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductRetailService.java new file mode 100644 index 0000000..39f0c1b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductRetailService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductRetail; +import com.lframework.xingyun.basedata.vo.product.retail.CreateProductRetailVo; +import com.lframework.xingyun.basedata.vo.product.retail.UpdateProductRetailVo; + +public interface ProductRetailService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductRetailVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductRetailVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductSaleService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductSaleService.java new file mode 100644 index 0000000..f4ee2a6 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductSaleService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.ProductSale; +import com.lframework.xingyun.basedata.vo.product.sale.CreateProductSaleVo; +import com.lframework.xingyun.basedata.vo.product.sale.UpdateProductSaleVo; + +public interface ProductSaleService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductSaleVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductSaleVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java new file mode 100644 index 0000000..4c9d4d3 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/product/ProductService.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.basedata.service.product; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.vo.product.info.CreateProductVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductSelectorVo; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.basedata.vo.product.info.UpdateProductVo; +import java.util.Collection; +import java.util.List; + +public interface ProductService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryProductSelectorVo vo); + + /** + * 查询商品品种数 + * + * @param vo + * @return + */ + Integer queryCount(QueryProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Product findById(String id); + + /** + * 查询没有属性的ID + * + * @param propertyId + * @return + */ + List getIdNotInProductProperty(String propertyId); + + /** + * 根据类目ID查询 + * + * @param categoryId + * @return + */ + List getIdByCategoryId(String categoryId); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateProductVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateProductVo vo); + + /** + * 根据类目ID查询 + * + * @param categoryIds + * @return + */ + List getByCategoryIds(List categoryIds, Integer productType); + + /** + * 根据品牌ID查询 + * + * @param brandIds + * @return + */ + List getByBrandIds(List brandIds, Integer productType); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/shop/ShopService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/shop/ShopService.java new file mode 100644 index 0000000..21a8c61 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/shop/ShopService.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.basedata.service.shop; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Shop; +import com.lframework.xingyun.basedata.vo.shop.CreateShopVo; +import com.lframework.xingyun.basedata.vo.shop.QueryShopVo; +import com.lframework.xingyun.basedata.vo.shop.UpdateShopVo; +import java.util.List; + +/** + * 门店 Service + * + * @author zmj + */ +public interface ShopService extends BaseMpService { + + /** + * 查询列表 + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryShopVo vo); + + /** + * 查询列表 + * @param vo + * @return + */ + List query(QueryShopVo vo); + + /** + * 根据ID查询 + * @param id + * @return + */ + Shop findById(String id); + + /** + * 创建 + * @param vo + * @return + */ + String create(CreateShopVo vo); + + /** + * 修改 + * @param vo + */ + void update(UpdateShopVo vo); + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/storecenter/StoreCenterService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/storecenter/StoreCenterService.java new file mode 100644 index 0000000..9887430 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/storecenter/StoreCenterService.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.basedata.service.storecenter; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.vo.storecenter.CreateStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterSelectorVo; +import com.lframework.xingyun.basedata.vo.storecenter.QueryStoreCenterVo; +import com.lframework.xingyun.basedata.vo.storecenter.UpdateStoreCenterVo; +import java.util.Collection; + +public interface StoreCenterService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryStoreCenterVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StoreCenter findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateStoreCenterVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateStoreCenterVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QueryStoreCenterSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/supplier/SupplierService.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/supplier/SupplierService.java new file mode 100644 index 0000000..ea7490e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/service/supplier/SupplierService.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.basedata.service.supplier; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.vo.supplier.CreateSupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierSelectorVo; +import com.lframework.xingyun.basedata.vo.supplier.QuerySupplierVo; +import com.lframework.xingyun.basedata.vo.supplier.UpdateSupplierVo; +import java.util.Collection; +import java.util.List; + +public interface SupplierService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySupplierVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySupplierVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Supplier findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSupplierVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSupplierVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, QuerySupplierSelectorVo vo); +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/AddressSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/AddressSelectorVo.java new file mode 100644 index 0000000..42be251 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/AddressSelectorVo.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class AddressSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 实体ID + */ + @ApiModelProperty("实体ID") + private String entityId; + + /** + * 实体类型 + */ + @ApiModelProperty("实体类型") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @ApiModelProperty("地址类型") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String telephone; + + /** + * 详细地址 + */ + @ApiModelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ApiModelProperty("是否默认地址") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/CreateAddressVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/CreateAddressVo.java new file mode 100644 index 0000000..ab70aa0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/CreateAddressVo.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateAddressVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 实体ID + */ + @ApiModelProperty(value = "实体ID", required = true) + @NotBlank(message = "实体ID不能为空!") + private String entityId; + + /** + * 实体类型 + */ + @ApiModelProperty(value = "实体类型", required = true) + @NotNull(message = "实体类型不能为空!") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @ApiModelProperty(value = "地址类型", required = true) + @NotNull(message = "地址类型不能为空!") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty(value = "姓名", required = true) + @NotBlank(message = "姓名不能为空!") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号", required = true) + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区ID", required = true) + @NotBlank(message = "地区ID不能为空!") + private String cityId; + + /** + * 详细地址 + */ + @ApiModelProperty(value = "详细地址", required = true) + @NotBlank(message = "详细地址不能为空!") + private String address; + + /** + * 是否默认地址 + */ + @ApiModelProperty(value = "是否默认地址", required = true) + @NotNull(message = "是否默认地址不能为空!") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/QueryAddressVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/QueryAddressVo.java new file mode 100644 index 0000000..ea0558d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/QueryAddressVo.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryAddressVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 实体类型 + */ + @ApiModelProperty("实体类型") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @ApiModelProperty("地址类型") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String telephone; + + /** + * 详细地址 + */ + @ApiModelProperty("详细地址") + private String address; + + /** + * 是否默认地址 + */ + @ApiModelProperty("是否默认地址") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/UpdateAddressVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/UpdateAddressVo.java new file mode 100644 index 0000000..cbff811 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/address/UpdateAddressVo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.basedata.vo.address; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.AddressEntityType; +import com.lframework.xingyun.basedata.enums.AddressType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateAddressVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 实体ID + */ + @ApiModelProperty(value = "实体ID", required = true) + @NotBlank(message = "实体ID不能为空!") + private String entityId; + + /** + * 实体类型 + */ + @ApiModelProperty(value = "实体类型", required = true) + @NotNull(message = "实体类型不能为空!") + @IsEnum(message = "实体类型格式错误!", enumClass = AddressEntityType.class) + private Integer entityType; + + /** + * 地址类型 + */ + @ApiModelProperty(value = "地址类型", required = true) + @NotNull(message = "地址类型不能为空!") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty(value = "姓名", required = true) + @NotBlank(message = "姓名不能为空!") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号", required = true) + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区ID", required = true) + @NotBlank(message = "地区ID不能为空!") + private String cityId; + + /** + * 详细地址 + */ + @ApiModelProperty(value = "详细地址", required = true) + @NotBlank(message = "详细地址不能为空!") + private String address; + + /** + * 是否默认地址 + */ + @ApiModelProperty(value = "是否默认地址", required = true) + @NotNull(message = "是否默认地址不能为空!") + private Boolean isDefault; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/CreateCustomerVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/CreateCustomerVo.java new file mode 100644 index 0000000..a4646d1 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/CreateCustomerVo.java @@ -0,0 +1,127 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.SettleType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateCustomerVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 助记码 + */ + @ApiModelProperty(value = "助记码", required = true) + @NotBlank(message = "请输入助记码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @ApiModelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ApiModelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 结账方式 + */ + @ApiModelProperty(value = "结账方式", required = true) + @NotNull(message = "请选择结账方式!") + @IsEnum(message = "请选择结账方式!", enumClass = SettleType.class) + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ApiModelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ApiModelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ApiModelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ApiModelProperty("银行账号") + private String accountNo; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerSelectorVo.java new file mode 100644 index 0000000..f3cb9ff --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryCustomerSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerVo.java new file mode 100644 index 0000000..8196419 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/QueryCustomerVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryCustomerVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/UpdateCustomerVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/UpdateCustomerVo.java new file mode 100644 index 0000000..fe42f59 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/customer/UpdateCustomerVo.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.basedata.vo.customer; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 助记码 + */ + @ApiModelProperty(value = "助记码", required = true) + @NotBlank(message = "请输入助记码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @ApiModelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ApiModelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ApiModelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ApiModelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ApiModelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ApiModelProperty("银行账号") + private String accountNo; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/CreateLogisticsCompanyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/CreateLogisticsCompanyVo.java new file mode 100644 index 0000000..d556f3b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/CreateLogisticsCompanyVo.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateLogisticsCompanyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanySelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanySelectorVo.java new file mode 100644 index 0000000..7fac9d2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanySelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryLogisticsCompanySelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanyVo.java new file mode 100644 index 0000000..866d553 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/QueryLogisticsCompanyVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryLogisticsCompanyVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/UpdateLogisticsCompanyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/UpdateLogisticsCompanyVo.java new file mode 100644 index 0000000..6009bb9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/logistics/company/UpdateLogisticsCompanyVo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.basedata.vo.logistics.company; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateLogisticsCompanyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/CreateMemberVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/CreateMemberVo.java new file mode 100644 index 0000000..bc555fb --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/CreateMemberVo.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.xingyun.template.core.enums.Gender; +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateMemberVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 性别 + */ + @ApiModelProperty(value = "性别", required = true) + @NotNull(message = "请选择性别!") + @IsEnum(message = "请选择性别!", enumClass = Gender.class) + private Integer gender; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 出生日期 + */ + @ApiModelProperty("出生日期") + private LocalDate birthday; + + + /** + * 入会日期 + */ + @ApiModelProperty(value = "入会日期", required = true) + @NotNull(message = "入会日期不能为空!") + private LocalDate joinDay; + + /** + * 所属门店ID + */ + @ApiModelProperty("所属门店ID") + private String shopId; + + /** + * 所属导购ID + */ + @ApiModelProperty("所属导购ID") + private String guiderId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberSelectorVo.java new file mode 100644 index 0000000..a6a94a2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryMemberSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberVo.java new file mode 100644 index 0000000..5273d2b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/QueryMemberVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryMemberVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/UpdateMemberVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/UpdateMemberVo.java new file mode 100644 index 0000000..7556301 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/member/UpdateMemberVo.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.basedata.vo.member; + +import com.lframework.xingyun.template.core.enums.Gender; +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateMemberVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 性别 + */ + @ApiModelProperty(value = "性别", required = true) + @NotNull(message = "请选择性别!") + @IsEnum(message = "请选择性别!", enumClass = Gender.class) + private Integer gender; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 出生日期 + */ + @ApiModelProperty("出生日期") + private LocalDate birthday; + + /** + * 入会日期 + */ + @ApiModelProperty(value = "入会日期", required = true) + @NotNull(message = "入会日期不能为空!") + private LocalDate joinDay; + + /** + * 所属门店ID + */ + @ApiModelProperty("所属门店ID") + private String shopId; + + /** + * 所属导购ID + */ + @ApiModelProperty("所属导购ID") + private String guiderId; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/CreatePayTypeVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/CreatePayTypeVo.java new file mode 100644 index 0000000..b86cc17 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/CreatePayTypeVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreatePayTypeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否记录内容 + */ + @ApiModelProperty(value = "是否记录内容", required = true) + @NotNull(message = "是否记录内容不能为空!") + private Boolean recText; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/PayTypeSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/PayTypeSelectorVo.java new file mode 100644 index 0000000..3eca80a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/PayTypeSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class PayTypeSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/QueryPayTypeVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/QueryPayTypeVo.java new file mode 100644 index 0000000..3249420 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/QueryPayTypeVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryPayTypeVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/UpdatePayTypeVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/UpdatePayTypeVo.java new file mode 100644 index 0000000..b652eee --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/paytype/UpdatePayTypeVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.basedata.vo.paytype; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdatePayTypeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否记录内容 + */ + @ApiModelProperty(value = "是否记录内容", required = true) + @NotNull(message = "是否记录内容不能为空!") + private Boolean recText; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/CreateProductBrandVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/CreateProductBrandVo.java new file mode 100644 index 0000000..6ac4b5c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/CreateProductBrandVo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.UploadUrl; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateProductBrandVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * logo + */ + @ApiModelProperty("logo") + @UploadUrl(message = "logo文件格式有误!") + private String logo; + + /** + * 简介 + */ + @ApiModelProperty("简介") + private String introduction; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandSelectorVo.java new file mode 100644 index 0000000..df1afba --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductBrandSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandVo.java new file mode 100644 index 0000000..cb86e1e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/QueryProductBrandVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductBrandVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/UpdateProductBrandVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/UpdateProductBrandVo.java new file mode 100644 index 0000000..19367d5 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/brand/UpdateProductBrandVo.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.basedata.vo.product.brand; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.UploadUrl; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductBrandVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * logo + */ + @ApiModelProperty("logo") + @UploadUrl(message = "logo文件格式有误!") + private String logo; + + /** + * 简介 + */ + @ApiModelProperty("简介") + private String introduction; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/CreateProductCategoryVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/CreateProductCategoryVo.java new file mode 100644 index 0000000..27fa649 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/CreateProductCategoryVo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.basedata.vo.product.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateProductCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "编号不能为空!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/QueryProductCategorySelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/QueryProductCategorySelectorVo.java new file mode 100644 index 0000000..89b1cd4 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/QueryProductCategorySelectorVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.basedata.vo.product.category; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductCategorySelectorVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/UpdateProductCategoryVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/UpdateProductCategoryVo.java new file mode 100644 index 0000000..a00871d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/category/UpdateProductCategoryVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.vo.product.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "编号不能为空!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/CreateProductVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/CreateProductVo.java new file mode 100644 index 0000000..5debcde --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/CreateProductVo.java @@ -0,0 +1,154 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @ApiModelProperty(value = "简称") + private String shortName; + + /** + * 商品SKU编号 + */ + @ApiModelProperty(value = "商品SKU编号", required = true) + @NotBlank(message = "商品SKU编号不能为空!") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + @NotBlank(message = "类目ID不能为空!") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + @NotBlank(message = "品牌ID不能为空!") + private String brandId; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 进项税率(%) + */ + @ApiModelProperty(value = "进项税率(%)") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "进项税率(%)必须为整数!") + private BigDecimal taxRate = BigDecimal.ZERO; + + /** + * 销项税率(%) + */ + @ApiModelProperty(value = "销项税率(%)") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "销项税率(%)必须为整数!") + private BigDecimal saleTaxRate = BigDecimal.ZERO; + + /** + * 商品类型 + */ + @ApiModelProperty(value = "商品类型", required = true) + @NotNull(message = "商品类型不能为空!") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; + + /** + * 重量(kg) + */ + @ApiModelProperty(value = "重量(kg)") + @Digits(integer = 10, fraction = 2, message = "重量最多允许2位小数!") + private BigDecimal weight; + + /** + * 体积(cm3) + */ + @ApiModelProperty(value = "体积(cm3)") + @Digits(integer = 10, fraction = 2, message = "体积最多允许2位小数!") + private BigDecimal volume; + + /** + * 单品 + */ + @ApiModelProperty(value = "单品") + @Valid + private List productBundles; + + /** + * 商品属性 + */ + @ApiModelProperty(value = "商品属性") + @Valid + private List properties; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice = BigDecimal.ZERO; + + /** + * 销售价 + */ + @ApiModelProperty("销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @ApiModelProperty("零售价") + private BigDecimal retailPrice; + + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductBundleVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductBundleVo.java new file mode 100644 index 0000000..5ef188d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductBundleVo.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ProductBundleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 包含数量 + */ + @ApiModelProperty(value = "包含数量", required = true) + @NotNull(message = "包含数量不能为空!") + @Min(value = 1, message = "包含数量必须大于0!") + private Integer bundleNum; + + /** + * 销售价 + */ + @ApiModelProperty(value = "销售价", required = true) + @NotNull(message = "销售价不能为空!") + @Digits(integer = 10, fraction = 2, message = "销售价最多允许2位小数!") + @DecimalMin(value = "0.01", message = "销售价必须大于0!") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @ApiModelProperty(value = "零售价", required = true) + @NotNull(message = "零售价不能为空!") + @Digits(integer = 10, fraction = 2, message = "零售价最多允许2位小数!") + @DecimalMin(value = "0.01", message = "零售价必须大于0!") + private BigDecimal retailPrice; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductPropertyRelationVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductPropertyRelationVo.java new file mode 100644 index 0000000..ccff937 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/ProductPropertyRelationVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.vo.BaseVo; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ProductPropertyRelationVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 属性ID + */ + @NotBlank(message = "属性值ID不能为空!") + private String id; + + /** + * 属性值内容 + */ + private String text; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductSelectorVo.java new file mode 100644 index 0000000..0bb4a6c --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductSelectorVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryProductSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 简称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime startTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime endTime; + + /** + * 商品类型 + */ + @ApiModelProperty("商品类型") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductVo.java new file mode 100644 index 0000000..d1be1ee --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/QueryProductVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryProductVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 简称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 商品类型 + */ + @ApiModelProperty("商品类型") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime startTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime endTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/UpdateProductVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/UpdateProductVo.java new file mode 100644 index 0000000..8c6920e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/UpdateProductVo.java @@ -0,0 +1,166 @@ +package com.lframework.xingyun.basedata.vo.product.info; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ProductType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 简称 + */ + @ApiModelProperty(value = "简称") + private String shortName; + + /** + * 商品SKU编号 + */ + @ApiModelProperty(value = "商品SKU编号", required = true) + @NotBlank(message = "商品SKU编号不能为空!") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + @NotBlank(message = "类目ID不能为空!") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + @NotBlank(message = "品牌ID不能为空!") + private String brandId; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 重量(kg) + */ + @ApiModelProperty(value = "重量(kg)") + @Digits(integer = 10, fraction = 2, message = "重量最多允许2位小数!") + private BigDecimal weight; + + /** + * 体积(cm3) + */ + @ApiModelProperty(value = "体积(cm3)") + @Digits(integer = 10, fraction = 2, message = "体积最多允许2位小数!") + private BigDecimal volume; + + /** + * 进项税率(%) + */ + @ApiModelProperty(value = "进项税率(%)") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "进项税率(%)必须为整数!") + private BigDecimal taxRate = BigDecimal.ZERO; + + /** + * 销项税率(%) + */ + @ApiModelProperty(value = "销项税率(%)") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "销项税率(%)必须为整数!") + private BigDecimal saleTaxRate = BigDecimal.ZERO; + + /** + * 商品类型 + */ + @ApiModelProperty(value = "商品类型", required = true) + @NotNull(message = "商品类型不能为空!") + @IsEnum(message = "商品类型格式错误!", enumClass = ProductType.class) + private Integer productType; + + /** + * 单品 + */ + @ApiModelProperty(value = "单品") + @Valid + private List productBundles; + + /** + * 商品属性 + */ + @ApiModelProperty(value = "商品属性") + @Valid + private List properties; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice = BigDecimal.ZERO; + + /** + * 销售价 + */ + @ApiModelProperty("销售价") + private BigDecimal salePrice; + + /** + * 零售价 + */ + @ApiModelProperty("零售价") + private BigDecimal retailPrice; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态",required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/saleprop/CreateProductSalePropItemRelationVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/saleprop/CreateProductSalePropItemRelationVo.java new file mode 100644 index 0000000..3b4693a --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/info/saleprop/CreateProductSalePropItemRelationVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.basedata.vo.product.info.saleprop; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateProductSalePropItemRelationVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 销售属性值ID + */ + @ApiModelProperty(value = "销售属性值ID", required = true) + @NotEmpty(message = "销售属性值ID不能为空!") + private List salePropItemIds; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/CreateProductPolyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/CreateProductPolyVo.java new file mode 100644 index 0000000..966f15f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/CreateProductPolyVo.java @@ -0,0 +1,220 @@ +package com.lframework.xingyun.basedata.vo.product.poly; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateProductPolyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品货号 + */ + @ApiModelProperty(value = "商品货号", required = true) + @IsCode + @NotBlank(message = "商品货号不能为空!") + private String code; + + /** + * 商品名称 + */ + @ApiModelProperty(value = "商品名称", required = true) + @NotBlank(message = "商品名称不能为空!") + private String name; + + /** + * 商品简称 + */ + @ApiModelProperty("商品简称") + private String shortName; + + /** + * 类目ID + */ + @ApiModelProperty(value = "类目ID", required = true) + @NotBlank(message = "请选择商品类目!") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty(value = "品牌ID", required = true) + @NotBlank(message = "请选择商品品牌!") + private String brandId; + + /** + * 是否多销售属性 + */ + @ApiModelProperty(value = "是否多销售属性", required = true) + @NotNull(message = "请选择是否多销售属性!") + private Boolean multipleSaleProp; + + /** + * 进项税率(%) + */ + @ApiModelProperty(value = "进项税率(%)", required = true) + @NotNull(message = "进项税率(%)不能为空!") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "进项税率(%)必须为整数!") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @ApiModelProperty(value = "销项税率(%)", required = true) + @NotNull(message = "销项税率(%)不能为空!") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "销项税率(%)必须为整数!") + private BigDecimal saleTaxRate; + + /** + * 商品属性 + */ + @ApiModelProperty(value = "商品属性", required = true) + @Valid + private List properties; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty + private List products; + + public void validate() { + + int orderNo = 1; + for (ProductVo product : this.getProducts()) { + if (this.getMultipleSaleProp()) { + if (StringUtil.isBlank(product.getSalePropItemId1())) { + throw new InputErrorException("销售属性1不能为空!"); + } + } + + if (StringUtil.isBlank(product.getCode())) { + throw new InputErrorException("第" + (orderNo) + "行商品编号不能为空!"); + } + + if (!RegUtil.isMatch(PatternPool.PATTERN_CODE, product.getCode())) { + throw new InputErrorException("第" + (orderNo) + "行商品编号必须由字母或数字组成,长度不能超过20位!"); + } + + if (StringUtil.isBlank(product.getName())) { + throw new InputErrorException("第" + (orderNo) + "行商品名称不能为空!"); + } + + if (StringUtil.isBlank(product.getSkuCode())) { + throw new InputErrorException("第" + (orderNo) + "行商品SKU编号不能为空!"); + } + + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + (orderNo) + "行商品采购价不能为空!"); + } + + if (product.getSalePrice() == null) { + throw new InputErrorException("第" + (orderNo) + "行商品销售价不能为空!"); + } + + if (product.getRetailPrice() == null) { + throw new InputErrorException("第" + (orderNo) + "行商品零售价不能为空!"); + } + + orderNo++; + } + } + + @Data + public static class PropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 属性ID + */ + @NotBlank(message = "属性值ID不能为空!") + private String id; + + /** + * 属性值内容 + */ + private String text; + } + + @Data + public static class ProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 销售属性1ID multipleSaleProp == true时生效 + */ + private String salePropItemId1; + + /** + * 销售属性2ID multipleSaleProp == true时生效 + */ + private String salePropItemId2; + + /** + * 商品编号 + */ + private String code; + + /** + * 商品名称 + */ + private String name; + + /** + * 商品SKU编号 + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 采购价 + */ + private BigDecimal purchasePrice; + + /** + * 销售价 + */ + private BigDecimal salePrice; + + /** + * 零售价 + */ + private BigDecimal retailPrice; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/QueryProductPolyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/QueryProductPolyVo.java new file mode 100644 index 0000000..8a7db85 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/QueryProductPolyVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.basedata.vo.product.poly; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductPolyVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/UpdateProductPolyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/UpdateProductPolyVo.java new file mode 100644 index 0000000..7086272 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/UpdateProductPolyVo.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.basedata.vo.product.poly; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductPolyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 商品货号 + */ + @ApiModelProperty(value = "商品货号", required = true) + @IsCode + @NotBlank(message = "商品货号不能为空!") + private String code; + + /** + * 商品名称 + */ + @ApiModelProperty(value = "商品名称", required = true) + @NotBlank(message = "商品名称不能为空!") + private String name; + + /** + * 商品简称 + */ + @ApiModelProperty("商品简称") + private String shortName; + + /** + * 类目ID + */ + @ApiModelProperty(value = "类目ID", required = true) + @NotBlank(message = "请选择商品类目!") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty(value = "品牌ID", required = true) + @NotBlank(message = "请选择商品品牌!") + private String brandId; + + /** + * 进项税率(%) + */ + @ApiModelProperty(value = "进项税率(%)", required = true) + @NotNull(message = "进项税率(%)不能为空!") + @Min(value = 0, message = "进项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "进项税率(%)必须为整数!") + private BigDecimal taxRate; + + /** + * 销项税率(%) + */ + @ApiModelProperty(value = "销项税率(%)", required = true) + @NotNull(message = "销项税率(%)不能为空!") + @Min(value = 0, message = "销项税率(%)不允许小于0!") + @Digits(integer = 10, fraction = 0, message = "销项税率(%)必须为整数!") + private BigDecimal saleTaxRate; + + /** + * 商品属性 + */ + @ApiModelProperty(value = "商品属性", required = true) + @Valid + private List properties; + + @Data + public static class PropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 属性ID + */ + @NotBlank(message = "属性值ID不能为空!") + private String id; + + /** + * 属性值内容 + */ + private String text; + } +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/property/CreateProductPolyPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/property/CreateProductPolyPropertyVo.java new file mode 100644 index 0000000..1290547 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/property/CreateProductPolyPropertyVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.basedata.vo.product.poly.property; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateProductPolyPropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * polyID + */ + @ApiModelProperty(value = "polyID", required = true) + @NotBlank(message = "polyId不能为空!") + private String polyId; + + /** + * 属性ID + */ + @ApiModelProperty(value = "属性ID", required = true) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; + + /** + * 属性值ID + */ + @ApiModelProperty("属性值ID") + private String propertyItemId; + + /** + * 属性值文本 + */ + @ApiModelProperty("属性值文本") + private String propertyText; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/saleprop/CreateProductPolySalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/saleprop/CreateProductPolySalePropGroupVo.java new file mode 100644 index 0000000..58bdfe2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/poly/saleprop/CreateProductPolySalePropGroupVo.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.basedata.vo.product.poly.saleprop; + +import com.lframework.starter.web.vo.BaseVo; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class CreateProductPolySalePropGroupVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品聚合ID + */ + private String polyId; + + /** + * 销售属性组ID + */ + private List salePropGroupIds; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/CreateProductPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/CreateProductPropertyVo.java new file mode 100644 index 0000000..7659188 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/CreateProductPropertyVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.basedata.vo.product.property; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateProductPropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否必填 + */ + @ApiModelProperty(value = "是否必填", required = true) + @NotNull(message = "请选择是否必填!") + private Boolean isRequired; + + /** + * 录入类型 + */ + @ApiModelProperty(value = "录入类型", required = true) + @NotNull(message = "请选择录入类型!") + @IsEnum(enumClass = ColumnType.class, message = "请选择录入类型!") + private Integer columnType; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + @IsEnum(enumClass = ColumnDataType.class, message = "请选择数据类型!") + private Integer columnDataType; + + /** + * 属性类别 + */ + @ApiModelProperty(value = "属性类别", required = true) + @NotNull(message = "请选择属性类别!") + @IsEnum(enumClass = PropertyType.class, message = "请选择属性类别!") + private Integer propertyType; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private List categoryIds; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/QueryProductPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/QueryProductPropertyVo.java new file mode 100644 index 0000000..a76ee15 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/QueryProductPropertyVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.product.property; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductPropertyVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/UpdateProductPropertyVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/UpdateProductPropertyVo.java new file mode 100644 index 0000000..98fa4f9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/UpdateProductPropertyVo.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.basedata.vo.product.property; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ColumnDataType; +import com.lframework.xingyun.basedata.enums.ColumnType; +import com.lframework.xingyun.basedata.enums.PropertyType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductPropertyVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = false) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 是否必填 + */ + @ApiModelProperty(value = "是否必填", required = true) + @NotNull(message = "请选择是否必填!") + private Boolean isRequired; + + /** + * 录入类型 + */ + @ApiModelProperty(value = "录入类型", required = true) + @NotNull(message = "请选择录入类型!") + @IsEnum(enumClass = ColumnType.class, message = "请选择录入类型!") + private Integer columnType; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + @IsEnum(enumClass = ColumnDataType.class, message = "请选择数据类型!") + private Integer columnDataType; + + /** + * 属性类别 + */ + @ApiModelProperty(value = "属性类别", required = true) + @NotNull(message = "请选择属性类别!") + @IsEnum(enumClass = PropertyType.class, message = "请选择属性类别!") + private Integer propertyType; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private List categoryIds; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/CreateProductPropertyItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/CreateProductPropertyItemVo.java new file mode 100644 index 0000000..1371df6 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/CreateProductPropertyItemVo.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.basedata.vo.product.property.item; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateProductPropertyItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 属性ID + */ + @ApiModelProperty(value = "属性ID", required = true) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/QueryProductPropertyItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/QueryProductPropertyItemVo.java new file mode 100644 index 0000000..d425625 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/QueryProductPropertyItemVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.basedata.vo.product.property.item; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryProductPropertyItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 属性ID + */ + @ApiModelProperty(value = "属性ID", required = true) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/UpdateProductPropertyItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/UpdateProductPropertyItemVo.java new file mode 100644 index 0000000..ee5da9d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/item/UpdateProductPropertyItemVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.vo.product.property.item; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductPropertyItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/realtion/CreateProductPropertyRelationVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/realtion/CreateProductPropertyRelationVo.java new file mode 100644 index 0000000..f045571 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/property/realtion/CreateProductPropertyRelationVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.basedata.vo.product.property.realtion; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateProductPropertyRelationVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 属性ID + */ + @ApiModelProperty(value = "属性ID", required = true) + @NotBlank(message = "属性ID不能为空!") + private String propertyId; + + /** + * 属性值ID + */ + @ApiModelProperty("属性值ID") + private String propertyItemId; + + /** + * 属性值文本 + */ + @ApiModelProperty("属性值文本") + private String propertyText; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/CreateProductPurchaseVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/CreateProductPurchaseVo.java new file mode 100644 index 0000000..62c1d71 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/CreateProductPurchaseVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.product.purchase; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; +import lombok.Data; + +@Data +public class CreateProductPurchaseVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String id; + + /** + * 采购价 + */ + @ApiModelProperty(value = "采购价", required = true) + @NotNull(message = "请输入采购价!") + @Positive(message = "采购价必须大于0!") + @Digits(integer = 20, fraction = 2, message = "采购价最多允许2位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/UpdateProductPurchaseVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/UpdateProductPurchaseVo.java new file mode 100644 index 0000000..a0e8ed0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/purchase/UpdateProductPurchaseVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.vo.product.purchase; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; +import lombok.Data; + +@Data +public class UpdateProductPurchaseVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String id; + + /** + * 采购价 + */ + @ApiModelProperty(value = "采购价", required = true) + @NotNull(message = "请输入采购价!") + @Positive(message = "采购价必须大于0!") + @Digits(integer = 20, fraction = 2, message = "采购价最多允许2位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/CreateProductRetailVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/CreateProductRetailVo.java new file mode 100644 index 0000000..f1431a2 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/CreateProductRetailVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.product.retail; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; +import lombok.Data; + +@Data +public class CreateProductRetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String id; + + /** + * 零售价 + */ + @ApiModelProperty(value = "零售价", required = true) + @NotNull(message = "请输入零售价!") + @Positive(message = "零售价必须大于0!") + @Digits(integer = 20, fraction = 2, message = "零售价最多允许2位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/UpdateProductRetailVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/UpdateProductRetailVo.java new file mode 100644 index 0000000..1cf1e39 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/retail/UpdateProductRetailVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.vo.product.retail; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; +import lombok.Data; + +@Data +public class UpdateProductRetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String id; + + /** + * 零售价 + */ + @ApiModelProperty(value = "零售价", required = true) + @NotNull(message = "请输入零售价!") + @Positive(message = "零售价必须大于0!") + @Digits(integer = 20, fraction = 2, message = "零售价最多允许2位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/CreateProductSaleVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/CreateProductSaleVo.java new file mode 100644 index 0000000..a3c1c78 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/CreateProductSaleVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.product.sale; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; +import lombok.Data; + +@Data +public class CreateProductSaleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String id; + + /** + * 销售价 + */ + @ApiModelProperty(value = "销售价", required = true) + @NotNull(message = "请输入销售价!") + @Positive(message = "销售价必须大于0!") + @Digits(integer = 20, fraction = 2, message = "销售价最多允许2位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/UpdateProductSaleVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/UpdateProductSaleVo.java new file mode 100644 index 0000000..0220a93 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/sale/UpdateProductSaleVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.vo.product.sale; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.Digits; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; +import lombok.Data; + +@Data +public class UpdateProductSaleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String id; + + /** + * 销售价 + */ + @ApiModelProperty(value = "销售价", required = true) + @NotNull(message = "请输入销售价!") + @Positive(message = "销售价必须大于0!") + @Digits(integer = 20, fraction = 2, message = "销售价最多允许2位小数!") + private BigDecimal price; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/CreateProductSalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/CreateProductSalePropGroupVo.java new file mode 100644 index 0000000..54fb158 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/CreateProductSalePropGroupVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateProductSalePropGroupVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupSelectorVo.java new file mode 100644 index 0000000..569086e --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupSelectorVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductSalePropGroupSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 是否过滤空的销售属性组 + */ + @ApiModelProperty("是否过滤空的销售属性组") + private Boolean filterEmpty; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupVo.java new file mode 100644 index 0000000..9a14f15 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/QueryProductSalePropGroupVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductSalePropGroupVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/UpdateProductSalePropGroupVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/UpdateProductSalePropGroupVo.java new file mode 100644 index 0000000..2f95d05 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/UpdateProductSalePropGroupVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductSalePropGroupVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/CreateProductSalePropItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/CreateProductSalePropItemVo.java new file mode 100644 index 0000000..9e05474 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/CreateProductSalePropItemVo.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateProductSalePropItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 销售属性组ID + */ + @ApiModelProperty(value = "销售属性组ID", required = true) + @NotBlank(message = "GroupID不能为空!") + private String groupId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemSelectorVo.java new file mode 100644 index 0000000..123869f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemSelectorVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryProductSalePropItemSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 销售属性组ID + */ + @ApiModelProperty("销售属性组ID") + private String salePropGroupId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemVo.java new file mode 100644 index 0000000..6975946 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/QueryProductSalePropItemVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryProductSalePropItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 销售属性组ID + */ + @ApiModelProperty(value = "销售属性组ID", required = true) + @NotBlank(message = "GroupID不能为空!") + private String groupId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/UpdateProductSalePropItemVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/UpdateProductSalePropItemVo.java new file mode 100644 index 0000000..7e4ba76 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/product/saleprop/item/UpdateProductSalePropItemVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.basedata.vo.product.saleprop.item; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateProductSalePropItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/CreateShopVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/CreateShopVo.java new file mode 100644 index 0000000..e97b575 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/CreateShopVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateShopVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 所属部门ID + */ + @ApiModelProperty("所属部门ID") + private String deptId; + + /** + * 经度 + */ + @ApiModelProperty("经度") + @TypeMismatch(message = "经度格式有误!") + private BigDecimal lng; + + /** + * 纬度 + */ + @ApiModelProperty("纬度") + @TypeMismatch(message = "纬度格式有误!") + private BigDecimal lat; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/QueryShopVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/QueryShopVo.java new file mode 100644 index 0000000..fd83b64 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/QueryShopVo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryShopVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 所属部门ID + */ + @ApiModelProperty("所属部门ID") + private String deptId; + + /** + * 创建时间 起始时间 + */ + @ApiModelProperty("创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @ApiModelProperty("创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @TypeMismatch(message = "状态格式有误!") + private Boolean available; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/ShopSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/ShopSelectorVo.java new file mode 100644 index 0000000..15e3f3b --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/ShopSelectorVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class ShopSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @TypeMismatch(message = "状态格式有误!") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/UpdateShopVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/UpdateShopVo.java new file mode 100644 index 0000000..063b376 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/shop/UpdateShopVo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.basedata.vo.shop; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateShopVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 所属部门ID + */ + @ApiModelProperty("所属部门ID") + private String deptId; + + /** + * 经度 + */ + @ApiModelProperty("经度") + @TypeMismatch(message = "经度格式有误!") + private BigDecimal lng; + + /** + * 纬度 + */ + @ApiModelProperty("纬度") + @TypeMismatch(message = "纬度格式有误!") + private BigDecimal lat; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @TypeMismatch(message = "状态格式有误!") + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/CreateStoreCenterVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/CreateStoreCenterVo.java new file mode 100644 index 0000000..53c7d7d --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/CreateStoreCenterVo.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateStoreCenterVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @ApiModelProperty("联系人手机号码") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 仓库人数 + */ + @ApiModelProperty("仓库人数") + private Integer peopleNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterSelectorVo.java new file mode 100644 index 0000000..16021c0 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryStoreCenterSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterVo.java new file mode 100644 index 0000000..c25cb99 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/QueryStoreCenterVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryStoreCenterVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/UpdateStoreCenterVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/UpdateStoreCenterVo.java new file mode 100644 index 0000000..536e326 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/storecenter/UpdateStoreCenterVo.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.basedata.vo.storecenter; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateStoreCenterVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系人手机号码 + */ + @ApiModelProperty("联系人手机号码") + private String telephone; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 仓库人数 + */ + @ApiModelProperty("仓库人数") + private Integer peopleNum; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/CreateSupplierVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/CreateSupplierVo.java new file mode 100644 index 0000000..86874d9 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/CreateSupplierVo.java @@ -0,0 +1,144 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Email; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSupplierVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 助记码 + */ + @ApiModelProperty(value = "助记码", required = true) + @NotBlank(message = "请输入助记码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @ApiModelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ApiModelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 送货周期(天) + */ + @ApiModelProperty("送货周期(天)") + @Min(message = "送货周期(天)必须大于0!", value = 1) + private Integer deliveryCycle; + + /** + * 经营方式 + */ + @ApiModelProperty(value = "经营方式", required = true) + @NotNull(message = "请选择经营方式!") + @IsEnum(message = "请选择经营方式!", enumClass = ManageType.class) + private Integer manageType; + + /** + * 结账方式 + */ + @ApiModelProperty(value = "结账方式", required = true) + @NotNull(message = "请选择结账方式!") + @IsEnum(message = "请选择结账方式!", enumClass = SettleType.class) + private Integer settleType; + + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ApiModelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ApiModelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ApiModelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ApiModelProperty("银行账号") + private String accountNo; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierSelectorVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierSelectorVo.java new file mode 100644 index 0000000..fcdc685 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierSelectorVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.basedata.enums.ManageType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySupplierSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 经营方式 + */ + @ApiModelProperty("经营方式") + @IsEnum(message = "经营方式格式不正确!", enumClass = ManageType.class) + private Integer manageType; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierVo.java new file mode 100644 index 0000000..834d487 --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/QuerySupplierVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySupplierVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/UpdateSupplierVo.java b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/UpdateSupplierVo.java new file mode 100644 index 0000000..f5f2b4f --- /dev/null +++ b/xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/vo/supplier/UpdateSupplierVo.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.basedata.vo.supplier; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Email; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSupplierVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 助记码 + */ + @ApiModelProperty(value = "助记码", required = true) + @NotBlank(message = "请输入助记码!") + private String mnemonicCode; + + /** + * 联系人 + */ + @ApiModelProperty("联系人") + private String contact; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 电子邮箱 + */ + @ApiModelProperty("电子邮箱") + @Email(message = "电子邮箱格式不正确!") + private String email; + + /** + * 邮编 + */ + @ApiModelProperty("邮编") + private String zipCode; + + /** + * 传真 + */ + @ApiModelProperty("传真") + private String fax; + + /** + * 地区ID + */ + @ApiModelProperty("地区ID") + private String cityId; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * 送货周期(天) + */ + @ApiModelProperty("送货周期(天)") + @Min(message = "送货周期(天)必须大于0!", value = 1) + private Integer deliveryCycle; + + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + /** + * 纳税人识别号 + */ + @ApiModelProperty("纳税人识别号") + private String taxIdentifyNo; + + /** + * 开户银行 + */ + @ApiModelProperty("开户银行") + private String bankName; + + /** + * 户名 + */ + @ApiModelProperty("户名") + private String accountName; + + /** + * 银行账号 + */ + @ApiModelProperty("银行账号") + private String accountNo; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-basedata/src/main/java/lombok.config b/xingyun-basedata/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-basedata/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-basedata/src/main/resources/mappers/address/AddressMapper.xml b/xingyun-basedata/src/main/resources/mappers/address/AddressMapper.xml new file mode 100644 index 0000000..362e913 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/address/AddressMapper.xml @@ -0,0 +1,65 @@ + + + + + + SELECT + tb.* + FROM base_data_address AS tb + + + + \ No newline at end of file diff --git a/xingyun-basedata/src/main/resources/mappers/customer/CustomerMapper.xml b/xingyun-basedata/src/main/resources/mappers/customer/CustomerMapper.xml new file mode 100644 index 0000000..eaaf558 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/customer/CustomerMapper.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + mnemonic_code, + contact, + telephone, + email, + zip_code, + fax, + city_id, + address, + settle_type, + credit_code, + tax_identify_no, + bank_name, + account_name, + account_no, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_customer + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/logistics/LogisticsCompanyMapper.xml b/xingyun-basedata/src/main/resources/mappers/logistics/LogisticsCompanyMapper.xml new file mode 100644 index 0000000..2f2bb02 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/logistics/LogisticsCompanyMapper.xml @@ -0,0 +1,46 @@ + + + + + + SELECT + * + FROM base_data_logistics_company + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/member/MemberMapper.xml b/xingyun-basedata/src/main/resources/mappers/member/MemberMapper.xml new file mode 100644 index 0000000..a5d03c8 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/member/MemberMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + gender, + telephone, + email, + birthday, + join_day, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_member + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/paytype/PayTypeMapper.xml b/xingyun-basedata/src/main/resources/mappers/paytype/PayTypeMapper.xml new file mode 100644 index 0000000..45fe710 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/paytype/PayTypeMapper.xml @@ -0,0 +1,44 @@ + + + + + + SELECT + tb.* + FROM base_data_pay_type AS tb + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductBrandMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductBrandMapper.xml new file mode 100644 index 0000000..a285eca --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductBrandMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + short_name, + logo, + introduction, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_product_brand + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryMapper.xml new file mode 100644 index 0000000..2965796 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + SELECT + id, + code, + name, + parent_id, + available, + description + FROM base_data_product_category + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryPropertyMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryPropertyMapper.xml new file mode 100644 index 0000000..8aba70f --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductCategoryPropertyMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + SELECT + cp.id, + cp.property_id, + cp.category_id + FROM base_data_product_category_property AS cp + LEFT JOIN base_data_product_property AS p ON p.id = cp.property_id + LEFT JOIN base_data_product_category AS c ON c.id = cp.category_id + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml new file mode 100644 index 0000000..6a225f5 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductMapper.xml @@ -0,0 +1,166 @@ + + + + + + SELECT + g.* + FROM base_data_product AS g + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = g.category_id and rm.node_type = 2 + + + + + + + + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyItemMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyItemMapper.xml new file mode 100644 index 0000000..58ff2a3 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyItemMapper.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + property_id, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_product_property_item + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyMapper.xml new file mode 100644 index 0000000..9dcb8d2 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + p.id, + p.code, + p.name, + p.is_required, + p.column_type, + p.column_data_type, + p.property_type, + p.available, + p.description, + p.create_by, + p.create_time, + p.update_by, + p.update_time + FROM base_data_product_property AS p + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyRelationMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyRelationMapper.xml new file mode 100644 index 0000000..e1a8e0b --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPropertyRelationMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + SELECT + pp.id, + pp.product_id, + p.id AS property_id, + t.id AS property_item_id, + p.column_type AS property_column_type, + p.name AS property_name, + IF(p.column_type = 3, pp.property_text, t.name) AS property_text + FROM base_data_product_property_relation AS pp + INNER JOIN base_data_product_property AS p ON p.id = pp.property_id + LEFT JOIN base_data_product_property_item AS t ON t.id = pp.property_item_id + + + DELETE FROM base_data_product_property_relation WHERE property_id = #{propertyId} AND product_id NOT IN (SELECT id from base_data_product WHERE category_id = #{categoryId}) + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductPurchaseMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductPurchaseMapper.xml new file mode 100644 index 0000000..6255097 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductPurchaseMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductRetailMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductRetailMapper.xml new file mode 100644 index 0000000..fb42450 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductRetailMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/product/ProductSaleMapper.xml b/xingyun-basedata/src/main/resources/mappers/product/ProductSaleMapper.xml new file mode 100644 index 0000000..cea9f93 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/product/ProductSaleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/shop/ShopMapper.xml b/xingyun-basedata/src/main/resources/mappers/shop/ShopMapper.xml new file mode 100644 index 0000000..69592e7 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/shop/ShopMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.dept_id, + tb.lng, + tb.lat, + tb.description, + tb.available, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM tbl_shop AS tb + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/storecenter/StoreCenterMapper.xml b/xingyun-basedata/src/main/resources/mappers/storecenter/StoreCenterMapper.xml new file mode 100644 index 0000000..ebcebdf --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/storecenter/StoreCenterMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + contact, + telephone, + people_num, + city_id, + address, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM base_data_store_center + + + + + + diff --git a/xingyun-basedata/src/main/resources/mappers/supplier/SupplierMapper.xml b/xingyun-basedata/src/main/resources/mappers/supplier/SupplierMapper.xml new file mode 100644 index 0000000..8d9bac9 --- /dev/null +++ b/xingyun-basedata/src/main/resources/mappers/supplier/SupplierMapper.xml @@ -0,0 +1,49 @@ + + + + + + SELECT + * + FROM base_data_supplier + + + + + + diff --git a/xingyun-chart/pom.xml b/xingyun-chart/pom.xml new file mode 100644 index 0000000..d7095ba --- /dev/null +++ b/xingyun-chart/pom.xml @@ -0,0 +1,22 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-chart + 【${project.artifactId}】图表服务层 + + + + com.lframework + xingyun-core + + + + diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthBo.java new file mode 100644 index 0000000..e0839a3 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class OrderChartSameMonthBo extends BaseBo { + + /** + * 单据总金额 + */ + @ApiModelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + @ApiModelProperty("单据总数量") + private Integer totalNum; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createDate; + + public OrderChartSameMonthBo() { + + } + + public OrderChartSameMonthBo(OrderChartSameMonthDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthSumBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthSumBo.java new file mode 100644 index 0000000..7b632c1 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartSameMonthSumBo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +@Data +public class OrderChartSameMonthSumBo extends BaseBo { + + /** + * 单据总金额 + */ + @ApiModelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 单据数量 + */ + @ApiModelProperty("单据数量") + private Long totalNum; + + /** + * 图表数据 + */ + @ApiModelProperty("图表数据") + private List charts; + + public OrderChartSameMonthSumBo() { + + } + + public OrderChartSameMonthSumBo(OrderChartSumDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodayBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodayBo.java new file mode 100644 index 0000000..d35d0f6 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodayBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class OrderChartTodayBo extends BaseBo { + + /** + * 单据总金额 + */ + @ApiModelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + @ApiModelProperty("单据总数量") + private Integer totalNum; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createHour; + + public OrderChartTodayBo() { + + } + + public OrderChartTodayBo(OrderChartTodayDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodaySumBo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodaySumBo.java new file mode 100644 index 0000000..4b80265 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/bo/OrderChartTodaySumBo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.chart.bo; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +@Data +public class OrderChartTodaySumBo extends BaseBo { + + /** + * 单据总金额 + */ + @ApiModelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 单据数量 + */ + @ApiModelProperty("单据数量") + private Long totalNum; + + /** + * 图表数据 + */ + @ApiModelProperty("图表数据") + private List charts; + + public OrderChartTodaySumBo() { + + } + + public OrderChartTodaySumBo(OrderChartSumDto dto) { + + super(dto); + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/controller/ChartController.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/controller/ChartController.java new file mode 100644 index 0000000..29d5e27 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/controller/ChartController.java @@ -0,0 +1,114 @@ +package com.lframework.xingyun.chart.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.chart.bo.OrderChartSameMonthBo; +import com.lframework.xingyun.chart.bo.OrderChartSameMonthSumBo; +import com.lframework.xingyun.chart.bo.OrderChartTodayBo; +import com.lframework.xingyun.chart.bo.OrderChartTodaySumBo; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import com.lframework.xingyun.chart.service.OrderChartService; +import com.lframework.xingyun.chart.vo.GetOrderChartVo; +import com.lframework.xingyun.chart.vo.QueryOrderChartVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 报表 + * + * @author zmj + */ +@Api(tags = "报表") +@Validated +@RestController +@RequestMapping("/chart") +public class ChartController extends DefaultBaseController { + + @Autowired + private OrderChartService orderChartService; + + /** + * 订单报表 + */ + @ApiOperation("订单报表") + @GetMapping("/order") + public InvokeResult>> orderChart() { + + //当日数据 + Map todayMap = new HashMap<>(2, 1); + //当月数据 + Map sameMonthMap = new HashMap<>(2, 1); + + List orderBizTypes = CollectionUtil.toList(OrderChartBizType.PURCHASE_ORDER.getCode(), + OrderChartBizType.SALE_ORDER.getCode(), OrderChartBizType.RETAIL_OUT_SHEET.getCode()); + todayMap.put("order", getTodayChart(orderBizTypes)); + sameMonthMap.put("order", getSameMonthChart(orderBizTypes)); + + List returnBizTypes = CollectionUtil.toList( + OrderChartBizType.PURCHASE_RETURN.getCode(), + OrderChartBizType.SALE_RETURN.getCode(), OrderChartBizType.RETAIL_RETURN.getCode()); + todayMap.put("returned", getTodayChart(returnBizTypes)); + sameMonthMap.put("returned", getSameMonthChart(returnBizTypes)); + + Map> result = new HashMap<>(2, 1); + result.put("today", todayMap); + result.put("sameMonth", sameMonthMap); + + return InvokeResultBuilder.success(result); + } + + private OrderChartTodaySumBo getTodayChart(List bizTypes) { + + GetOrderChartVo orderSumVo = new GetOrderChartVo(); + orderSumVo.setBizTypes(bizTypes); + // 今日订单汇总数据 + OrderChartTodaySumBo orderSumBo = new OrderChartTodaySumBo( + orderChartService.getTodayChartSum(orderSumVo)); + // 今日订单图表数据 + QueryOrderChartVo chartVo = new QueryOrderChartVo(); + chartVo.setBizTypes(bizTypes); + List charts = orderChartService.queryTodayChart(chartVo); + List chartResults = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(charts)) { + chartResults = charts.stream().map(OrderChartTodayBo::new).collect(Collectors.toList()); + } + orderSumBo.setCharts(chartResults); + + return orderSumBo; + } + + private OrderChartSameMonthSumBo getSameMonthChart(List bizTypes) { + + GetOrderChartVo orderSumVo = new GetOrderChartVo(); + orderSumVo.setBizTypes(bizTypes); + // 当月订单汇总数据 + OrderChartSameMonthSumBo sameMonthOrderSumBo = new OrderChartSameMonthSumBo( + orderChartService.getSameMonthChartSum(orderSumVo)); + // 当月订单图表数据 + QueryOrderChartVo chartVo = new QueryOrderChartVo(); + chartVo.setBizTypes(bizTypes); + List sameMonthCharts = orderChartService.querySameMonthChart(chartVo); + List sameMonthChartResults = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(sameMonthCharts)) { + sameMonthChartResults = sameMonthCharts.stream().map(OrderChartSameMonthBo::new) + .collect(Collectors.toList()); + } + sameMonthOrderSumBo.setCharts(sameMonthChartResults); + + return sameMonthOrderSumBo; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSameMonthDto.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSameMonthDto.java new file mode 100644 index 0000000..7c9f029 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSameMonthDto.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.chart.dto; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class OrderChartSameMonthDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + private Integer totalNum; + + /** + * 创建时间 + */ + private String createDate; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSumDto.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSumDto.java new file mode 100644 index 0000000..e4a30e0 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartSumDto.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.chart.dto; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class OrderChartSumDto implements BaseDto, Serializable { + + public static final String CACHE_NAME = "OrderChartSumDto"; + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 单据数量 + */ + private Long totalNum; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartTodayDto.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartTodayDto.java new file mode 100644 index 0000000..b250f6c --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/dto/OrderChartTodayDto.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.chart.dto; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class OrderChartTodayDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 单据总数量 + */ + private Integer totalNum; + + /** + * 创建时间 + */ + private String createHour; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/entity/OrderChart.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/entity/OrderChart.java new file mode 100644 index 0000000..545c65d --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/entity/OrderChart.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.chart.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-19 + */ +@Data +@TableName("tbl_order_chart") +public class OrderChart extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单据总金额 + */ + private BigDecimal totalAmount; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 创建日期 + */ + private String createDate; + + /** + * 创建时间(小时) + */ + private String createHour; + + /** + * 业务类型 + */ + private OrderChartBizType bizType; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/enums/OrderChartBizType.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/enums/OrderChartBizType.java new file mode 100644 index 0000000..46abe19 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/enums/OrderChartBizType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.chart.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum OrderChartBizType implements BaseEnum { + PURCHASE_ORDER(0, "采购订单"), PURCHASE_RETURN(1, "采购退单"), SALE_ORDER(2, "销售订单"), SALE_RETURN(3, + "销售退单"), RETAIL_OUT_SHEET(4, "零售出库单"), RETAIL_RETURN(5, "零售退单"); + + @EnumValue + private final Integer code; + + private final String desc; + + OrderChartBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/impl/OrderChartServiceImpl.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/impl/OrderChartServiceImpl.java new file mode 100644 index 0000000..acd31ca --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/impl/OrderChartServiceImpl.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.chart.impl; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.entity.OrderChart; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import com.lframework.xingyun.chart.mappers.OrderChartMapper; +import com.lframework.xingyun.chart.service.OrderChartService; +import com.lframework.xingyun.chart.vo.CreateOrderChartVo; +import com.lframework.xingyun.chart.vo.GetOrderChartVo; +import com.lframework.xingyun.chart.vo.QueryOrderChartVo; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class OrderChartServiceImpl extends BaseMpServiceImpl + implements OrderChartService { + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateOrderChartVo vo) { + + if (vo.getCreateTime() == null) { + vo.setCreateTime(LocalDateTime.now()); + } + + OrderChart record = new OrderChart(); + record.setId(IdUtil.getId()); + record.setTotalAmount(vo.getTotalAmount()); + record.setCreateTime(vo.getCreateTime()); + record.setBizType(EnumUtil.getByCode(OrderChartBizType.class, vo.getBizType())); + record.setCreateDate(DateUtil.formatDate(vo.getCreateTime().toLocalDate())); + record.setCreateHour(DateUtil.format(vo.getCreateTime(), StringPool.DATE_TIME_HOUR_PATTER)); + + getBaseMapper().insert(record); + + return record.getId(); + } + + @Override + public OrderChartSumDto getTodayChartSum(GetOrderChartVo vo) { + + LocalDate now = LocalDate.now(); + + OrderChartSumDto data = getBaseMapper().getChartSum(vo.getBizTypes(), + DateUtil.toLocalDateTime(now), + DateUtil.toLocalDateTimeMax(now)); + if (data == null) { + data = new OrderChartSumDto(); + data.setTotalAmount(BigDecimal.ZERO); + data.setTotalNum(0L); + } + + return data; + } + + @Override + public OrderChartSumDto getSameMonthChartSum(GetOrderChartVo vo) { + + LocalDate startDate = LocalDate.now().withDayOfMonth(1); + LocalDate endDate = startDate.plusMonths(1).minusDays(1); + + OrderChartSumDto data = getBaseMapper().getChartSum(vo.getBizTypes(), + DateUtil.toLocalDateTime(startDate), + DateUtil.toLocalDateTimeMax(endDate)); + if (data == null) { + data = new OrderChartSumDto(); + data.setTotalAmount(BigDecimal.ZERO); + data.setTotalNum(0L); + } + + return data; + } + + @Override + public List queryTodayChart(QueryOrderChartVo vo) { + + LocalDate now = LocalDate.now(); + + List results = getBaseMapper().queryToday(vo.getBizTypes(), + DateUtil.toLocalDateTime(now), + DateUtil.toLocalDateTimeMax(now)); + + int offset = 24; + List newResults = new ArrayList<>(offset); + + for (int i = 0; i < offset; i++) { + LocalTime localTime = LocalTime.of(i, 0, 0); + String filterDateStr = DateUtil.formatDateTime(LocalDateTime.of(now, localTime), + StringPool.DATE_TIME_HOUR_PATTER); + OrderChartTodayDto result = results.stream() + .filter(t -> t.getCreateHour().equals(filterDateStr)) + .findFirst().orElse(null); + if (result == null) { + result = new OrderChartTodayDto(); + result.setCreateHour(filterDateStr); + result.setTotalAmount(BigDecimal.ZERO); + result.setTotalNum(0); + } + + newResults.add(result); + } + + return newResults; + } + + @Override + public List querySameMonthChart(QueryOrderChartVo vo) { + + LocalDate startDate = LocalDate.now().withDayOfMonth(1); + LocalDate endDate = startDate.plusMonths(1).minusDays(1); + + List results = getBaseMapper().querySameMonth(vo.getBizTypes(), + DateUtil.toLocalDateTime(startDate), DateUtil.toLocalDateTimeMax(endDate)); + + LocalDate lastDate = startDate.plusMonths(1).minusDays(1); + int offset = lastDate.getDayOfMonth() - startDate.getDayOfMonth() + 1; + List newResults = new ArrayList<>(offset); + + for (int i = 0; i < offset; i++) { + String filterDateStr = DateUtil.formatDate(startDate.plusDays(i)); + OrderChartSameMonthDto result = results.stream() + .filter(t -> t.getCreateDate().equals(filterDateStr)) + .findFirst().orElse(null); + if (result == null) { + result = new OrderChartSameMonthDto(); + result.setCreateDate(filterDateStr); + result.setTotalAmount(BigDecimal.ZERO); + result.setTotalNum(0); + } + + newResults.add(result); + } + + return newResults; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/listeners/OrderDataListener.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/listeners/OrderDataListener.java new file mode 100644 index 0000000..f5f35be --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/listeners/OrderDataListener.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.chart.listeners; + +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import com.lframework.xingyun.chart.service.OrderChartService; +import com.lframework.xingyun.chart.vo.CreateOrderChartVo; +import com.lframework.xingyun.core.events.order.ApprovePassOrderEvent; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Slf4j +@Component +public class OrderDataListener implements ApplicationListener { + + @Autowired + private OrderChartService orderChartService; + + @Override + public void onApplicationEvent(ApprovePassOrderEvent event) { + + OrderChartBizType bizType = this.convertBizType(event.getOrderType()); + if (event.getOrderType() == null) { + log.error("orderType={},无法匹配业务类型", event.getOrderType()); + return; + } + + CreateOrderChartVo vo = new CreateOrderChartVo(); + vo.setTotalAmount(event.getTotalAmount()); + vo.setCreateTime(event.getApproveTime()); + vo.setBizType(bizType.getCode()); + + orderChartService.create(vo); + } + + private OrderChartBizType convertBizType(ApprovePassOrderEvent.OrderType orderType) { + + if (orderType == ApprovePassOrderEvent.OrderType.PURCHASE_ORDER) { + return OrderChartBizType.PURCHASE_ORDER; + } + if (orderType == ApprovePassOrderEvent.OrderType.PURCHASE_RETURN) { + return OrderChartBizType.PURCHASE_RETURN; + } + if (orderType == ApprovePassOrderEvent.OrderType.SALE_ORDER) { + return OrderChartBizType.SALE_ORDER; + } + if (orderType == ApprovePassOrderEvent.OrderType.SALE_RETURN) { + return OrderChartBizType.SALE_RETURN; + } + if (orderType == ApprovePassOrderEvent.OrderType.RETAIL_OUT_SHEET) { + return OrderChartBizType.RETAIL_OUT_SHEET; + } + if (orderType == ApprovePassOrderEvent.OrderType.RETAIL_RETURN) { + return OrderChartBizType.RETAIL_RETURN; + } + + return null; + } +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/mappers/OrderChartMapper.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/mappers/OrderChartMapper.java new file mode 100644 index 0000000..58a7979 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/mappers/OrderChartMapper.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.chart.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.entity.OrderChart; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-19 + */ +public interface OrderChartMapper extends BaseMapper { + + /** + * 汇总数据 + * + * @param bizTypes + * @param startTime + * @param endTime + * @return + */ + OrderChartSumDto getChartSum(@Param("bizTypes") List bizTypes, + @Param("startTime") LocalDateTime startTime, + @Param("endTime") LocalDateTime endTime); + + /** + * 查询列表 + * + * @param bizTypes + * @param startTime + * @param endTime + * @return + */ + List querySameMonth(@Param("bizTypes") List bizTypes, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); + + /** + * 查询当日数据列表 + * + * @param bizTypes + * @param startTime + * @param endTime + * @return + */ + List queryToday(@Param("bizTypes") List bizTypes, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/service/OrderChartService.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/service/OrderChartService.java new file mode 100644 index 0000000..f2ba3a3 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/service/OrderChartService.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.chart.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.chart.dto.OrderChartSameMonthDto; +import com.lframework.xingyun.chart.dto.OrderChartSumDto; +import com.lframework.xingyun.chart.dto.OrderChartTodayDto; +import com.lframework.xingyun.chart.entity.OrderChart; +import com.lframework.xingyun.chart.vo.CreateOrderChartVo; +import com.lframework.xingyun.chart.vo.GetOrderChartVo; +import com.lframework.xingyun.chart.vo.QueryOrderChartVo; +import java.util.List; + +public interface OrderChartService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateOrderChartVo vo); + + /** + * 查询当日汇总数据 + * + * @param vo + * @return + */ + OrderChartSumDto getTodayChartSum(GetOrderChartVo vo); + + /** + * 查询当月汇总数据 + * + * @param vo + * @return + */ + OrderChartSumDto getSameMonthChartSum(GetOrderChartVo vo); + + /** + * 查询当日数据 + * + * @param vo + * @return + */ + List queryTodayChart(QueryOrderChartVo vo); + + /** + * 查询当月数据 + * + * @param vo + * @return + */ + List querySameMonthChart(QueryOrderChartVo vo); +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/CreateOrderChartVo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/CreateOrderChartVo.java new file mode 100644 index 0000000..491f4a8 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/CreateOrderChartVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.chart.vo; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.chart.enums.OrderChartBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateOrderChartVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据总金额 + */ + @ApiModelProperty(value = "单据总金额", required = true) + @NotNull(message = "单据总金额不能为空!") + private BigDecimal totalAmount; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不存在!", enumClass = OrderChartBizType.class) + private Integer bizType; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/GetOrderChartVo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/GetOrderChartVo.java new file mode 100644 index 0000000..1f6ad89 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/GetOrderChartVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.chart.vo; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class GetOrderChartVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotEmpty(message = "业务类型不能为空!") + private List bizTypes; +} diff --git a/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/QueryOrderChartVo.java b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/QueryOrderChartVo.java new file mode 100644 index 0000000..17dd688 --- /dev/null +++ b/xingyun-chart/src/main/java/com/lframework/xingyun/chart/vo/QueryOrderChartVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.chart.vo; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class QueryOrderChartVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotEmpty(message = "业务类型不能为空!") + private List bizTypes; +} diff --git a/xingyun-chart/src/main/java/lombok.config b/xingyun-chart/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-chart/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-chart/src/main/resources/mappers/OrderChartMapper.xml b/xingyun-chart/src/main/resources/mappers/OrderChartMapper.xml new file mode 100644 index 0000000..03a6246 --- /dev/null +++ b/xingyun-chart/src/main/resources/mappers/OrderChartMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xingyun-common/pom.xml b/xingyun-common/pom.xml new file mode 100644 index 0000000..2d4633e --- /dev/null +++ b/xingyun-common/pom.xml @@ -0,0 +1,22 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-common + 【${project.artifactId}】公共组件服务层 + + + + com.lframework + xingyun-core + + + + \ No newline at end of file diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/components/MapLocationBo.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/components/MapLocationBo.java new file mode 100644 index 0000000..d114bcd --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/components/MapLocationBo.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.common.bo.components; + +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class MapLocationBo extends BaseBo { + + /** + * 经度 + */ + @ApiModelProperty("经度") + private BigDecimal lng; + + /** + * 纬度 + */ + @ApiModelProperty("纬度") + private BigDecimal lat; +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/components/OrderTimeLineBo.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/components/OrderTimeLineBo.java new file mode 100644 index 0000000..79bb7d4 --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/components/OrderTimeLineBo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.common.bo.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + * @author zmj + * @since 2022/8/10 + */ +@Data +public class OrderTimeLineBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 订单ID + */ + @ApiModelProperty("订单ID") + private String orderId; + + /** + * 描述内容 + */ + @ApiModelProperty("描述内容") + private String content; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + private Integer bizType; + + public OrderTimeLineBo() { + } + + public OrderTimeLineBo(OrderTimeLine dto) { + super(dto); + } + + @Override + protected void afterInit(OrderTimeLine dto) { + + this.bizType = dto.getBizType().getCode(); + } +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/dic/CitySelectorBo.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/dic/CitySelectorBo.java new file mode 100644 index 0000000..2a28b5c --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/dic/CitySelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.common.bo.dic; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CitySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + public CitySelectorBo() { + + } + + public CitySelectorBo(DicCityDto dto) { + + super(dto); + } +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/excel/GetOnlineExcelBo.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/excel/GetOnlineExcelBo.java new file mode 100644 index 0000000..688dffe --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/excel/GetOnlineExcelBo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.common.bo.sw.excel; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.core.entity.OnlineExcel; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 在线Excel GetBo + *

+ */ +@Data +public class GetOnlineExcelBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public GetOnlineExcelBo() { + + } + + public GetOnlineExcelBo(OnlineExcel dto) { + + super(dto); + } + +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/excel/QueryOnlineExcelBo.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/excel/QueryOnlineExcelBo.java new file mode 100644 index 0000000..984e600 --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/excel/QueryOnlineExcelBo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.common.bo.sw.excel; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.core.entity.OnlineExcel; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 在线Excel QueryBo + *

+ */ +@Data +public class QueryOnlineExcelBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryOnlineExcelBo() { + + } + + public QueryOnlineExcelBo(OnlineExcel dto) { + + super(dto); + } + +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/filebox/GetFileBoxBo.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/filebox/GetFileBoxBo.java new file mode 100644 index 0000000..de6d7ed --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/filebox/GetFileBoxBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.common.bo.sw.filebox; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.core.entity.FileBox; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 文件收纳箱 GetBo + *

+ */ +@Data +public class GetFileBoxBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * Url + */ + @ApiModelProperty("Url") + private String url; + + /** + * 上传类型 + */ + @ApiModelProperty("上传类型") + private String contentType; + + @ApiModelProperty("文件类型") + @EnumConvert + private Integer fileType; + + /** + * 文件大小 + */ + @ApiModelProperty("文件大小") + private String fileSize; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + public GetFileBoxBo() { + + } + + public GetFileBoxBo(FileBox dto) { + + super(dto); + } + +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/filebox/QueryFileBoxBo.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/filebox/QueryFileBoxBo.java new file mode 100644 index 0000000..abf11ea --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/bo/sw/filebox/QueryFileBoxBo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.common.bo.sw.filebox; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.core.entity.FileBox; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 文件收纳箱 QueryBo + *

+ */ +@Data +public class QueryFileBoxBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("文件大小") + private String fileSize; + + @ApiModelProperty("文件类型") + @EnumConvert + private Integer fileType; + + @ApiModelProperty("文件路径") + private String filePath; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + public QueryFileBoxBo() { + + } + + public QueryFileBoxBo(FileBox dto) { + + super(dto); + } + +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/SelectorController.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/SelectorController.java new file mode 100644 index 0000000..6d09750 --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/SelectorController.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.common.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.common.bo.dic.CitySelectorBo; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据选择器 + * + * @author zmj + */ +@Api(tags = "数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class SelectorController extends DefaultBaseController { + + @Autowired + private DicCityService dicCityService; + + /** + * 城市数据 + */ + @ApiOperation("城市数据") + @GetMapping("/city") + public InvokeResult> dicCity() { + + List datas = dicCityService.getAll(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(CitySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/components/ComponentController.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/components/ComponentController.java new file mode 100644 index 0000000..e844dda --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/components/ComponentController.java @@ -0,0 +1,153 @@ +package com.lframework.xingyun.common.controller.components; + +import cn.hutool.crypto.SecureUtil; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.FileUtil; +import com.lframework.starter.web.bo.ExcelImportBo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.service.SysParameterService; +import com.lframework.starter.web.utils.ExcelImportUtil; +import com.lframework.starter.web.utils.HttpUtil; +import com.lframework.starter.web.utils.JsonUtil; +import com.lframework.starter.web.utils.UploadUtil; +import com.lframework.xingyun.common.bo.components.MapLocationBo; +import com.lframework.xingyun.common.bo.components.OrderTimeLineBo; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import com.lframework.xingyun.core.service.OrderTimeLineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 公共组件 Controller + */ +@Slf4j +@Api(tags = "公共组件") +@Validated +@RestController +@RequestMapping("/component") +public class ComponentController extends DefaultBaseController { + + @Autowired + private SysParameterService sysParameterService; + + @Autowired + private OrderTimeLineService orderTimeLineService; + + @ApiOperation("查询导入Excel任务") + @GetMapping("/import/task") + public InvokeResult getExcelImportTask(@NotBlank(message = "ID不能为空!") String id) { + + return InvokeResultBuilder.success(ExcelImportUtil.getTask(id)); + } + + @ApiOperation("获取地图Key") + @GetMapping("/map/key") + public InvokeResult getMapKey() { + String key = sysParameterService.findRequiredByKey("tx-map.key"); + + return InvokeResultBuilder.success(key); + } + + @ApiOperation("根据地址查询经纬度") + @GetMapping("/map/location") + public InvokeResult getMapLocation(@NotEmpty(message = "地址不能为空!") String address) { + + String key = sysParameterService.findRequiredByKey("tx-map.key"); + String secret = sysParameterService.findRequiredByKey("tx-map.secret"); + + // 请求腾讯地图WebService Api + // Api文档地址:https://lbs.qq.com/service/webService/webServiceGuide/webServiceGeocoder + String baseUrl = "https://apis.map.qq.com/"; + String uri = "/ws/geocoder/v1/"; + String reqParams = "?address=" + address + "&key=" + key; + + // Api使用签名方式 + // 签名文档:https://lbs.qq.com/faq/serverFaq/webServiceKey + String sign = SecureUtil.md5(uri + reqParams + secret); + Map reqMap = new HashMap<>(); + reqMap.put("address", address); + reqMap.put("key", key); + reqMap.put("sig", sign); + + try { + String resp = HttpUtil.doGet(baseUrl + uri, reqMap); + Map respMap = JsonUtil.parseObject(resp, Map.class); + if (!"0".equals(String.valueOf(respMap.get("status")))) { + throw new DefaultClientException(String.valueOf(respMap.get("message"))); + } + + Map result = (Map) respMap.get("result"); + Map location = (Map) result.get("location"); + MapLocationBo bo = new MapLocationBo(); + bo.setLng(new BigDecimal(String.valueOf(location.get("lng")))); + bo.setLat(new BigDecimal(String.valueOf(location.get("lat")))); + + return InvokeResultBuilder.success(bo); + } catch (ClientException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultClientException("解析地址失败,请稍后再试!"); + } + } + + @ApiOperation("单据时间轴") + @ApiImplicitParam(value = "单据ID", name = "orderId", paramType = "query", required = true) + @GetMapping("/timeline/order") + public InvokeResult> getOrderTimeLine( + @NotBlank(message = "单据ID不能为空!") String orderId) { + + List datas = orderTimeLineService.getByOrder(orderId); + List results = datas.stream().map(OrderTimeLineBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("通用上传图片") + @PostMapping("/upload/image") + public InvokeResult uploadImage(MultipartFile file) { + if (!FileUtil.IMG_SUFFIX.contains(FileUtil.getSuffix(file.getOriginalFilename()).toLowerCase())) { + throw new DefaultClientException( + "上传图片仅支持【" + CollectionUtil.join(FileUtil.IMG_SUFFIX, StringPool.STR_SPLIT_CN) + "】格式!"); + } + + String url = UploadUtil.upload(file); + + return InvokeResultBuilder.success(url); + } + + @ApiOperation("通用上传视频") + @PostMapping("/upload/video") + public InvokeResult uploadVideo(MultipartFile file) { + if (!FileUtil.VIDEO_SUFFIX.contains(FileUtil.getSuffix(file.getOriginalFilename()).toLowerCase())) { + throw new DefaultClientException( + "上传视频仅支持【" + CollectionUtil.join(FileUtil.VIDEO_SUFFIX, StringPool.STR_SPLIT_CN) + "】格式!"); + } + + String url = UploadUtil.upload(file); + + return InvokeResultBuilder.success(url); + } +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/sw/FileBoxController.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/sw/FileBoxController.java new file mode 100644 index 0000000..1833891 --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/sw/FileBoxController.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.common.controller.sw; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.common.bo.sw.filebox.GetFileBoxBo; +import com.lframework.xingyun.common.bo.sw.filebox.QueryFileBoxBo; +import com.lframework.xingyun.core.entity.FileBox; +import com.lframework.xingyun.core.service.FileBoxService; +import com.lframework.xingyun.core.vo.sw.filebox.CreateFileBoxDirVo; +import com.lframework.xingyun.core.vo.sw.filebox.QueryFileBoxVo; +import com.lframework.xingyun.core.vo.sw.filebox.UpdateFileBoxVo; +import com.lframework.xingyun.core.vo.sw.filebox.UploadFileBoxVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 文件收纳箱 Controller + */ +@Api(tags = "文件收纳箱") +@Validated +@RestController +@RequestMapping("/sw/filebox") +public class FileBoxController extends DefaultBaseController { + + @Autowired + private FileBoxService fileBoxService; + + @ApiOperation("创建文件夹") + @PostMapping("/dir") + public InvokeResult createDir(@Valid CreateFileBoxDirVo vo) { + + fileBoxService.createDir(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 上传文件 + */ + @ApiOperation("上传文件") + @PostMapping("/upload") + public InvokeResult upload(@Valid UploadFileBoxVo vo) { + + fileBoxService.upload(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryFileBoxVo vo) { + + PageResult pageResult = fileBoxService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryFileBoxBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + FileBox data = fileBoxService.findById(id); + if (data == null) { + throw new DefaultClientException("文件收纳箱不存在!"); + } + + GetFileBoxBo result = new GetFileBoxBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@Valid UpdateFileBoxVo vo) { + + fileBoxService.update(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量删除") + @DeleteMapping("/batch") + public InvokeResult batchDelete(@RequestBody List ids) { + fileBoxService.batchDelete(ids); + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/sw/OnlineExcelController.java b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/sw/OnlineExcelController.java new file mode 100644 index 0000000..496429c --- /dev/null +++ b/xingyun-common/src/main/java/com/lframework/xingyun/common/controller/sw/OnlineExcelController.java @@ -0,0 +1,158 @@ +package com.lframework.xingyun.common.controller.sw; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.xingyun.common.bo.sw.excel.GetOnlineExcelBo; +import com.lframework.xingyun.common.bo.sw.excel.QueryOnlineExcelBo; +import com.lframework.xingyun.core.entity.OnlineExcel; +import com.lframework.xingyun.core.service.OnlineExcelService; +import com.lframework.xingyun.core.vo.sw.excel.BatchSendOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.CreateOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.QueryOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.SendOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.UpdateOnlineExcelContentVo; +import com.lframework.xingyun.core.vo.sw.excel.UpdateOnlineExcelVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 在线Excel Controller + */ +@Api(tags = "在线Excel") +@Validated +@RestController +@RequestMapping("/sw/excel") +public class OnlineExcelController extends DefaultBaseController { + + @Autowired + private OnlineExcelService onlineExcelService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryOnlineExcelVo vo) { + + PageResult pageResult = onlineExcelService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryOnlineExcelBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + OnlineExcel data = onlineExcelService.findById(id); + if (data == null) { + throw new DefaultClientException("在线Excel不存在!"); + } + + GetOnlineExcelBo result = new GetOnlineExcelBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @PostMapping + public InvokeResult create(@Valid CreateOnlineExcelVo vo) { + + onlineExcelService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@Valid UpdateOnlineExcelVo vo) { + + onlineExcelService.update(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("查询内容") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @GetMapping("/content") + public InvokeResult getContent(@NotBlank(message = "id不能为空!") String id) { + + OnlineExcel data = onlineExcelService.findById(id); + if (data == null) { + throw new DefaultClientException("文件不存在!"); + } + + return InvokeResultBuilder.success(data.getContent()); + } + + @ApiOperation("修改内容") + @PutMapping("/content") + public InvokeResult updateContent(@Valid UpdateOnlineExcelContentVo vo) { + + onlineExcelService.updateContent(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("发送文件给他人") + @PostMapping("/send") + public InvokeResult send(@Valid SendOnlineExcelVo vo) { + + if (vo.getUserId().equals(SecurityUtil.getCurrentUser().getId())) { + throw new DefaultClientException("文件不能发送给自己!"); + } + + onlineExcelService.send(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量发送文件给他人") + @PostMapping("/send/batch") + public InvokeResult batchSend(@Valid @RequestBody BatchSendOnlineExcelVo vo) { + + if (vo.getUserId().equals(SecurityUtil.getCurrentUser().getId())) { + throw new DefaultClientException("文件不能发送给自己!"); + } + + onlineExcelService.batchSend(vo); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-common/src/main/java/lombok.config b/xingyun-common/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-common/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-core/pom.xml b/xingyun-core/pom.xml new file mode 100644 index 0000000..76d1f33 --- /dev/null +++ b/xingyun-core/pom.xml @@ -0,0 +1,25 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-core + 【${project.artifactId}】基础依赖 + + + + com.lframework + xingyun-template-core + + + com.lframework + websocket-starter + + + diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/annations/OrderTimeLineLog.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/annations/OrderTimeLineLog.java new file mode 100644 index 0000000..10418eb --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/annations/OrderTimeLineLog.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.core.annations; + +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 单据时间轴记录 + * 如果出现嵌套那么以最外层的为准,不会进行嵌套隔离 + * @author zmj + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface OrderTimeLineLog { + + /** + * 业务类型 + * + * @return + */ + OrderTimeLineBizType type() default OrderTimeLineBizType.NORMAL; + + /** + * 单据ID + * @return + */ + String[] orderId(); + + /** + * 内容 需要填充参数部分用{}占位,会根据params的值进行填充 + * + * @return + */ + String name() default ""; + + /** + * 需要保存的参数 Spel表达式 + * + * @return + */ + String[] params() default {}; + + /** + * 是否循环填充内容 会将params中的collection循环format + * + * @return + */ + boolean loopFormat() default false; + + /** + * 是否为删除操作 + * 如果为删除操作,那么忽略type、name、loopFormat,直接根据orderId进行删除操作 + * @return + */ + boolean delete() default false; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/aop/OrderTimeLineLogAspect.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/aop/OrderTimeLineLogAspect.java new file mode 100644 index 0000000..8ef4f55 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/aop/OrderTimeLineLogAspect.java @@ -0,0 +1,224 @@ +package com.lframework.xingyun.core.aop; + +import com.lframework.starter.common.utils.ArrayUtil; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.config.properties.DefaultSettingProperties; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.SpelUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import com.lframework.xingyun.core.service.OrderTimeLineService; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.expression.EvaluationContext; +import org.springframework.stereotype.Component; + +/** + * 单据时间轴切面 + * + * @author zmj + */ +@Slf4j +@Aspect +@Component +public class OrderTimeLineLogAspect { + + @Autowired + private DefaultSettingProperties defaultSettingProperties; + + private final ThreadLocal POOL = new ThreadLocal<>(); + + @Pointcut("@annotation(com.lframework.xingyun.core.annations.OrderTimeLineLog)") + public void orderTimeLineLogCutPoint() { + + } + + @Around(value = "orderTimeLineLogCutPoint()") + public Object orderTimeLineLog(ProceedingJoinPoint joinPoint) throws Throwable { + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + String curUserId = + currentUser == null ? defaultSettingProperties.getDefaultUserId() : currentUser.getId(); + String curUserName = + currentUser == null ? defaultSettingProperties.getDefaultUserName() : currentUser.getName(); + + Object value = null; + + try { + if (POOL.get() != null) { + POOL.set(POOL.get() + 1); + // 如果出现嵌套,那么以最外层的为准,不进行嵌套隔离 + return joinPoint.proceed(); + } + + POOL.set(1); + + value = joinPoint.proceed(); + + try { + //获取方法的参数名和参数值 + MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); + List paramNameList = Arrays.asList(methodSignature.getParameterNames()); + List paramList = Arrays.asList(joinPoint.getArgs()); + + //将方法的参数名和参数值一一对应的放入上下文中 + EvaluationContext ctx = SpelUtil.buildContext(); + for (int i = 0; i < paramNameList.size(); i++) { + ctx.setVariable(paramNameList.get(i), paramList.get(i)); + } + + //将返回值放入上下文中 + ctx.setVariable("_result", value); + + // 解析SpEL表达式获取结果 + Object[] params; + OrderTimeLineLog orderTimeLineLog = methodSignature.getMethod() + .getAnnotation(OrderTimeLineLog.class); + if (!ArrayUtil.isEmpty(orderTimeLineLog.params())) { + params = new Object[orderTimeLineLog.params().length]; + for (int i = 0; i < orderTimeLineLog.params().length; i++) { + String param = orderTimeLineLog.params()[i]; + Object p = SpelUtil.parse(param, ctx); + params[i] = p; + } + } else { + params = new String[0]; + } + + List paramsList = new ArrayList<>(); + //循环format + if (orderTimeLineLog.loopFormat() && Arrays.stream(params) + .anyMatch(t -> t instanceof Collection)) { + String[] strParams = new String[params.length]; + //collectionIndex的索引 + List collectionIndexes = new ArrayList<>(); + for (int i = 0; i < params.length; i++) { + //先处理不是Collection的元素 + if (params[i] instanceof Collection) { + collectionIndexes.add(i); + continue; + } + strParams[i] = params[i] == null ? null : params[i].toString(); + } + + paramsList.add(strParams); + + if (!CollectionUtil.isEmpty(collectionIndexes)) { + //将所有的collection组合,例:collection1的size是2 collection2的size是3 则组合后的条数为2*3=6 + for (Integer collectionIndex : collectionIndexes) { + List tmpParamsList = new ArrayList<>(); + for (String[] paramsArr : paramsList) { + + Collection collection = (Collection) params[collectionIndex]; + for (Object o : collection) { + String[] tmp = new String[paramsArr.length]; + for (int j = 0; j < paramsArr.length; j++) { + if (j == collectionIndex) { + tmp[j] = o == null ? null : o.toString(); + } else { + tmp[j] = paramsArr[j]; + } + } + + tmpParamsList.add(tmp); + } + } + + paramsList.clear(); + paramsList.addAll(tmpParamsList); + } + } else { + paramsList.add(strParams); + } + } else { + String[] strParams = new String[params.length]; + for (int i = 0; i < params.length; i++) { + strParams[i] = params[i] == null ? null : params[i].toString(); + } + paramsList.add(strParams); + } + + Object[] orderIds; + if (!ArrayUtil.isEmpty(orderTimeLineLog.orderId())) { + orderIds = new Object[orderTimeLineLog.orderId().length]; + for (int i = 0; i < orderTimeLineLog.orderId().length; i++) { + String orderId = orderTimeLineLog.orderId()[i]; + Object p = SpelUtil.parse(orderId, ctx); + orderIds[i] = p; + } + } else { + orderIds = new String[0]; + } + + List orderIdList = new ArrayList<>(); + for (Object orderId : orderIds) { + if (orderId == null) { + continue; + } + + if (orderId instanceof Collection) { + Collection c = (Collection) orderId; + CollectionUtil.forEach(c, (item, index) -> orderIdList.add(item.toString())); + } + + orderIdList.add(orderId.toString()); + } + + if (orderTimeLineLog.delete()) { + for (String orderId : orderIdList) { + // 这里不异步,在同事务内执行 + OrderTimeLineService orderTimeLineService = ApplicationUtil.getBean( + OrderTimeLineService.class); + orderTimeLineService.deleteByOrder(orderId); + orderTimeLineService.cleanCacheByKey(orderId); + } + } else { + List records = new ArrayList<>(); + OrderTimeLineService orderTimeLineService = ApplicationUtil.getBean( + OrderTimeLineService.class); + for (String[] strArr : paramsList) { + for (String orderId : orderIdList) { + OrderTimeLine record = new OrderTimeLine(); + record.setId(IdUtil.getId()); + record.setOrderId(orderId); + record.setContent(StringUtil.format(orderTimeLineLog.name(), strArr)); + record.setCreateBy(curUserName); + record.setCreateById(curUserId); + record.setBizType(orderTimeLineLog.type()); + records.add(record); + } + } + if (CollectionUtil.isNotEmpty(records)) { + // 这里不异步,在同事务内执行 + orderTimeLineService.saveBatch(records); + orderTimeLineService.cleanCacheByKeys(orderIdList); + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } finally { + if (POOL.get() != null) { + POOL.set(POOL.get() - 1); + if (POOL.get() <= 0) { + POOL.remove(); + } + } + } + return value; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/bo/print/A4ExcelPortraitPrintBo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/bo/print/A4ExcelPortraitPrintBo.java new file mode 100644 index 0000000..374a1ed --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/bo/print/A4ExcelPortraitPrintBo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.core.bo.print; + +import com.lframework.starter.web.bo.BasePrintBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + * Excel文件的A4纸纵向打印的默认设置 + */ +@Data +public class A4ExcelPortraitPrintBo> extends + BasePrintBo { + + public A4ExcelPortraitPrintBo(String templateName) { + + this(templateName, null); + } + + public A4ExcelPortraitPrintBo(String templateName, T data) { + + super(templateName, data); + + this.setOrient(2); + this.setPageHeight(2970); + this.setPageWidth(2100); + this.setPageName("A4"); + + this.setMarginTop(19.1D); + this.setMarginRight(17.8D); + this.setMarginBottom(19.1D); + this.setMarginLeft(17.8D); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/dto/dic/city/DicCityDto.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/dto/dic/city/DicCityDto.java new file mode 100644 index 0000000..8be955e --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/dto/dic/city/DicCityDto.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.core.dto.dic.city; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class DicCityDto implements BaseDto, Serializable { + + public static final String CACHE_NAME = "DicCityDto"; + + public static final String SELECTOR_CACHE_NAME = "DicCitySelectorDto"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 父级ID + */ + private String parentId; + + /** + * 层级 + */ + private Integer level; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/dto/stock/ProductStockChangeDto.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/dto/stock/ProductStockChangeDto.java new file mode 100644 index 0000000..71446b1 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/dto/stock/ProductStockChangeDto.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.core.dto.stock; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +@Data +public class ProductStockChangeDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + private String scId; + + /** + * 商品ID + */ + private String productId; + + /** + * 变动数量 + */ + private Integer num; + + /** + * 含税金额 + */ + private BigDecimal taxAmount; + + /** + * 当前含税均价 + */ + private BigDecimal curTaxPrice; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/DicCity.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/DicCity.java new file mode 100644 index 0000000..b8bdc1e --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/DicCity.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.core.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-07 + */ +@Data +@TableName("dic_city") +public class DicCity extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 父级ID + */ + private String parentId; + + /** + * 层级 + */ + private Integer level; + + /** + * 状态 + */ + private Boolean available; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/FileBox.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/FileBox.java new file mode 100644 index 0000000..95f7db1 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/FileBox.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.core.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.core.enums.FileBoxFileType; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 文件收纳箱 + *

+ */ +@Data +@TableName("sw_file_box") +public class FileBox extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "FileBox"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * Url + */ + private String url; + + /** + * ContentType + */ + private String contentType; + + /** + * 文件类型 + */ + private FileBoxFileType fileType; + + /** + * 文件大小 + */ + private String fileSize; + + /** + * 文件路径 + */ + private String filePath; + + /** + * 文件后缀 + */ + private String fileSuffix; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/OnlineExcel.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/OnlineExcel.java new file mode 100644 index 0000000..8d50fce --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/OnlineExcel.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.core.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 在线Excel + *

+ */ +@Data +@TableName("sw_online_excel") +public class OnlineExcel extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "OnlineExcel"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 内容 + */ + private String content; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/OrderTimeLine.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/OrderTimeLine.java new file mode 100644 index 0000000..95af84a --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/entity/OrderTimeLine.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.core.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-07 + */ +@Data +@TableName("tbl_order_time_line") +public class OrderTimeLine extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "OrderTimeLine"; + + /** + * ID + */ + private String id; + + /** + * 订单ID + */ + private String orderId; + + /** + * 描述内容 + */ + private String content; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 业务类型 + */ + private OrderTimeLineBizType bizType; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/FileBoxFileType.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/FileBoxFileType.java new file mode 100644 index 0000000..c338ae8 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/FileBoxFileType.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum FileBoxFileType implements BaseEnum { + DIR(0, "目录"), + FILE(1, "文件"), + ; + + @EnumValue + private final Integer code; + + private final String desc; + + FileBoxFileType(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getDesc() { + return this.desc; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/FileBoxNodeType.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/FileBoxNodeType.java new file mode 100644 index 0000000..4e08ff0 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/FileBoxNodeType.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.core.enums; + +import com.lframework.xingyun.template.core.enums.NodeType; +import java.io.Serializable; +import org.springframework.stereotype.Component; + +@Component +public final class FileBoxNodeType implements NodeType, Serializable { + + private static final long serialVersionUID = 1L; + + @Override + public Integer getCode() { + + return 3; + } + + @Override + public String getDesc() { + + return "文件收纳箱"; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/OrderTimeLineBizType.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/OrderTimeLineBizType.java new file mode 100644 index 0000000..240006f --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/OrderTimeLineBizType.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +/** + * @author zmj + * @since 2022/8/10 + */ +public enum OrderTimeLineBizType implements BaseEnum { + NORMAL(0, "普通操作"), + CREATE(1, "保存"), + UPDATE(2, "修改"), + SEND(3, "发送"), + APPROVE_PASS(4, "审核通过"), + APPROVE_RETURN(5, "审核拒绝"), + CANCEL_APPROVE(6, "取消审核"), + APPROVE_SEND(8, "发送审批"), + RECEIVE(7, "收货") + + ; + + @EnumValue + private final Integer code; + + private final String desc; + + OrderTimeLineBizType(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getDesc() { + return this.desc; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/SwOpLogType.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/SwOpLogType.java new file mode 100644 index 0000000..e7ff780 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/enums/SwOpLogType.java @@ -0,0 +1,7 @@ +package com.lframework.xingyun.core.enums; + +public interface SwOpLogType { + + // 便捷办公 + int SW = 4000; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/ApprovePassOrderEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/ApprovePassOrderEvent.java new file mode 100644 index 0000000..962b4f6 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/ApprovePassOrderEvent.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.core.events.order; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Getter; +import lombok.Setter; +import org.springframework.context.ApplicationEvent; + +/** + * 业务单据审核通过Event + */ +public abstract class ApprovePassOrderEvent extends ApplicationEvent { + + /** + * 业务单据ID + */ + @Getter + @Setter + private String id; + + /** + * 单据总金额 + */ + @Getter + @Setter + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + @Getter + @Setter + private LocalDateTime approveTime = LocalDateTime.now(); + + /** + * 单据类型 + */ + @Getter + private OrderType orderType; + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassOrderEvent(Object source, OrderType orderType) { + + super(source); + this.orderType = orderType; + } + + public enum OrderType { + PURCHASE_ORDER, PURCHASE_RETURN, SALE_ORDER, SALE_RETURN, RETAIL_OUT_SHEET, RETAIL_RETURN + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassPurchaseOrderEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassPurchaseOrderEvent.java new file mode 100644 index 0000000..7be0446 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassPurchaseOrderEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.core.events.order.impl; + +import com.lframework.xingyun.core.events.order.ApprovePassOrderEvent; + +public class ApprovePassPurchaseOrderEvent extends ApprovePassOrderEvent { + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassPurchaseOrderEvent(Object source) { + + super(source, OrderType.PURCHASE_ORDER); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassPurchaseReturnEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassPurchaseReturnEvent.java new file mode 100644 index 0000000..f97f50a --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassPurchaseReturnEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.core.events.order.impl; + +import com.lframework.xingyun.core.events.order.ApprovePassOrderEvent; + +public class ApprovePassPurchaseReturnEvent extends ApprovePassOrderEvent { + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassPurchaseReturnEvent(Object source) { + + super(source, OrderType.PURCHASE_RETURN); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassRetailOutSheetEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassRetailOutSheetEvent.java new file mode 100644 index 0000000..c653ddb --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassRetailOutSheetEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.core.events.order.impl; + +import com.lframework.xingyun.core.events.order.ApprovePassOrderEvent; + +public class ApprovePassRetailOutSheetEvent extends ApprovePassOrderEvent { + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassRetailOutSheetEvent(Object source) { + + super(source, OrderType.RETAIL_OUT_SHEET); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassRetailReturnEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassRetailReturnEvent.java new file mode 100644 index 0000000..db68045 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassRetailReturnEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.core.events.order.impl; + +import com.lframework.xingyun.core.events.order.ApprovePassOrderEvent; + +public class ApprovePassRetailReturnEvent extends ApprovePassOrderEvent { + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassRetailReturnEvent(Object source) { + + super(source, OrderType.RETAIL_RETURN); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassSaleOrderEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassSaleOrderEvent.java new file mode 100644 index 0000000..5560053 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassSaleOrderEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.core.events.order.impl; + +import com.lframework.xingyun.core.events.order.ApprovePassOrderEvent; + +public class ApprovePassSaleOrderEvent extends ApprovePassOrderEvent { + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassSaleOrderEvent(Object source) { + + super(source, OrderType.SALE_ORDER); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassSaleReturnEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassSaleReturnEvent.java new file mode 100644 index 0000000..94eaff6 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/order/impl/ApprovePassSaleReturnEvent.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.core.events.order.impl; + +import com.lframework.xingyun.core.events.order.ApprovePassOrderEvent; + +public class ApprovePassSaleReturnEvent extends ApprovePassOrderEvent { + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public ApprovePassSaleReturnEvent(Object source) { + + super(source, OrderType.SALE_RETURN); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/AddStockEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/AddStockEvent.java new file mode 100644 index 0000000..b9ab4cf --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/AddStockEvent.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.core.events.stock; + +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import org.springframework.context.ApplicationEvent; + +/** + * 入库事件 + */ +public class AddStockEvent extends ApplicationEvent { + + /** + * 变动记录 + */ + private ProductStockChangeDto change; + + public AddStockEvent(Object source, ProductStockChangeDto change) { + + super(source); + this.change = change; + } + + public ProductStockChangeDto getChange() { + + return change; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/SubStockEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/SubStockEvent.java new file mode 100644 index 0000000..eedca74 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/SubStockEvent.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.core.events.stock; + +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import org.springframework.context.ApplicationEvent; + +/** + * 出库事件 + */ +public class SubStockEvent extends ApplicationEvent { + + /** + * 变动记录 + */ + private ProductStockChangeDto change; + + public SubStockEvent(Object source, ProductStockChangeDto change) { + + super(source); + this.change = change; + } + + public ProductStockChangeDto getChange() { + + return change; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/take/DeleteTakeStockPlanEvent.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/take/DeleteTakeStockPlanEvent.java new file mode 100644 index 0000000..4f98c93 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/events/stock/take/DeleteTakeStockPlanEvent.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.core.events.stock.take; + +import org.springframework.context.ApplicationEvent; + +/** + * 删除盘点任务事件 + */ +public class DeleteTakeStockPlanEvent extends ApplicationEvent { + + /** + * 盘点任务ID + */ + private String id; + + public DeleteTakeStockPlanEvent(Object source, String id) { + + super(source); + + this.id = id; + } + + public String getId() { + + return id; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/DicCityServiceImpl.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/DicCityServiceImpl.java new file mode 100644 index 0000000..ddc45e4 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/DicCityServiceImpl.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.core.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.entity.DicCity; +import com.lframework.xingyun.core.mappers.DicCityMapper; +import com.lframework.xingyun.core.service.DicCityService; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class DicCityServiceImpl extends BaseMpServiceImpl implements + DicCityService { + + @Cacheable(value = DicCityDto.SELECTOR_CACHE_NAME, key = "@cacheVariables.tenantId() + 'all'") + @Override + public List getAll() { + + return getBaseMapper().getAll(); + } + + @Cacheable(value = DicCityDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public DicCityDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Override + public List getChainById(String id) { + + DicCityService thisService = getThis(this.getClass()); + List all = thisService.getAll(); + List results = new ArrayList<>(); + DicCityDto current = all.stream().filter(t -> t.getId().equals(id)).findFirst().orElse(null); + if (current == null) { + return results; + } + + while (current != null) { + results.add(current); + + String pId = current.getParentId(); + current = all.stream().filter(t -> t.getId().equals(pId)).findFirst().orElse(null); + } + + Collections.reverse(results); + + return results; + } + + @CacheEvict(value = DicCityDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/FileBoxServiceImpl.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/FileBoxServiceImpl.java new file mode 100644 index 0000000..a4eab08 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/FileBoxServiceImpl.java @@ -0,0 +1,222 @@ +package com.lframework.xingyun.core.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.FileUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.UploadUtil; +import com.lframework.xingyun.core.entity.FileBox; +import com.lframework.xingyun.core.enums.FileBoxFileType; +import com.lframework.xingyun.core.enums.FileBoxNodeType; +import com.lframework.xingyun.core.enums.SwOpLogType; +import com.lframework.xingyun.core.mappers.FileBoxMapper; +import com.lframework.xingyun.core.service.FileBoxService; +import com.lframework.xingyun.core.vo.sw.filebox.CreateFileBoxDirVo; +import com.lframework.xingyun.core.vo.sw.filebox.QueryFileBoxVo; +import com.lframework.xingyun.core.vo.sw.filebox.UpdateFileBoxVo; +import com.lframework.xingyun.core.vo.sw.filebox.UploadFileBoxVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +@Service +public class FileBoxServiceImpl extends + BaseMpServiceImpl implements FileBoxService { + + @Autowired + private RecursionMappingService recursionMappingService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryFileBoxVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryFileBoxVo vo) { + + return getBaseMapper().query(vo, SecurityUtil.getCurrentUser().getId()); + } + + @Override + public FileBox findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SwOpLogType.SW, name = "修改文件,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateFileBoxVo vo) { + + FileBox data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("文件或文件夹不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(FileBox.class) + .set(data.getFileType() != FileBoxFileType.DIR, FileBox::getName, vo.getName()) + .set(FileBox::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR + : vo.getDescription()) + .eq(FileBox::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.SW, name = "删除文件,ID:{}", params = { + "#ids"}, loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + List delIds = new ArrayList<>(); + + for (String id : ids) { + + List childIds = recursionMappingService.getNodeChildIds(id, + ApplicationUtil.getBean(FileBoxNodeType.class)); + delIds.addAll(childIds); + } + + for (String id : ids) { + recursionMappingService.deleteNodeAndChildren(id, ApplicationUtil.getBean(FileBoxNodeType.class)); + } + + delIds.addAll(ids); + + Wrapper deleteWrapper = Wrappers.lambdaQuery(FileBox.class) + .in(FileBox::getId, delIds) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + this.remove(deleteWrapper); + } + + @OpLog(type = SwOpLogType.SW, name = "创建文件夹,父级目录:{},文件夹名称:{}", params = { + "#vo.parentPath", "#vo.name"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void createDir(CreateFileBoxDirVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(FileBox.class) + .eq(FileBox::getName, vo.getName()).eq(FileBox::getFilePath, vo.getParentPath()) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("文件夹名称重复,请重新输入!"); + } + FileBox dir = new FileBox(); + dir.setId(IdUtil.getId()); + dir.setName(vo.getName()); + dir.setFileType(FileBoxFileType.DIR); + dir.setFilePath(vo.getParentPath()); + dir.setDescription(StringPool.EMPTY_STR); + + this.save(dir); + + if ("/".equals(vo.getParentPath())) { + recursionMappingService.saveNode(dir.getId(), + ApplicationUtil.getBean(FileBoxNodeType.class)); + } else { + String path = vo.getParentPath().substring(0, vo.getParentPath().lastIndexOf("/") == 0 ? 1 : vo.getParentPath().lastIndexOf("/")); + String name = vo.getParentPath().substring(vo.getParentPath().lastIndexOf("/") + 1); + + Wrapper queryWrapper = Wrappers.lambdaQuery(FileBox.class) + .eq(FileBox::getName, name).eq(FileBox::getFilePath, path) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + FileBox fileBox = this.getOne(queryWrapper); + if (fileBox == null) { + throw new DefaultClientException("父级目录不存在!"); + } + + List parentIds = recursionMappingService.getNodeParentIds(fileBox.getId(), + ApplicationUtil.getBean(FileBoxNodeType.class)); + parentIds.add(fileBox.getId()); + + recursionMappingService.saveNode(dir.getId(), + ApplicationUtil.getBean(FileBoxNodeType.class), parentIds); + } + } + + @OpLog(type = SwOpLogType.SW, name = "上传文件,父级目录:{},文件名称:{}", params = { + "#vo.path", "#vo.name"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void upload(UploadFileBoxVo vo) { + MultipartFile file = vo.getFile(); + String url = UploadUtil.upload(file); + + FileBox record = new FileBox(); + record.setId(IdUtil.getId()); + record.setName(file.getOriginalFilename()); + record.setUrl(url); + record.setContentType(file.getContentType()); + record.setFileType(FileBoxFileType.FILE); + record.setFileSize(FileUtil.readableFileSize(file.getSize())); + record.setFilePath(vo.getPath()); + record.setFileSuffix(FileUtil.getSuffix(file.getOriginalFilename())); + record.setDescription(StringPool.EMPTY_STR); + + this.save(record); + + if ("/".equals(vo.getPath())) { + recursionMappingService.saveNode(record.getId(), + ApplicationUtil.getBean(FileBoxNodeType.class)); + } else { + String path = vo.getPath().substring(0, vo.getPath().lastIndexOf("/") == 0 ? 1 : vo.getPath().lastIndexOf("/")); + String name = vo.getPath().substring(vo.getPath().lastIndexOf("/") + 1); + + Wrapper queryWrapper = Wrappers.lambdaQuery(FileBox.class) + .eq(FileBox::getName, name).eq(FileBox::getFilePath, path) + .eq(FileBox::getCreateById, SecurityUtil.getCurrentUser().getId()); + FileBox fileBox = this.getOne(queryWrapper); + if (fileBox == null) { + throw new DefaultClientException("父级目录不存在!"); + } + + List parentIds = recursionMappingService.getNodeParentIds(fileBox.getId(), + ApplicationUtil.getBean(FileBoxNodeType.class)); + parentIds.add(fileBox.getId()); + + recursionMappingService.saveNode(record.getId(), + ApplicationUtil.getBean(FileBoxNodeType.class), parentIds); + } + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/OnlineExcelServiceImpl.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/OnlineExcelServiceImpl.java new file mode 100644 index 0000000..22a4c25 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/OnlineExcelServiceImpl.java @@ -0,0 +1,208 @@ +package com.lframework.xingyun.core.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.JsonUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.entity.OnlineExcel; +import com.lframework.xingyun.core.enums.SwOpLogType; +import com.lframework.xingyun.core.mappers.OnlineExcelMapper; +import com.lframework.xingyun.core.service.OnlineExcelService; +import com.lframework.xingyun.core.vo.sw.excel.BatchSendOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.CreateOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.QueryOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.SendOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.UpdateOnlineExcelContentVo; +import com.lframework.xingyun.core.vo.sw.excel.UpdateOnlineExcelVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class OnlineExcelServiceImpl extends + BaseMpServiceImpl implements OnlineExcelService { + + @Autowired + private UserService userService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryOnlineExcelVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryOnlineExcelVo vo) { + + return getBaseMapper().query(vo, SecurityUtil.getCurrentUser().getId()); + } + + @Override + public OnlineExcel findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SwOpLogType.SW, name = "新增在线Excel,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateOnlineExcelVo vo) { + + OnlineExcel data = new OnlineExcel(); + data.setId(IdUtil.getId()); + data.setName(vo.getName()); + data.setContent(vo.getContent()); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = SwOpLogType.SW, name = "修改在线Excel,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateOnlineExcelVo vo) { + + OnlineExcel data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("在线Excel不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(OnlineExcel.class) + .set(OnlineExcel::getName, vo.getName()).set(OnlineExcel::getAvailable, vo.getAvailable()) + .set(OnlineExcel::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(OnlineExcel::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.SW, name = "修改在线Excel内容,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void updateContent(UpdateOnlineExcelContentVo vo) { + OnlineExcel data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("在线Excel不存在!"); + } + + Map content = JsonUtil.parseObject(data.getContent(), Map.class); + List sheets = JsonUtil.parseList(vo.getContent(), Map.class); + content.put("sheets", sheets); + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(OnlineExcel.class) + .set(OnlineExcel::getContent, JsonUtil.toJsonString(content)) + .eq(OnlineExcel::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.SW, name = "发送Excel文件,发送方{}, 接收方{}", params = {"#sender", "#receiver"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void send(SendOnlineExcelVo vo) { + + OnlineExcel record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("Excel文件不存在!"); + } + + UserDto receiver = userService.findById(vo.getUserId()); + if (receiver == null) { + throw new DefaultClientException("接收方不存在!"); + } + + if (vo.getSelfSave()) { + record.setId(IdUtil.getId()); + record.setAvailable(Boolean.TRUE); + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + this.save(record); + } else { + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + record.setAvailable(Boolean.TRUE); + this.updateById(record); + } + + OpLogUtil.setVariable("sender", SecurityUtil.getCurrentUser().getId()); + OpLogUtil.setVariable("receiver", vo.getUserId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SwOpLogType.SW, name = "批量发送Excel文件,发送方{}, 接收方{}", params = {"#sender", + "#receiver"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchSend(BatchSendOnlineExcelVo vo) { + + UserDto receiver = userService.findById(vo.getUserId()); + if (receiver == null) { + throw new DefaultClientException("接收方不存在!"); + } + + for (String id : vo.getIds()) { + OnlineExcel record = this.getById(id); + if (record == null) { + throw new DefaultClientException("Excel文件不存在!"); + } + + if (vo.getSelfSave()) { + record.setId(IdUtil.getId()); + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + record.setAvailable(Boolean.TRUE); + this.save(record); + } else { + record.setCreateById(receiver.getId()); + record.setCreateBy(receiver.getName()); + record.setAvailable(Boolean.TRUE); + this.updateById(record); + } + } + + OpLogUtil.setVariable("sender", SecurityUtil.getCurrentUser().getId()); + OpLogUtil.setVariable("receiver", vo.getUserId()); + OpLogUtil.setExtra(vo); + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/OrderTimeLineServiceImpl.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/OrderTimeLineServiceImpl.java new file mode 100644 index 0000000..38515eb --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/impl/OrderTimeLineServiceImpl.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.core.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import com.lframework.xingyun.core.mappers.OrderTimeLineMapper; +import com.lframework.xingyun.core.service.OrderTimeLineService; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * @author zmj + * @since 2022/8/10 + */ +@Service +public class OrderTimeLineServiceImpl extends BaseMpServiceImpl implements + OrderTimeLineService { + + @Cacheable(value = OrderTimeLine.CACHE_NAME, key = "@cacheVariables.tenantId() + #orderId", unless = "#result == null") + @Override + public List getByOrder(String orderId) { + super.cleanCaches(); + Wrapper queryWrapper = Wrappers.lambdaQuery(OrderTimeLine.class).eq(OrderTimeLine::getOrderId, orderId).orderByAsc(OrderTimeLine::getCreateTime); + + return this.list(queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByOrder(String orderId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery(OrderTimeLine.class).eq(OrderTimeLine::getOrderId, orderId); + this.remove(deleteWrapper); + } + + @CacheEvict(value = OrderTimeLine.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + super.cleanCacheByKey(key); + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/DicCityMapper.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/DicCityMapper.java new file mode 100644 index 0000000..38b7909 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/DicCityMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.core.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.entity.DicCity; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-07 + */ +public interface DicCityMapper extends BaseMapper { + + /** + * 查询所有数据 + * + * @return + */ + List getAll(); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + DicCityDto findById(String id); +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/FileBoxMapper.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/FileBoxMapper.java new file mode 100644 index 0000000..95ffe05 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/FileBoxMapper.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.core.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.core.entity.FileBox; +import com.lframework.xingyun.core.vo.sw.filebox.QueryFileBoxVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 收件收纳箱 Mapper 接口 + *

+ */ +public interface FileBoxMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryFileBoxVo vo, @Param("createById") String createById); +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/OnlineExcelMapper.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/OnlineExcelMapper.java new file mode 100644 index 0000000..4f97f1d --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/OnlineExcelMapper.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.core.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.core.entity.OnlineExcel; +import com.lframework.xingyun.core.vo.sw.excel.QueryOnlineExcelVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 在线Excel Mapper 接口 + *

+ */ +public interface OnlineExcelMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryOnlineExcelVo vo, @Param("createById") String createById); +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/OrderTimeLineMapper.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/OrderTimeLineMapper.java new file mode 100644 index 0000000..1097fd5 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/mappers/OrderTimeLineMapper.java @@ -0,0 +1,12 @@ +package com.lframework.xingyun.core.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.core.entity.OrderTimeLine; + +/** + * @author zmj + * @since 2022/8/10 + */ +public interface OrderTimeLineMapper extends BaseMapper { + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/service/DicCityService.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/DicCityService.java new file mode 100644 index 0000000..3f25d1f --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/DicCityService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.core.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.entity.DicCity; +import java.util.List; + +public interface DicCityService extends BaseMpService { + + /** + * 查询所有数据 + * + * @return + */ + List getAll(); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + DicCityDto findById(String id); + + /** + * 根据ID查询链路数据 + * + * @param id 末级ID + * @return 返回值顺序:省、市、区 + */ + List getChainById(String id); +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/service/FileBoxService.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/FileBoxService.java new file mode 100644 index 0000000..3eb3a87 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/FileBoxService.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.core.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.core.entity.FileBox; +import com.lframework.xingyun.core.vo.sw.filebox.CreateFileBoxDirVo; +import com.lframework.xingyun.core.vo.sw.filebox.QueryFileBoxVo; +import com.lframework.xingyun.core.vo.sw.filebox.UpdateFileBoxVo; +import com.lframework.xingyun.core.vo.sw.filebox.UploadFileBoxVo; +import java.util.List; + +/** + * 文件收纳箱 Service + */ +public interface FileBoxService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryFileBoxVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryFileBoxVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + FileBox findById(String id); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateFileBoxVo vo); + + + /** + * 批量删除 + * @param ids + */ + void batchDelete(List ids); + + /** + * 创建文件夹 + * @param vo + */ + void createDir(CreateFileBoxDirVo vo); + + /** + * 上传文件 + * @param vo + */ + void upload(UploadFileBoxVo vo); + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/service/OnlineExcelService.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/OnlineExcelService.java new file mode 100644 index 0000000..cfc6e45 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/OnlineExcelService.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.core.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.core.entity.OnlineExcel; +import com.lframework.xingyun.core.vo.sw.excel.BatchSendOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.CreateOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.QueryOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.SendOnlineExcelVo; +import com.lframework.xingyun.core.vo.sw.excel.UpdateOnlineExcelContentVo; +import com.lframework.xingyun.core.vo.sw.excel.UpdateOnlineExcelVo; +import java.util.List; + +/** + * 在线Excel Service + */ +public interface OnlineExcelService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryOnlineExcelVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryOnlineExcelVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + OnlineExcel findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateOnlineExcelVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateOnlineExcelVo vo); + + /** + * 修改内容 + * + * @param vo + */ + void updateContent(UpdateOnlineExcelContentVo vo); + + /** + * 发送 + * + * @param vo + */ + void send(SendOnlineExcelVo vo); + + /** + * 批量发送 + * + * @param vo + */ + void batchSend(BatchSendOnlineExcelVo vo); + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/service/OrderTimeLineService.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/OrderTimeLineService.java new file mode 100644 index 0000000..d107805 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/service/OrderTimeLineService.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.core.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import java.util.List; + +/** + * @author zmj + * @since 2022/8/10 + */ +public interface OrderTimeLineService extends BaseMpService { + + /** + * 根据订单查询 + * @param orderId + * @return + */ + List getByOrder(String orderId); + + /** + * 根据订单删除 + * @param orderId + */ + void deleteByOrder(String orderId); +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/utils/SplitNumberUtil.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/utils/SplitNumberUtil.java new file mode 100644 index 0000000..6119fa9 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/utils/SplitNumberUtil.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.core.utils; + +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +public class SplitNumberUtil { + + /** + * 将 totalNum 按照权重指标分摊 + * + * @param totalNum + * @param datas key:唯一标识 value:权重指标 + * @param precision 精度 + * @return + */ + public static Map split(Number totalNum, Map datas, + int precision) { + if (CollectionUtil.isEmpty(datas)) { + return null; + } + + if (precision < 0) { + throw new DefaultSysException("precision不允许小于0!"); + } + if (!NumberUtil.isNumberPrecision(totalNum, precision)) { + throw new DefaultSysException("totalNum的小数位数不允许大于 " + precision + "!"); + } + + Number totalWeight = datas.values().stream().reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + Map results = new HashMap<>(datas.size()); + Number remainNum = totalNum; + + int index = 0; + int dataSize = datas.size(); + for (Entry entry : datas.entrySet()) { + Object key = entry.getKey(); + Number val = entry.getValue(); + if (index == dataSize - 1) { + // 最后一行 + results.put(key, remainNum); + } else { + Number curNum = NumberUtil.getNumber(NumberUtil.mul(totalNum, + NumberUtil.equal(totalWeight, BigDecimal.ZERO) ? dataSize + : NumberUtil.div(val, totalWeight)), precision); + remainNum = NumberUtil.sub(remainNum, curNum); + if (NumberUtil.lt(remainNum, BigDecimal.ZERO)) { + curNum = NumberUtil.add(remainNum, curNum); + remainNum = BigDecimal.ZERO; + } + results.put(key, curNum); + } + } + + return results; + } +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/BatchSendOnlineExcelVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/BatchSendOnlineExcelVo.java new file mode 100644 index 0000000..dbd36bc --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/BatchSendOnlineExcelVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.core.vo.sw.excel; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchSendOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotEmpty(message = "ID不能为空!") + private List ids; + + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID", required = true) + @NotBlank(message = "用户ID不能为空!") + private String userId; + + /** + * 是否留存副本 + */ + @ApiModelProperty(value = "是否留存副本", required = true) + @NotNull(message = "是否留存副本不能为空!") + @TypeMismatch(message = "是否留存副本格式错误!") + private Boolean selfSave; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/CreateOnlineExcelVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/CreateOnlineExcelVo.java new file mode 100644 index 0000000..0be8a4c --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/CreateOnlineExcelVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.core.vo.sw.excel; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 内容 + */ + @ApiModelProperty(value = "内容", required = true) + @NotBlank(message = "请输入内容!") + private String content; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/QueryOnlineExcelVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/QueryOnlineExcelVo.java new file mode 100644 index 0000000..2791baa --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/QueryOnlineExcelVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.core.vo.sw.excel; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryOnlineExcelVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @TypeMismatch(message = "状态格式有误!") + private Boolean available; + + /** + * 创建时间 起始时间 + */ + @ApiModelProperty("创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @ApiModelProperty("创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/SendOnlineExcelVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/SendOnlineExcelVo.java new file mode 100644 index 0000000..63e0d9d --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/SendOnlineExcelVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.core.vo.sw.excel; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class SendOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID", required = true) + @NotBlank(message = "用户ID不能为空!") + private String userId; + + /** + * 是否留存副本 + */ + @ApiModelProperty(value = "是否留存副本", required = true) + @NotNull(message = "是否留存副本不能为空!") + @TypeMismatch(message = "是否留存副本格式错误!") + private Boolean selfSave; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/UpdateOnlineExcelContentVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/UpdateOnlineExcelContentVo.java new file mode 100644 index 0000000..bd2ddfd --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/UpdateOnlineExcelContentVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.core.vo.sw.excel; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateOnlineExcelContentVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 内容 + */ + @ApiModelProperty(value = "内容", required = true) + @NotBlank(message = "内容不能为空!") + private String content; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/UpdateOnlineExcelVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/UpdateOnlineExcelVo.java new file mode 100644 index 0000000..0ed6037 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/excel/UpdateOnlineExcelVo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.core.vo.sw.excel; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateOnlineExcelVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @TypeMismatch(message = "状态格式有误!") + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/CreateFileBoxDirVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/CreateFileBoxDirVo.java new file mode 100644 index 0000000..06adcb8 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/CreateFileBoxDirVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.core.vo.sw.filebox; + +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateFileBoxDirVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "父级目录", required = true) + @NotBlank(message = "父级目录不能为空!") + private String parentPath; + + @ApiModelProperty(value = "文件夹名称", required = true) + @Pattern(regexp = "^(?!^\\.)[^\\/:*?\"<>|\\s].*$", message = "文件夹名称不合法!") + @NotBlank(message = "文件夹名称不能为空!") + private String name; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/QueryFileBoxVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/QueryFileBoxVo.java new file mode 100644 index 0000000..d2a8086 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/QueryFileBoxVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.core.vo.sw.filebox; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryFileBoxVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("路径") + private String path; +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/UpdateFileBoxVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/UpdateFileBoxVo.java new file mode 100644 index 0000000..21e2e17 --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/UpdateFileBoxVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.core.vo.sw.filebox; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateFileBoxVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + +} diff --git a/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/UploadFileBoxVo.java b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/UploadFileBoxVo.java new file mode 100644 index 0000000..a71f40e --- /dev/null +++ b/xingyun-core/src/main/java/com/lframework/xingyun/core/vo/sw/filebox/UploadFileBoxVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.core.vo.sw.filebox; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +@Data +public class UploadFileBoxVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 文件 + */ + @ApiModelProperty(value = "文件", required = true) + @NotNull(message = "文件不能为空!") + private MultipartFile file; + + @ApiModelProperty(value = "路径", required = true) + @NotBlank(message = "路径不能为空!") + private String path; +} diff --git a/xingyun-core/src/main/java/lombok.config b/xingyun-core/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-core/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-core/src/main/resources/mappers/DicCityMapper.xml b/xingyun-core/src/main/resources/mappers/DicCityMapper.xml new file mode 100644 index 0000000..5cadf0b --- /dev/null +++ b/xingyun-core/src/main/resources/mappers/DicCityMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + SELECT id, + code, + name, + parent_id, + level + FROM dic_city + + + + + + diff --git a/xingyun-core/src/main/resources/mappers/FileBoxMapper.xml b/xingyun-core/src/main/resources/mappers/FileBoxMapper.xml new file mode 100644 index 0000000..d571f69 --- /dev/null +++ b/xingyun-core/src/main/resources/mappers/FileBoxMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + SELECT tb.* + FROM sw_file_box AS tb + + diff --git a/xingyun-core/src/main/resources/mappers/OnlineExcelMapper.xml b/xingyun-core/src/main/resources/mappers/OnlineExcelMapper.xml new file mode 100644 index 0000000..2466d18 --- /dev/null +++ b/xingyun-core/src/main/resources/mappers/OnlineExcelMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + SELECT tb.id, + tb.name, + tb.content, + tb.available, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM sw_online_excel AS tb + + diff --git a/xingyun-sc/pom.xml b/xingyun-sc/pom.xml new file mode 100644 index 0000000..12fa213 --- /dev/null +++ b/xingyun-sc/pom.xml @@ -0,0 +1,26 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-sc + 【${project.artifactId}】仓库业务服务层 + + + + com.lframework + xingyun-core + + + + com.lframework + xingyun-basedata + + + diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetBo.java new file mode 100644 index 0000000..96daea1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetBo.java @@ -0,0 +1,376 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto.DetailDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetLogisticsSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 物流单号 + */ + @ApiModelProperty("物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @ApiModelProperty("物流公司ID") + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + @ApiModelProperty("寄件人姓名") + private String senderName; + + /** + * 寄件人联系电话 + */ + @ApiModelProperty("寄件人联系电话") + private String senderTelephone; + + /** + * 寄件人省 + */ + @ApiModelProperty("寄件人省") + private String senderProvinceId; + + /** + * 寄件人市 + */ + @ApiModelProperty("寄件人市") + private String senderCityId; + + /** + * 寄件人区 + */ + @ApiModelProperty("寄件人区") + private String senderDistrictId; + + /** + * 寄件人地区 + */ + @ApiModelProperty("寄件人地区") + private String senderCity; + + /** + * 寄件人地址 + */ + @ApiModelProperty("寄件人地址") + private String senderAddress; + + /** + * 收件人姓名 + */ + @ApiModelProperty("收件人姓名") + private String receiverName; + + /** + * 收件人联系电话 + */ + @ApiModelProperty("收件人联系电话") + private String receiverTelephone; + + /** + * 收件人省 + */ + @ApiModelProperty("收件人省") + private String receiverProvinceId; + + /** + * 收件人市 + */ + @ApiModelProperty("收件人市") + private String receiverCityId; + + /** + * 收件人区 + */ + @ApiModelProperty("收件人区") + private String receiverDistrictId; + + /** + * 收件人地区 + */ + @ApiModelProperty("收件人地区") + private String receiverCity; + + /** + * 收件人地址 + */ + @ApiModelProperty("收件人地址") + private String receiverAddress; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @EnumConvert + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 总重量 + */ + @ApiModelProperty("总重量") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @ApiModelProperty("总体积") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @ApiModelProperty("物流费") + private BigDecimal totalAmount; + + /** + * 发货人 + */ + @ApiModelProperty("发货人") + private String deliveryBy; + + /** + * 发货时间 + */ + @ApiModelProperty("发货时间") + private LocalDateTime deliveryTime; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + private LocalDateTime updateTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetLogisticsSheetBo() { + + } + + public GetLogisticsSheetBo(LogisticsSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(LogisticsSheetFullDto dto) { + + return super.convert(dto, GetLogisticsSheetBo::getDetails); + } + + @Override + protected void afterInit(LogisticsSheetFullDto dto) { + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new) + .collect(Collectors.toList()); + } + + if (StringUtil.isNotBlank(dto.getDeliveryBy())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto deliveryBy = userService.findById(dto.getDeliveryBy()); + this.deliveryBy = deliveryBy.getName(); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List senderCitys = dicCityService.getChainById(senderDistrictId); + this.senderCity = senderCitys.stream().map(DicCityDto::getName).collect(Collectors.joining(StringPool.CITY_SPLIT)); + + List receiverCitys = dicCityService.getChainById(receiverDistrictId); + this.receiverCity = receiverCitys.stream().map(DicCityDto::getName).collect(Collectors.joining(StringPool.CITY_SPLIT)); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 物流单ID + */ + @ApiModelProperty("物流单ID") + private String sheetId; + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + @EnumConvert + private Integer bizType; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 收货人ID + */ + @ApiModelProperty("收货人ID") + private String receiverId; + + /** + * 收货人姓名 + */ + @ApiModelProperty("收货人姓名") + private String receiverName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + public OrderDetailBo(LogisticsSheetFullDto.DetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(LogisticsSheetFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(DetailDto dto) { + if (dto.getBizType() == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean( + SaleOutSheetService.class); + SaleOutSheet saleOutSheet = saleOutSheetService.getById(dto.getBizId()); + this.bizCode = saleOutSheet.getCode(); + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(saleOutSheet.getScId()); + this.scId = sc.getId(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(saleOutSheet.getCustomerId()); + this.receiverId = customer.getId(); + this.receiverName = customer.getName(); + + this.createBy = saleOutSheet.getCreateBy(); + this.createTime = saleOutSheet.getCreateTime(); + } else if (dto.getBizType() == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailOutSheet retailOutSheet = retailOutSheetService.getById(dto.getBizId()); + this.bizCode = retailOutSheet.getCode(); + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(retailOutSheet.getScId()); + this.scId = sc.getId(); + this.scName = sc.getName(); + + if (StringUtil.isNotBlank(retailOutSheet.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(retailOutSheet.getMemberId()); + this.receiverId = member.getId(); + this.receiverName = member.getName(); + } + + this.createBy = retailOutSheet.getCreateBy(); + this.createTime = retailOutSheet.getCreateTime(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetDeliveryBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetDeliveryBo.java new file mode 100644 index 0000000..2ff90e3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/GetLogisticsSheetDeliveryBo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class GetLogisticsSheetDeliveryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 物流单号 + */ + @ApiModelProperty("物流单号") + private String logisticsNo; + + /** + * 物流费 + */ + @ApiModelProperty("物流费") + private BigDecimal totalAmount; + + public GetLogisticsSheetDeliveryBo() { + + } + + public GetLogisticsSheetDeliveryBo(LogisticsSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(LogisticsSheet dto) { + + return super.convert(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBizOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBizOrderBo.java new file mode 100644 index 0000000..8615c16 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBizOrderBo.java @@ -0,0 +1,102 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryLogisticsSheetBizOrderBo extends BaseBo { + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + @EnumConvert + private Integer bizType; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 收货人ID + */ + @ApiModelProperty("收货人ID") + private String receiverId; + + /** + * 收货人姓名 + */ + @ApiModelProperty("收货人姓名") + private String receiverName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + public QueryLogisticsSheetBizOrderBo() { + } + + public QueryLogisticsSheetBizOrderBo(LogisticsSheetBizOrderDto dto) { + super(dto); + } + + @Override + protected void afterInit(LogisticsSheetBizOrderDto dto) { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + if (dto.getBizType() == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getReceiverId()); + this.receiverName = customer.getName(); + } else if (dto.getBizType() == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + if (StringUtil.isNotBlank(dto.getReceiverId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getReceiverId()); + this.receiverName = member.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBo.java new file mode 100644 index 0000000..4836976 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/logistics/QueryLogisticsSheetBo.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.sc.bo.logistics; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryLogisticsSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 物流单号 + */ + @ApiModelProperty("物流单号") + private String logisticsNo; + + /** + * 物流公司名称 + */ + @ApiModelProperty("物流公司名称") + private String logisticsCompanyName; + + /** + * 总重量 + */ + @ApiModelProperty("总重量") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @ApiModelProperty("总体积") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @ApiModelProperty("物流费") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @EnumConvert + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + /** + * 发货人 + */ + @ApiModelProperty("发货人") + private String deliveryBy; + + /** + * 发货时间 + */ + @ApiModelProperty("发货时间") + private LocalDateTime deliveryTime; + + public QueryLogisticsSheetBo(LogisticsSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(LogisticsSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(LogisticsSheet dto) { + LogisticsCompanyService logisticsCompanyService = ApplicationUtil.getBean( + LogisticsCompanyService.class); + LogisticsCompany logisticsCompany = logisticsCompanyService.findById( + dto.getLogisticsCompanyId()); + this.logisticsCompanyName = logisticsCompany.getName(); + + if (StringUtil.isNotBlank(dto.getDeliveryBy())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto deliveryBy = userService.findById(dto.getDeliveryBy()); + this.deliveryBy = deliveryBy.getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/paytype/OrderPayTypeBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/paytype/OrderPayTypeBo.java new file mode 100644 index 0000000..fb15317 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/paytype/OrderPayTypeBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.sc.bo.paytype; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class OrderPayTypeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 订单ID + */ + @ApiModelProperty("订单ID") + private String orderId; + + /** + * 支付方式ID + */ + @ApiModelProperty("支付方式ID") + private String payTypeId; + + /** + * 支付金额 + */ + @ApiModelProperty("支付金额") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @ApiModelProperty("支付内容") + private String text; + + @ApiModelProperty("是否记录内容") + private Boolean recText; + + public OrderPayTypeBo() { + } + + public OrderPayTypeBo(OrderPayType dto) { + super(dto); + } + + @Override + protected void afterInit(OrderPayType dto) { + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + PayType payType = payTypeService.findById(dto.getPayTypeId()); + this.recText = payType.getRecText(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/GetPurchaseOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/GetPurchaseOrderBo.java new file mode 100644 index 0000000..b4a564f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/GetPurchaseOrderBo.java @@ -0,0 +1,375 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetPurchaseOrderBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 采购人员编号 + */ + @ApiModelProperty("采购人员") + private String purchaserCode; + + /** + * 预计到货日期 + */ + @ApiModelProperty("预计到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate expectArriveDate; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetPurchaseOrderBo() { + + } + + public GetPurchaseOrderBo(PurchaseOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrderFullDto dto) { + + return super.convert(dto, GetPurchaseOrderBo::getStatus, GetPurchaseOrderBo::getDetails); + } + + @Override + protected void afterInit(PurchaseOrderFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + this.supplierName = supplierService.findById(dto.getSupplierId()).getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getCreateById())) { + this.purchaserCode = userService.findById(dto.getCreateById()).getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer purchaseNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @ApiModelProperty("含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, PurchaseOrderFullDto.OrderDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + PurchaseOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseOrderFullDto.OrderDetailDto dto) { + + this.purchaseNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PrintPurchaseOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PrintPurchaseOrderBo.java new file mode 100644 index 0000000..b94fcbb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PrintPurchaseOrderBo.java @@ -0,0 +1,258 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PrintPurchaseOrderBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 预计到货日期 + */ + @ApiModelProperty("预计到货日期") + private String expectArriveDate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + /** + * 大写总采购金额 + */ + @ApiModelProperty("大写总采购金额") + private String bigTotalAmount; + + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + public PrintPurchaseOrderBo() { + + } + + public PrintPurchaseOrderBo(PurchaseOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrderFullDto dto) { + + return super.convert(dto, PrintPurchaseOrderBo::getDetails); + } + + @Override + protected void afterInit(PurchaseOrderFullDto dto) { + + this.purchaserName = StringPool.EMPTY_STR; + this.expectArriveDate = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (dto.getExpectArriveDate() != null) { + this.expectArriveDate = DateUtil.formatDate(dto.getExpectArriveDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer purchaseNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal purchaseAmount; + + public OrderDetailBo(PurchaseOrderFullDto.OrderDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + PurchaseOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseOrderFullDto.OrderDetailDto dto) { + + this.purchaseNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.purchaseAmount = NumberUtil.mul(dto.getOrderNum(), dto.getTaxPrice()); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderSelectorBo.java new file mode 100644 index 0000000..550f9b9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderSelectorBo.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class PurchaseOrderSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + public PurchaseOrderSelectorBo() { + + } + + public PurchaseOrderSelectorBo(PurchaseOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrder dto) { + + return super.convert(dto, PurchaseOrderSelectorBo::getStatus); + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderWithReceiveBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderWithReceiveBo.java new file mode 100644 index 0000000..8b48e19 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseOrderWithReceiveBo.java @@ -0,0 +1,296 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PurchaseOrderWithReceiveBo extends BaseBo { + + /** + * 订单ID + */ + @ApiModelProperty("订单ID") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public PurchaseOrderWithReceiveBo() { + + } + + public PurchaseOrderWithReceiveBo(PurchaseOrderWithReceiveDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrderWithReceiveDto dto) { + + return super.convert(dto, PurchaseOrderWithReceiveBo::getPurchaserId, + PurchaseOrderWithReceiveBo::getDetails); + } + + @Override + protected void afterInit(PurchaseOrderWithReceiveDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierName = supplier.getName(); + + if (!StringUtil.isBlank(dto.getPurchaserId())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto purchaser = userService.findById(dto.getPurchaserId()); + + this.purchaserId = purchaser.getId(); + this.purchaserName = purchaser.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.scId, t)).collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer orderNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 剩余收货数量 + */ + @ApiModelProperty("剩余收货数量") + private Integer remainNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 含税成本价 + */ + @ApiModelProperty("含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo() { + + } + + public DetailBo(String scId, PurchaseOrderWithReceiveDto.DetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + PurchaseOrderWithReceiveDto.DetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + PurchaseOrderWithReceiveDto.DetailDto dto, + SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(PurchaseOrderWithReceiveDto.DetailDto dto) { + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.orderNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReceiveNum()).intValue(); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseProductBo.java new file mode 100644 index 0000000..600154c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/PurchaseProductBo.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class PurchaseProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 是否多销售属性 + */ + @ApiModelProperty("是否多销售属性") + private Boolean multiSaleProp; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @ApiModelProperty("含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public PurchaseProductBo(String scId, PurchaseProductDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(PurchaseProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderBo.java new file mode 100644 index 0000000..72c6784 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderBo.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPurchaseOrderBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 预计到货日期 + */ + @ApiModelProperty("预计到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate expectArriveDate; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + public QueryPurchaseOrderBo(PurchaseOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseOrder dto) { + + return super.convert(dto, QueryPurchaseOrderBo::getStatus); + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderWithReceiveBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderWithReceiveBo.java new file mode 100644 index 0000000..0df43ba --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/QueryPurchaseOrderWithReceiveBo.java @@ -0,0 +1,86 @@ +package com.lframework.xingyun.sc.bo.purchase; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPurchaseOrderWithReceiveBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryPurchaseOrderWithReceiveBo(PurchaseOrder dto) { + + super(dto); + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/config/GetPurchaseConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/config/GetPurchaseConfigBo.java new file mode 100644 index 0000000..be676a0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/config/GetPurchaseConfigBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.bo.purchase.config; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetPurchaseConfigBo extends BaseBo { + + /** + * 采购收货单是否关联采购订单 + */ + @ApiModelProperty("采购收货单是否关联采购订单") + private Boolean receiveRequirePurchase; + + /** + * 采购收货单是否多次关联采购订单 + */ + @ApiModelProperty("采购收货单是否多次关联采购订单") + private Boolean receiveMultipleRelatePurchase; + + /** + * 采购退货单是否关联采购收货单 + */ + @ApiModelProperty("采购退货单是否关联采购收货单") + private Boolean purchaseReturnRequireReceive; + + /** + * 采购退货单是否多次关联采购收货单 + */ + @ApiModelProperty("采购退货单是否多次关联采购收货单") + private Boolean purchaseReturnMultipleRelateReceive; + + public GetPurchaseConfigBo() { + + } + + public GetPurchaseConfigBo(PurchaseConfig dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetPaymentDateBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetPaymentDateBo.java new file mode 100644 index 0000000..cf8d4ab --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetPaymentDateBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDate; +import lombok.Data; + +@Data +public class GetPaymentDateBo extends BaseBo { + + /** + * 是否允许修改付款日期 + */ + @ApiModelProperty("是否允许修改付款日期") + private Boolean allowModify; + + /** + * 默认付款日期 + */ + @ApiModelProperty("默认付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + public GetPaymentDateBo() { + + } + + public GetPaymentDateBo(GetPaymentDateDto dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetReceiveSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetReceiveSheetBo.java new file mode 100644 index 0000000..1d76c08 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/GetReceiveSheetBo.java @@ -0,0 +1,429 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetReceiveSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 到货日期 + */ + @ApiModelProperty("到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate receiveDate; + + /** + * 采购订单ID + */ + @ApiModelProperty("采购订单ID") + private String purchaseOrderId; + + /** + * 采购订单号 + */ + @ApiModelProperty("采购订单号") + private String purchaseOrderCode; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetReceiveSheetBo() { + + } + + public GetReceiveSheetBo(ReceiveSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheetFullDto dto) { + + return super.convert(dto, GetReceiveSheetBo::getStatus, GetReceiveSheetBo::getSettleStatus, + GetReceiveSheetBo::getDetails); + } + + @Override + protected void afterInit(ReceiveSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + this.supplierName = supplierService.findById(dto.getSupplierId()).getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean(PurchaseOrderService.class); + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.purchaseOrderCode = purchaseOrder.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer orderNum; + + /** + * 剩余收货数量 + */ + @ApiModelProperty("剩余收货数量") + private Integer remainNum; + + /** + * 收货数量 + */ + @ApiModelProperty("收货数量") + private Integer receiveNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @ApiModelProperty("含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 采购订单明细ID + */ + @ApiModelProperty("采购订单明细ID") + private String purchaseOrderDetailId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, ReceiveSheetFullDto.OrderDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + ReceiveSheetFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ReceiveSheetFullDto.OrderDetailDto dto) { + + this.receiveNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getPurchaseOrderDetailId())) { + PurchaseOrderDetailService purchaseOrderDetailService = ApplicationUtil.getBean( + PurchaseOrderDetailService.class); + PurchaseOrderDetail purchaseOrderDetail = purchaseOrderDetailService.getById( + dto.getPurchaseOrderDetailId()); + this.orderNum = purchaseOrderDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(purchaseOrderDetail.getOrderNum(), + purchaseOrderDetail.getReceiveNum()) + .intValue(); + } + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/PrintReceiveSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/PrintReceiveSheetBo.java new file mode 100644 index 0000000..a41ae23 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/PrintReceiveSheetBo.java @@ -0,0 +1,283 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PrintReceiveSheetBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private String paymentDate; + + /** + * 到货日期 + */ + @ApiModelProperty("到货日期") + private String receiveDate; + + /** + * 采购订单号 + */ + @ApiModelProperty("采购订单号") + private String purchaseOrderCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + /** + * 大写总金额 + */ + @ApiModelProperty("大写总金额") + private String bigTotalAmount; + + + + public PrintReceiveSheetBo() { + + } + + public PrintReceiveSheetBo(ReceiveSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheetFullDto dto) { + + return super.convert(dto, PrintReceiveSheetBo::getDetails); + } + + @Override + protected void afterInit(ReceiveSheetFullDto dto) { + + this.purchaserName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.receiveDate = StringPool.EMPTY_STR; + this.purchaseOrderCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean(PurchaseOrderService.class); + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.purchaseOrderCode = purchaseOrder.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + if (dto.getReceiveDate() != null) { + this.receiveDate = DateUtil.formatDate(dto.getReceiveDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 收货数量 + */ + @ApiModelProperty("收货数量") + private Integer receiveNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 收货金额 + */ + @ApiModelProperty("收货金额") + private BigDecimal receiveAmount; + + public OrderDetailBo(ReceiveSheetFullDto.OrderDetailDto dto) { + + this.init(dto); + } + + @Override + public BaseBo convert( + ReceiveSheetFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ReceiveSheetFullDto.OrderDetailDto dto) { + + this.receiveNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.receiveAmount = NumberUtil.mul(dto.getOrderNum(), dto.getTaxPrice()); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetBo.java new file mode 100644 index 0000000..2bd6382 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetBo.java @@ -0,0 +1,197 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryReceiveSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 到货日期 + */ + @ApiModelProperty("到货日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate receiveDate; + + /** + * 采购订单ID + */ + @ApiModelProperty("采购订单ID") + private String purchaseOrderId; + + /** + * 采购订单号 + */ + @ApiModelProperty("采购订单号") + private String purchaseOrderCode; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QueryReceiveSheetBo(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return super.convert(dto, QueryReceiveSheetBo::getStatus, QueryReceiveSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.purchaseOrderCode = purchaseOrder.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetWithReturnBo.java new file mode 100644 index 0000000..b3223f3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/QueryReceiveSheetWithReturnBo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryReceiveSheetWithReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryReceiveSheetWithReturnBo() { + + } + + public QueryReceiveSheetWithReturnBo(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetSelectorBo.java new file mode 100644 index 0000000..9275a96 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetSelectorBo.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class ReceiveSheetSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + public ReceiveSheetSelectorBo() { + + } + + public ReceiveSheetSelectorBo(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return super.convert(dto, ReceiveSheetSelectorBo::getStatus); + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetWithReturnBo.java new file mode 100644 index 0000000..bfdd51f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/receive/ReceiveSheetWithReturnBo.java @@ -0,0 +1,294 @@ +package com.lframework.xingyun.sc.bo.purchase.receive; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class ReceiveSheetWithReturnBo extends BaseBo { + + /** + * 订单ID + */ + @ApiModelProperty("订单ID") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public ReceiveSheetWithReturnBo() { + + } + + public ReceiveSheetWithReturnBo(ReceiveSheetWithReturnDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheetWithReturnDto dto) { + + return super.convert(dto, ReceiveSheetWithReturnBo::getPurchaserId, + ReceiveSheetWithReturnBo::getDetails); + } + + @Override + protected void afterInit(ReceiveSheetWithReturnDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierName = supplier.getName(); + + if (!StringUtil.isBlank(dto.getPurchaserId())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto purchaser = userService.findById(dto.getPurchaserId()); + + this.purchaserId = purchaser.getId(); + this.purchaserName = purchaser.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 收货数量 + */ + @ApiModelProperty("收货数量") + private Integer receiveNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @ApiModelProperty("含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 剩余退货数量 + */ + @ApiModelProperty("剩余退货数量") + private Integer remainNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo(String scId, ReceiveSheetWithReturnDto.DetailDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + public BaseBo convert( + ReceiveSheetWithReturnDto.DetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + ReceiveSheetWithReturnDto.DetailDto dto, + SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(ReceiveSheetWithReturnDto.DetailDto dto) { + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.receiveNum = dto.getOrderNum(); + this.purchasePrice = dto.getTaxPrice(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReturnNum()).intValue(); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/GetPurchaseReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/GetPurchaseReturnBo.java new file mode 100644 index 0000000..e1ef7f6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/GetPurchaseReturnBo.java @@ -0,0 +1,418 @@ +package com.lframework.xingyun.sc.bo.purchase.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetPurchaseReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 采购收货单ID + */ + @ApiModelProperty("采购收货单ID") + private String receiveSheetId; + + /** + * 采购收货单号 + */ + @ApiModelProperty("采购收货单号") + private String receiveSheetCode; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetPurchaseReturnBo(PurchaseReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturnFullDto dto) { + + return super.convert(dto, GetPurchaseReturnBo::getStatus, GetPurchaseReturnBo::getSettleStatus, + GetPurchaseReturnBo::getDetails); + } + + @Override + protected void afterInit(PurchaseReturnFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + this.supplierName = supplierService.findById(dto.getSupplierId()).getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.receiveSheetCode = receiveSheet.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new ReturnDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 收货数量 + */ + @ApiModelProperty("收货数量") + private Integer receiveNum; + + /** + * 剩余退货数量 + */ + @ApiModelProperty("剩余退货数量") + private Integer remainNum; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 含税成本价 + */ + @ApiModelProperty("含税成本价") + private BigDecimal taxCostPrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 采购收货单明细ID + */ + @ApiModelProperty("采购收货单明细ID") + private String receiveSheetDetailId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public ReturnDetailBo(String scId, PurchaseReturnFullDto.ReturnDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + PurchaseReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.purchasePrice = dto.getTaxPrice(); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getReceiveSheetDetailId())) { + ReceiveSheetDetailService receiveSheetDetailService = ApplicationUtil.getBean( + ReceiveSheetDetailService.class); + ReceiveSheetDetail receiveSheetDetailDto = receiveSheetDetailService.getById( + dto.getReceiveSheetDetailId()); + this.receiveNum = receiveSheetDetailDto.getOrderNum(); + this.remainNum = NumberUtil.sub(receiveSheetDetailDto.getOrderNum(), + receiveSheetDetailDto.getReturnNum()).intValue(); + } + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.taxCostPrice = + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/PrintPurchaseReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/PrintPurchaseReturnBo.java new file mode 100644 index 0000000..053839f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/PrintPurchaseReturnBo.java @@ -0,0 +1,283 @@ +package com.lframework.xingyun.sc.bo.purchase.returned; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PrintPurchaseReturnBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private String paymentDate; + + /** + * 采购收货单号 + */ + @ApiModelProperty("采购收货单号") + private String receiveSheetCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + /** + * 商品数量 + */ + @ApiModelProperty("商品数量") + private Integer totalNum; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal totalAmount; + + /** + * 大写总退货金额 + */ + @ApiModelProperty("大写总退货金额") + private String bigTotalAmount; + + + + + public PrintPurchaseReturnBo(PurchaseReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturnFullDto dto) { + + return super.convert(dto, PrintPurchaseReturnBo::getDetails); + } + + @Override + protected void afterInit(PurchaseReturnFullDto dto) { + + this.purchaserName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.receiveSheetCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.receiveSheetCode = receiveSheet.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(ReturnDetailBo::new) + .collect(Collectors.toList()); + } + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal returnAmount; + + public ReturnDetailBo(PurchaseReturnFullDto.ReturnDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + PurchaseReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(PurchaseReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.purchasePrice = dto.getTaxPrice(); + this.returnAmount = NumberUtil.mul(dto.getReturnNum(), dto.getTaxPrice()); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseProductDto product = purchaseOrderService.getPurchaseById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/QueryPurchaseReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/QueryPurchaseReturnBo.java new file mode 100644 index 0000000..68bca28 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/purchase/returned/QueryPurchaseReturnBo.java @@ -0,0 +1,188 @@ +package com.lframework.xingyun.sc.bo.purchase.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPurchaseReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ApiModelProperty("采购员姓名") + private String purchaserName; + + /** + * 采购收货单ID + */ + @ApiModelProperty("采购收货单ID") + private String receiveSheetId; + + /** + * 采购收货单号 + */ + @ApiModelProperty("采购收货单号") + private String receiveSheetCode; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 采购金额 + */ + @ApiModelProperty("采购金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QueryPurchaseReturnBo(PurchaseReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturn dto) { + + return super.convert(dto, QueryPurchaseReturnBo::getStatus, QueryPurchaseReturnBo::getSettleStatus); + } + + @Override + protected void afterInit(PurchaseReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + this.purchaserName = userService.findById(dto.getPurchaserId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.receiveSheetCode = receiveSheet.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/RetailProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/RetailProductBo.java new file mode 100644 index 0000000..52b29ca --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/RetailProductBo.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.sc.bo.retail; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class RetailProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 是否多销售属性 + */ + @ApiModelProperty("是否多销售属性") + private Boolean multiSaleProp; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 零售价 + */ + @ApiModelProperty("零售价") + private BigDecimal retailPrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public RetailProductBo(String scId, RetailProductDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(RetailProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/config/GetRetailConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/config/GetRetailConfigBo.java new file mode 100644 index 0000000..f324094 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/config/GetRetailConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.bo.retail.config; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.RetailConfig; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetRetailConfigBo extends BaseBo { + + /** + * 零售出库单上的会员是否必填 + */ + @ApiModelProperty("零售出库单上的会员是否必填") + private Boolean retailOutSheetRequireMember; + + /** + * 零售退货单上的会员是否必填 + */ + @ApiModelProperty("零售退货单上的会员是否必填") + private Boolean retailReturnRequireMember; + + /** + * 零售退货单是否关联零售出库单 + */ + @ApiModelProperty("零售退货单是否关联零售出库单") + private Boolean retailReturnRequireOutStock; + + /** + * 零售退货单是否多次关联零售出库单 + */ + @ApiModelProperty("零售退货单是否多次关联零售出库单") + private Boolean retailReturnMultipleRelateOutStock; + + /** + * 零售出库单是否需要发货 + */ + @ApiModelProperty("零售出库单是否需要发货") + private Boolean retailOutSheetRequireLogistics; + + public GetRetailConfigBo() { + + } + + public GetRetailConfigBo(RetailConfig dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/GetRetailOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/GetRetailOutSheetBo.java new file mode 100644 index 0000000..b4d5a4d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/GetRetailOutSheetBo.java @@ -0,0 +1,420 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetRetailOutSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 会员ID + */ + @ApiModelProperty("会员ID") + private String memberId; + + /** + * 会员名称 + */ + @ApiModelProperty("会员名称") + private String memberName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员编号 + */ + @ApiModelProperty("销售员编号") + private String salerCode; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 销售金额 + */ + @ApiModelProperty("销售金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetRetailOutSheetBo() { + + } + + public GetRetailOutSheetBo(RetailOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheetFullDto dto) { + + return super.convert(dto, GetRetailOutSheetBo::getStatus, GetRetailOutSheetBo::getSettleStatus, + GetRetailOutSheetBo::getDetails); + } + + @Override + protected void afterInit(RetailOutSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + this.memberName = memberService.findById(dto.getMemberId()).getName(); + } + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + if (!StringUtil.isBlank(dto.getCreateById())) { + this.salerCode = userService.findById(dto.getCreateById()).getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 组合商品ID + */ + @ApiModelProperty("组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @ApiModelProperty("组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer orderNum; + + /** + * 剩余出库数量 + */ + @ApiModelProperty("剩余出库数量") + private Integer remainNum; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal retailPrice; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, RetailOutSheetFullDto.SheetDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + RetailOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.retailPrice = dto.getOriPrice(); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/PrintRetailOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/PrintRetailOutSheetBo.java new file mode 100644 index 0000000..33f2769 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/PrintRetailOutSheetBo.java @@ -0,0 +1,259 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PrintRetailOutSheetBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 会员编号 + */ + @ApiModelProperty("会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @ApiModelProperty("会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private String paymentDate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + + /** + * 商品数量 + */ + @ApiModelProperty("商品数量") + private Integer totalNum; + + /** + * 出库总金额 + */ + @ApiModelProperty("出库总金额") + private BigDecimal totalAmount; + + /** + * 大写合计总金额 + */ + @ApiModelProperty("大写合计总金额") + private String bigTotalAmount; + + public PrintRetailOutSheetBo() { + + } + + public PrintRetailOutSheetBo(RetailOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheetFullDto dto) { + + return super.convert(dto, PrintRetailOutSheetBo::getDetails); + } + + @Override + protected void afterInit(RetailOutSheetFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 出库金额 + */ + @ApiModelProperty("出库金额") + private BigDecimal outAmount; + + public OrderDetailBo(RetailOutSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + RetailOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.outAmount = NumberUtil.mul(dto.getTaxPrice(), dto.getOrderNum()); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetBo.java new file mode 100644 index 0000000..17f855c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetBo.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryRetailOutSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 会员编号 + */ + @ApiModelProperty("会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @ApiModelProperty("会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 销售金额 + */ + @ApiModelProperty("销售金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QueryRetailOutSheetBo(RetailOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheet dto) { + + return super.convert(dto, QueryRetailOutSheetBo::getStatus, QueryRetailOutSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(RetailOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetWithReturnBo.java new file mode 100644 index 0000000..84b0638 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/QueryRetailOutSheetWithReturnBo.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryRetailOutSheetWithReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 会员编号 + */ + @ApiModelProperty("会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @ApiModelProperty("会员名称") + private String memberName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryRetailOutSheetWithReturnBo() { + + } + + public QueryRetailOutSheetWithReturnBo(RetailOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/RetailOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/RetailOutSheetWithReturnBo.java new file mode 100644 index 0000000..2fab05a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/out/RetailOutSheetWithReturnBo.java @@ -0,0 +1,299 @@ +package com.lframework.xingyun.sc.bo.retail.out; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class RetailOutSheetWithReturnBo extends BaseBo { + + /** + * 订单ID + */ + @ApiModelProperty("订单ID") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 会员ID + */ + @ApiModelProperty("会员ID") + private String memberId; + + /** + * 会员名称 + */ + @ApiModelProperty("会员名称") + private String memberName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public RetailOutSheetWithReturnBo() { + + } + + public RetailOutSheetWithReturnBo(RetailOutSheetWithReturnDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheetWithReturnDto dto) { + + return super.convert(dto, RetailOutSheetWithReturnBo::getSalerId, + RetailOutSheetWithReturnBo::getDetails); + } + + @Override + protected void afterInit(RetailOutSheetWithReturnDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberName = member.getName(); + } + + if (!StringUtil.isBlank(dto.getSalerId())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = userService.findById(dto.getSalerId()); + + this.salerId = saler.getId(); + this.salerName = saler.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal retailPrice; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 剩余退货数量 + */ + @ApiModelProperty("剩余退货数量") + private Integer remainNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo(String scId, RetailOutSheetWithReturnDto.SheetDetailDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + public BaseBo convert( + RetailOutSheetWithReturnDto.SheetDetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + RetailOutSheetWithReturnDto.SheetDetailDto dto, SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(RetailOutSheetWithReturnDto.SheetDetailDto dto) { + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.outNum = dto.getOrderNum(); + this.retailPrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReturnNum()).intValue(); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/GetRetailReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/GetRetailReturnBo.java new file mode 100644 index 0000000..7f18a9a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/GetRetailReturnBo.java @@ -0,0 +1,412 @@ +package com.lframework.xingyun.sc.bo.retail.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetRetailReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String memberId; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String memberName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售出库单ID + */ + @ApiModelProperty("销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @ApiModelProperty("销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetRetailReturnBo(RetailReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturnFullDto dto) { + + return super.convert(dto, GetRetailReturnBo::getStatus, GetRetailReturnBo::getSettleStatus, + GetRetailReturnBo::getDetails); + } + + @Override + protected void afterInit(RetailReturnFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + this.memberName = memberService.findById(dto.getMemberId()).getName(); + } + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheet outSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new ReturnDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 剩余退货数量 + */ + @ApiModelProperty("剩余退货数量") + private Integer remainNum; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal retailPrice; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 销售出库单明细ID + */ + @ApiModelProperty("销售出库单明细ID") + private String outSheetDetailId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public ReturnDetailBo(String scId, RetailReturnFullDto.ReturnDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + RetailReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.retailPrice = dto.getTaxPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getOutSheetDetailId())) { + RetailOutSheetDetailLotService receiveSheetDetailService = ApplicationUtil.getBean( + RetailOutSheetDetailLotService.class); + RetailOutSheetDetailLotDto outSheetDetail = receiveSheetDetailService.findById( + dto.getOutSheetDetailId()); + this.outNum = outSheetDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(outSheetDetail.getOrderNum(), + outSheetDetail.getReturnNum()).intValue(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/PrintRetailReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/PrintRetailReturnBo.java new file mode 100644 index 0000000..c408100 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/PrintRetailReturnBo.java @@ -0,0 +1,272 @@ +package com.lframework.xingyun.sc.bo.retail.returned; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PrintRetailReturnBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String memberCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private String paymentDate; + + /** + * 销售出库单号 + */ + @ApiModelProperty("销售出库单号") + private String outSheetCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + + /** + * 商品数量 + */ + @ApiModelProperty("商品数量") + private Integer totalNum; + + /** + * 退货总金额 + */ + @ApiModelProperty("退货总金额") + private BigDecimal totalAmount; + + + /** + * 大写合计总金额 + */ + @ApiModelProperty("大写合计总金额") + private String bigTotalAmount; + + public PrintRetailReturnBo(RetailReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturnFullDto dto) { + + return super.convert(dto, PrintRetailReturnBo::getDetails); + } + + @Override + protected void afterInit(RetailReturnFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.outSheetCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheet outSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == RetailReturnStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(ReturnDetailBo::new) + .collect(Collectors.toList()); + } + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal returnAmount; + + public ReturnDetailBo(RetailReturnFullDto.ReturnDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + RetailReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(RetailReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.taxPrice = dto.getTaxPrice(); + this.returnAmount = NumberUtil.mul(dto.getTaxPrice(), dto.getReturnNum()); + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailProductDto product = retailOutSheetService.getRetailById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/QueryRetailReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/QueryRetailReturnBo.java new file mode 100644 index 0000000..a0db161 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/retail/returned/QueryRetailReturnBo.java @@ -0,0 +1,191 @@ +package com.lframework.xingyun.sc.bo.retail.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryRetailReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 会员编号 + */ + @ApiModelProperty("会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @ApiModelProperty("会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 销售出库单ID + */ + @ApiModelProperty("销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @ApiModelProperty("销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QueryRetailReturnBo(RetailReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturn dto) { + + return super.convert(dto, QueryRetailReturnBo::getStatus, QueryRetailReturnBo::getSettleStatus); + } + + @Override + protected void afterInit(RetailReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + if (!StringUtil.isBlank(dto.getMemberId())) { + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + this.memberCode = member.getCode(); + this.memberName = member.getName(); + } + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailOutSheet outSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/GetSaleOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/GetSaleOrderBo.java new file mode 100644 index 0000000..e3d0688 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/GetSaleOrderBo.java @@ -0,0 +1,390 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSaleOrderBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 销售员编号 + */ + @ApiModelProperty("销售员编号") + private String salerCode; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 销售金额 + */ + @ApiModelProperty("销售金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetSaleOrderBo() { + + } + + public GetSaleOrderBo(SaleOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto dto) { + + return super.convert(dto, GetSaleOrderBo::getStatus, GetSaleOrderBo::getDetails); + } + + @Override + protected void afterInit(SaleOrderFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + this.customerName = customerService.findById(dto.getCustomerId()).getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getCreateById())) { + this.salerCode = userService.findById(dto.getCreateById()).getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 组合商品ID + */ + @ApiModelProperty("组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @ApiModelProperty("组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer orderNum; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @ApiModelProperty("现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @ApiModelProperty("折扣(%)") + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + public OrderDetailBo(String scId, SaleOrderFullDto.OrderDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOrderFullDto.OrderDetailDto dto) { + + this.orderNum = dto.getOrderNum(); + this.oriPrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId( + this.getProductId(), this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/PrintSaleOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/PrintSaleOrderBo.java new file mode 100644 index 0000000..9616127 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/PrintSaleOrderBo.java @@ -0,0 +1,249 @@ +package com.lframework.xingyun.sc.bo.sale; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +public class PrintSaleOrderBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + /** + * 大写中文总合计金额 + */ + @ApiModelProperty("大写中文总合计金额") + private String bigTotalAmount; + + /** + * 商品数量 + */ + @ApiModelProperty("商品数量") + private Integer totalNum; + + /** + * 销售总金额 + */ + @ApiModelProperty("销售总金额") + private BigDecimal totalAmount; + + + + public PrintSaleOrderBo() { + + } + + public PrintSaleOrderBo(SaleOrderFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto dto) { + + return super.convert(dto, PrintSaleOrderBo::getDetails); + } + + @Override + protected void afterInit(SaleOrderFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == SaleOrderStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + this.totalNum = dto.getTotalNum(); + this.totalAmount = dto.getTotalAmount(); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer orderNum; + + /** + * 现价 + */ + @ApiModelProperty("现价") + private BigDecimal taxPrice; + + /** + * 销售金额 + */ + @ApiModelProperty("销售金额") + private BigDecimal orderAmount; + + public OrderDetailBo(SaleOrderFullDto.OrderDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderFullDto.OrderDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOrderFullDto.OrderDetailDto dto) { + + this.orderNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.orderAmount = NumberUtil.mul(dto.getOrderNum(), dto.getTaxPrice()); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderBo.java new file mode 100644 index 0000000..f73c042 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderBo.java @@ -0,0 +1,161 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOrderBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 销售金额 + */ + @ApiModelProperty("销售金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + public QuerySaleOrderBo(SaleOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrder dto) { + + return super.convert(dto, QuerySaleOrderBo::getStatus); + } + + @Override + protected void afterInit(SaleOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderWithOutBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderWithOutBo.java new file mode 100644 index 0000000..d2453ff --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/QuerySaleOrderWithOutBo.java @@ -0,0 +1,86 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOrderWithOutBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QuerySaleOrderWithOutBo(SaleOrder dto) { + + super(dto); + } + + @Override + protected void afterInit(SaleOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleOrderWithOutBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleOrderWithOutBo.java new file mode 100644 index 0000000..fc04847 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleOrderWithOutBo.java @@ -0,0 +1,318 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class SaleOrderWithOutBo extends BaseBo { + + /** + * 订单ID + */ + @ApiModelProperty("订单ID") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public SaleOrderWithOutBo() { + + } + + public SaleOrderWithOutBo(SaleOrderWithOutDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrderWithOutDto dto) { + + return super.convert(dto, SaleOrderWithOutBo::getDetails); + } + + @Override + protected void afterInit(SaleOrderWithOutDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerName = customer.getName(); + + if (!StringUtil.isBlank(dto.getSalerId())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = userService.findById(dto.getSalerId()); + + this.salerId = saler.getId(); + this.salerName = saler.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 组合商品ID + */ + @ApiModelProperty("组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @ApiModelProperty("组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer orderNum; + + /** + * 销售价 + */ + @ApiModelProperty("销售价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal discountRate; + + /** + * 剩余出库数量 + */ + @ApiModelProperty("剩余出库数量") + private Integer remainNum; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo() { + + } + + public DetailBo(String scId, SaleOrderWithOutDto.DetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert(SaleOrderWithOutDto.DetailDto dto) { + + return this; + } + + @Override + public BaseBo convert(SaleOrderWithOutDto.DetailDto dto, + SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(SaleOrderWithOutDto.DetailDto dto) { + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.orderNum = dto.getOrderNum(); + this.salePrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getOutNum()).intValue(); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleProductBo.java new file mode 100644 index 0000000..27a703e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/SaleProductBo.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.sc.bo.sale; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SaleProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 是否多销售属性 + */ + @ApiModelProperty("是否多销售属性") + private Boolean multiSaleProp; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 销售价 + */ + @ApiModelProperty("销售价") + private BigDecimal salePrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public SaleProductBo(String scId, SaleProductDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + protected void afterInit(SaleProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/config/GetSaleConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/config/GetSaleConfigBo.java new file mode 100644 index 0000000..91857b0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/config/GetSaleConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.bo.sale.config; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.SaleConfig; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSaleConfigBo extends BaseBo { + + /** + * 销售出库单是否关联销售订单 + */ + @ApiModelProperty("销售出库单是否关联销售订单") + private Boolean outStockRequireSale; + + /** + * 销售出库单是否多次关联销售订单 + */ + @ApiModelProperty("销售出库单是否多次关联销售订单") + private Boolean outStockMultipleRelateSale; + + /** + * 销售退货单是否关联销售出库单 + */ + @ApiModelProperty("销售退货单是否关联销售出库单") + private Boolean saleReturnRequireOutStock; + + /** + * 销售退货单是否多次关联销售出库单 + */ + @ApiModelProperty("销售退货单是否多次关联销售出库单") + private Boolean saleReturnMultipleRelateOutStock; + + /** + * 销售出库单是否关联物流单 + */ + @ApiModelProperty("销售出库单是否关联物流单") + private Boolean outStockRequireLogistics; + + public GetSaleConfigBo() { + + } + + public GetSaleConfigBo(SaleConfig dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/GetSaleOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/GetSaleOutSheetBo.java new file mode 100644 index 0000000..96adc0a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/GetSaleOutSheetBo.java @@ -0,0 +1,446 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSaleOutSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售订单ID + */ + @ApiModelProperty("销售订单ID") + private String saleOrderId; + + /** + * 销售订单号 + */ + @ApiModelProperty("销售订单号") + private String saleOrderCode; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 销售金额 + */ + @ApiModelProperty("销售金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetSaleOutSheetBo() { + + } + + public GetSaleOutSheetBo(SaleOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheetFullDto dto) { + + return super.convert(dto, GetSaleOutSheetBo::getStatus, GetSaleOutSheetBo::getSettleStatus, + GetSaleOutSheetBo::getDetails); + } + + @Override + protected void afterInit(SaleOutSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + this.customerName = customerService.findById(dto.getCustomerId()).getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.saleOrderCode = saleOrder.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new OrderDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 组合商品ID + */ + @ApiModelProperty("组合商品ID") + private String mainProductId; + + /** + * 组合商品名称 + */ + @ApiModelProperty("组合商品名称") + private String mainProductName; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer orderNum; + + /** + * 剩余出库数量 + */ + @ApiModelProperty("剩余出库数量") + private Integer remainNum; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 销售订单明细ID + */ + @ApiModelProperty("销售订单明细ID") + private String saleOrderDetailId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public OrderDetailBo(String scId, SaleOutSheetFullDto.SheetDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + SaleOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.salePrice = dto.getOriPrice(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getSaleOrderDetailId())) { + SaleOrderDetailService saleOrderDetailService = ApplicationUtil.getBean( + SaleOrderDetailService.class); + SaleOrderDetail saleOrderDetail = saleOrderDetailService.getById( + dto.getSaleOrderDetailId()); + this.orderNum = saleOrderDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(saleOrderDetail.getOrderNum(), saleOrderDetail.getOutNum()) + .intValue(); + } + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + + if (StringUtil.isNotBlank(dto.getMainProductId())) { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product mainProduct = productService.findById(dto.getMainProductId()); + this.mainProductId = dto.getMainProductId(); + this.mainProductName = mainProduct.getName(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/PrintSaleOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/PrintSaleOutSheetBo.java new file mode 100644 index 0000000..8c5bb53 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/PrintSaleOutSheetBo.java @@ -0,0 +1,270 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PrintSaleOutSheetBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private String paymentDate; + + /** + * 销售订单号 + */ + @ApiModelProperty("销售订单号") + private String saleOrderCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + /** + * 商品数量 + */ + @ApiModelProperty("商品数量") + private Integer totalNum; + + /** + * 出库总金额 + */ + @ApiModelProperty("出库总金额") + private BigDecimal totalAmount; + + /** + * 大写中文总合计金额 + */ + @ApiModelProperty("大写中文总合计金额") + private String bigTotalAmount; + + public PrintSaleOutSheetBo() { + + } + + public PrintSaleOutSheetBo(SaleOutSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheetFullDto dto) { + + return super.convert(dto, PrintSaleOutSheetBo::getDetails); + } + + @Override + protected void afterInit(SaleOutSheetFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.saleOrderCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.saleOrderCode = saleOrder.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(OrderDetailBo::new).collect(Collectors.toList()); + } + + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + } + + @Data + public static class OrderDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal outAmount; + + public OrderDetailBo(SaleOutSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + SaleOutSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOutSheetFullDto.SheetDetailDto dto) { + + this.outNum = dto.getOrderNum(); + this.taxPrice = dto.getTaxPrice(); + this.outAmount = NumberUtil.mul(dto.getTaxPrice(), dto.getOrderNum()); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetBo.java new file mode 100644 index 0000000..5f6c067 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetBo.java @@ -0,0 +1,188 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOutSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 销售订单ID + */ + @ApiModelProperty("销售订单ID") + private String saleOrderId; + + /** + * 销售订单号 + */ + @ApiModelProperty("销售订单号") + private String saleOrderCode; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 销售金额 + */ + @ApiModelProperty("销售金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QuerySaleOutSheetBo(SaleOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheet dto) { + + return super.convert(dto, QuerySaleOutSheetBo::getStatus, QuerySaleOutSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SaleOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.saleOrderCode = saleOrder.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetWithReturnBo.java new file mode 100644 index 0000000..a6a4f5b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/QuerySaleOutSheetWithReturnBo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOutSheetWithReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QuerySaleOutSheetWithReturnBo() { + + } + + public QuerySaleOutSheetWithReturnBo(SaleOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/SaleOutSheetWithReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/SaleOutSheetWithReturnBo.java new file mode 100644 index 0000000..c77bbb1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/out/SaleOutSheetWithReturnBo.java @@ -0,0 +1,296 @@ +package com.lframework.xingyun.sc.bo.sale.out; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class SaleOutSheetWithReturnBo extends BaseBo { + + /** + * 订单ID + */ + @ApiModelProperty("订单ID") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public SaleOutSheetWithReturnBo() { + + } + + public SaleOutSheetWithReturnBo(SaleOutSheetWithReturnDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheetWithReturnDto dto) { + + return super.convert(dto, SaleOutSheetWithReturnBo::getSalerId, + SaleOutSheetWithReturnBo::getDetails); + } + + @Override + protected void afterInit(SaleOutSheetWithReturnDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerName = customer.getName(); + + if (!StringUtil.isBlank(dto.getSalerId())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = userService.findById(dto.getSalerId()); + + this.salerId = saler.getId(); + this.salerName = saler.getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new DetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal discountRate; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 剩余退货数量 + */ + @ApiModelProperty("剩余退货数量") + private Integer remainNum; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率(%) + */ + @ApiModelProperty("税率(%)") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public DetailBo(String scId, SaleOutSheetWithReturnDto.SheetDetailDto dto) { + + this.scId = scId; + + this.init(dto); + } + + @Override + public BaseBo convert( + SaleOutSheetWithReturnDto.SheetDetailDto dto) { + + return this; + } + + @Override + public BaseBo convert( + SaleOutSheetWithReturnDto.SheetDetailDto dto, SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(SaleOutSheetWithReturnDto.SheetDetailDto dto) { + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.id = dto.getId(); + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + this.outNum = dto.getOrderNum(); + this.salePrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + this.remainNum = NumberUtil.sub(dto.getOrderNum(), dto.getReturnNum()).intValue(); + this.isGift = dto.getIsGift(); + this.taxRate = dto.getTaxRate(); + this.description = dto.getDescription(); + + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.getProductId(), + this.getScId()); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/GetSaleReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/GetSaleReturnBo.java new file mode 100644 index 0000000..baefdb1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/GetSaleReturnBo.java @@ -0,0 +1,409 @@ +package com.lframework.xingyun.sc.bo.sale.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSaleReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + @JsonFormat(pattern = StringPool.DATE_PATTERN) + private LocalDate paymentDate; + + /** + * 销售出库单ID + */ + @ApiModelProperty("销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @ApiModelProperty("销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer giftNum; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + public GetSaleReturnBo(SaleReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturnFullDto dto) { + + return super.convert(dto, GetSaleReturnBo::getStatus, GetSaleReturnBo::getSettleStatus, + GetSaleReturnBo::getDetails); + } + + @Override + protected void afterInit(SaleReturnFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + this.scName = storeCenterService.findById(dto.getScId()).getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + this.customerName = customerService.findById(dto.getCustomerId()).getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheet outSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalNum = dto.getTotalNum(); + this.giftNum = dto.getTotalGiftNum(); + this.totalAmount = dto.getTotalAmount(); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new ReturnDetailBo(this.getScId(), t)) + .collect(Collectors.toList()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + this.payTypes = orderPayTypes.stream().map(OrderPayTypeBo::new).collect(Collectors.toList()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer outNum; + + /** + * 剩余退货数量 + */ + @ApiModelProperty("剩余退货数量") + private Integer remainNum; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal salePrice; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 折扣 + */ + @ApiModelProperty("折扣") + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + @ApiModelProperty("是否赠品") + private Boolean isGift; + + /** + * 税率 + */ + @ApiModelProperty("税率") + private BigDecimal taxRate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 销售出库单明细ID + */ + @ApiModelProperty("销售出库单明细ID") + private String outSheetDetailId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public ReturnDetailBo(String scId, SaleReturnFullDto.ReturnDetailDto dto) { + + this.scId = scId; + this.init(dto); + } + + @Override + public BaseBo convert( + SaleReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.salePrice = dto.getOriPrice(); + this.taxPrice = dto.getTaxPrice(); + this.discountRate = dto.getDiscountRate(); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.unit = product.getUnit(); + this.spec = product.getSpec(); + this.categoryName = product.getCategoryName(); + this.brandName = product.getBrandName(); + + if (!StringUtil.isBlank(dto.getOutSheetDetailId())) { + SaleOutSheetDetailLotService receiveSheetDetailService = ApplicationUtil.getBean( + SaleOutSheetDetailLotService.class); + SaleOutSheetDetailLotDto outSheetDetail = receiveSheetDetailService.findById( + dto.getOutSheetDetailId()); + this.outNum = outSheetDetail.getOrderNum(); + this.remainNum = NumberUtil.sub(outSheetDetail.getOrderNum(), + outSheetDetail.getReturnNum()).intValue(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/PrintSaleReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/PrintSaleReturnBo.java new file mode 100644 index 0000000..16498ee --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/PrintSaleReturnBo.java @@ -0,0 +1,267 @@ +package com.lframework.xingyun.sc.bo.sale.returned; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.BasePrintDataBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PrintSaleReturnBo extends BasePrintDataBo { + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private String paymentDate; + + /** + * 销售出库单号 + */ + @ApiModelProperty("销售出库单号") + private String outSheetCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + private String approveTime; + + /** + * 订单明细 + */ + @ApiModelProperty("订单明细") + private List details; + + /** + * 商品数量 + */ + @ApiModelProperty("商品数量") + private Integer totalNum; + + /** + * 退货总金额 + */ + @ApiModelProperty("退货总金额") + private BigDecimal totalAmount; + + /** + * 大写合计总金额 + */ + @ApiModelProperty("大写合计总金额") + private String bigTotalAmount; + + public PrintSaleReturnBo(SaleReturnFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturnFullDto dto) { + + return super.convert(dto, PrintSaleReturnBo::getDetails); + } + + @Override + protected void afterInit(SaleReturnFullDto dto) { + + this.salerName = StringPool.EMPTY_STR; + this.paymentDate = StringPool.EMPTY_STR; + this.outSheetCode = StringPool.EMPTY_STR; + this.approveBy = StringPool.EMPTY_STR; + this.approveTime = StringPool.EMPTY_STR; + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheet outSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + + if (dto.getPaymentDate() != null) { + this.paymentDate = DateUtil.formatDate(dto.getPaymentDate()); + } + + this.createTime = DateUtil.formatDateTime(dto.getCreateTime()); + + if (!StringUtil.isBlank(dto.getApproveBy()) + && dto.getStatus() == SaleReturnStatus.APPROVE_PASS) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + this.approveTime = DateUtil.formatDateTime(dto.getApproveTime()); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(ReturnDetailBo::new) + .collect(Collectors.toList()); + } + this.bigTotalAmount = Convert.digitToChinese(dto.getTotalAmount()); + } + + @Data + public static class ReturnDetailBo extends BaseBo { + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * SKU编号 + */ + @ApiModelProperty("SKU编号") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 价格 + */ + @ApiModelProperty("价格") + private BigDecimal taxPrice; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal returnAmount; + + public ReturnDetailBo(SaleReturnFullDto.ReturnDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + SaleReturnFullDto.ReturnDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SaleReturnFullDto.ReturnDetailDto dto) { + + this.returnNum = dto.getReturnNum(); + this.taxPrice = dto.getTaxPrice(); + this.returnAmount = NumberUtil.mul(dto.getTaxPrice(), dto.getReturnNum()); + + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleProductDto product = saleOrderService.getSaleById(dto.getProductId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/QuerySaleReturnBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/QuerySaleReturnBo.java new file mode 100644 index 0000000..903968b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sale/returned/QuerySaleReturnBo.java @@ -0,0 +1,188 @@ +package com.lframework.xingyun.sc.bo.sale.returned; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleReturnBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ApiModelProperty("销售员姓名") + private String salerName; + + /** + * 销售出库单ID + */ + @ApiModelProperty("销售出库单ID") + private String outSheetId; + + /** + * 销售出库单号 + */ + @ApiModelProperty("销售出库单号") + private String outSheetCode; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ApiModelProperty("赠品数量") + private Integer totalGiftNum; + + /** + * 退货金额 + */ + @ApiModelProperty("退货金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QuerySaleReturnBo(SaleReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturn dto) { + + return super.convert(dto, QuerySaleReturnBo::getStatus, QuerySaleReturnBo::getSettleStatus); + } + + @Override + protected void afterInit(SaleReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getSalerId())) { + this.salerName = userService.findById(dto.getSalerId()).getName(); + } + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + SaleOutSheet outSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.outSheetCode = outSheet.getCode(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/QueryStockCostAdjustSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/QueryStockCostAdjustSheetBo.java new file mode 100644 index 0000000..601a44e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/QueryStockCostAdjustSheetBo.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.cost; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheet; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 库存成本调整单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryStockCostAdjustSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 调价品种数 + */ + @ApiModelProperty("调价品种数") + private Integer productNum; + + /** + * 库存调价差额 + */ + @ApiModelProperty("库存调价差额") + private BigDecimal diffAmount; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public QueryStockCostAdjustSheetBo() { + + } + + public QueryStockCostAdjustSheetBo(StockCostAdjustSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(StockCostAdjustSheet dto) { + + return super.convert(dto, QueryStockCostAdjustSheetBo::getStatus); + } + + @Override + protected void afterInit(StockCostAdjustSheet dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustProductBo.java new file mode 100644 index 0000000..a4a6295 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustProductBo.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.cost; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustProductDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class StockCostAdjustProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 档案采购价 + */ + @ApiModelProperty("档案采购价") + private BigDecimal purchasePrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 调价前成本价 + */ + @ApiModelProperty("调价前成本价") + private BigDecimal oriPrice; + + public StockCostAdjustProductBo() { + + } + + public StockCostAdjustProductBo(StockCostAdjustProductDto dto) { + + super(dto); + } + + @Override + protected void afterInit(StockCostAdjustProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustSheetFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustSheetFullBo.java new file mode 100644 index 0000000..f692ab6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustSheetFullBo.java @@ -0,0 +1,321 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.cost; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +/** + *

+ * 库存成本调整单 GetBo + *

+ * + * @author zmj + */ +@Data +public class StockCostAdjustSheetFullBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 调价品种数 + */ + @ApiModelProperty("调价品种数") + private Integer productNum; + + /** + * 库存调价差额 + */ + @ApiModelProperty("库存调价差额") + private BigDecimal diffAmount; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 明细 + */ + @ApiModelProperty("明细") + private List details; + + public StockCostAdjustSheetFullBo(StockCostAdjustSheetFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(StockCostAdjustSheetFullDto dto) { + + return super.convert(dto, StockCostAdjustSheetFullBo::getStatus); + } + + @Override + protected void afterInit(StockCostAdjustSheetFullDto dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.details = dto.getDetails().stream().map(t -> new DetailBo(t, this.scId, this.status)) + .collect(Collectors.toList()); + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 档案采购价 + */ + @ApiModelProperty("档案采购价") + private BigDecimal purchasePrice; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 调整前成本价 + */ + @ApiModelProperty("调整前成本价") + private BigDecimal oriPrice; + + /** + * 调整后成本价 + */ + @ApiModelProperty("调整后成本价") + private BigDecimal price; + + /** + * 库存调价差额 + */ + @ApiModelProperty("库存调价差额") + private BigDecimal diffAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private String scId; + + /** + * 状态 + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private Integer status; + + public DetailBo(StockCostAdjustSheetFullDto.DetailDto dto, String scId, Integer status) { + + this.scId = scId; + this.status = status; + + this.init(dto); + } + + @Override + public BaseBo convert( + StockCostAdjustSheetFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(StockCostAdjustSheetFullDto.DetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.brandName = productBrand.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (EnumUtil.getByCode(StockCostAdjustSheetStatus.class, this.status) + != StockCostAdjustSheetStatus.APPROVE_PASS) { + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getProductId(), + this.scId); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + this.oriPrice = productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2); + this.diffAmount = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.sub(this.price, this.oriPrice), this.stockNum), 2); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/QueryStockAdjustSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/QueryStockAdjustSheetBo.java new file mode 100644 index 0000000..08c3b18 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/QueryStockAdjustSheetBo.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 库存成本调整单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryStockAdjustSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + @EnumConvert + private Integer bizType; + + /** + * 调整原因 + */ + @ApiModelProperty("调整原因") + private String reasonName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public QueryStockAdjustSheetBo() { + + } + + public QueryStockAdjustSheetBo(StockAdjustSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(StockAdjustSheet dto) { + + return super.convert(dto, QueryStockAdjustSheetBo::getStatus); + } + + @Override + protected void afterInit(StockAdjustSheet dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + StockAdjustReasonService stockAdjustReasonService = ApplicationUtil.getBean( + StockAdjustReasonService.class); + StockAdjustReason reason = stockAdjustReasonService.findById(dto.getReasonId()); + this.reasonName = reason.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustProductBo.java new file mode 100644 index 0000000..f86f9e7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustProductBo.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class StockAdjustProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 当前库存数量 + */ + @ApiModelProperty("当前库存数量") + private Integer curStockNum; + + /** + * 仓库ID + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private String scId; + + public StockAdjustProductBo() { + + } + + public StockAdjustProductBo(String scId, StockAdjustProductDto dto) { + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(StockAdjustProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getId(), + this.scId); + this.curStockNum = productStock == null ? 0 : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java new file mode 100644 index 0000000..8955330 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java @@ -0,0 +1,320 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +/** + *

+ * 库存调整单 GetBo + *

+ * + * @author zmj + */ +@Data +public class StockAdjustSheetFullBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + @EnumConvert + private Integer bizType; + + /** + * 调整原因ID + */ + @ApiModelProperty("调整原因ID") + private String reasonId; + + /** + * 调整原因 + */ + @ApiModelProperty("调整原因") + private String reasonName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 明细 + */ + @ApiModelProperty("明细") + private List details; + + /** + * 发起人编号 + */ + @ApiModelProperty("发起人编号") + private String createCode; + + public StockAdjustSheetFullBo(StockAdjustSheetFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(StockAdjustSheetFullDto dto) { + + return super.convert(dto, StockAdjustSheetFullBo::getStatus); + } + + @Override + protected void afterInit(StockAdjustSheetFullDto dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!StringUtil.isBlank(dto.getCreateById())){ + this.createCode = userService.findById(dto.getCreateById()).getCode(); + } + StockAdjustReasonService stockAdjustReasonService = ApplicationUtil.getBean(StockAdjustReasonService.class); + StockAdjustReason reason = stockAdjustReasonService.findById(dto.getReasonId()); + this.reasonName = reason.getName(); + + this.details = dto.getDetails().stream().map(t -> new DetailBo(t, this.scId, this.status)) + .collect(Collectors.toList()); + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 调整库存数量 + */ + @ApiModelProperty("调整库存数量") + private Integer stockNum; + + /** + * 当前库存数量 + */ + @ApiModelProperty("当前库存数量") + private Integer curStockNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private String scId; + + /** + * 状态 + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private Integer status; + + public DetailBo(StockAdjustSheetFullDto.DetailDto dto, String scId, Integer status) { + + this.scId = scId; + this.status = status; + + this.init(dto); + } + + @Override + public BaseBo convert( + StockAdjustSheetFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(StockAdjustSheetFullDto.DetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.brandName = productBrand.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (EnumUtil.getByCode(StockAdjustSheetStatus.class, this.status) + != StockAdjustSheetStatus.APPROVE_PASS) { + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getProductId(), + this.scId); + this.curStockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/GetStockAdjustReasonBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/GetStockAdjustReasonBo.java new file mode 100644 index 0000000..c6449c4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/GetStockAdjustReasonBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock.reason; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetStockAdjustReasonBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetStockAdjustReasonBo() { + + } + + public GetStockAdjustReasonBo(StockAdjustReason dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/QueryStockAdjustReasonBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/QueryStockAdjustReasonBo.java new file mode 100644 index 0000000..55a4123 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/QueryStockAdjustReasonBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock.reason; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryStockAdjustReasonBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryStockAdjustReasonBo() { + + } + + public QueryStockAdjustReasonBo(StockAdjustReason dto) { + + super(dto); + } + + @Override + protected void afterInit(StockAdjustReason dto) { + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/StockAdjustReasonSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/StockAdjustReasonSelectorBo.java new file mode 100644 index 0000000..fea60da --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/reason/StockAdjustReasonSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.bo.stock.adjust.stock.reason; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class StockAdjustReasonSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public StockAdjustReasonSelectorBo() { + + } + + public StockAdjustReasonSelectorBo(StockAdjustReason dto) { + + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/QueryProductStockBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/QueryProductStockBo.java new file mode 100644 index 0000000..69ca937 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/QueryProductStockBo.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.sc.bo.stock.product; + +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStock; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class QueryProductStockBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 商品类目 + */ + @ApiModelProperty("商品类目") + private String categoryName; + + /** + * 商品品牌 + */ + @ApiModelProperty("商品品牌") + private String brandName; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 含税价格 + */ + @ApiModelProperty("含税价格") + private BigDecimal taxPrice; + + /** + * 含税金额 + */ + @ApiModelProperty("含税金额") + private BigDecimal taxAmount; + + public QueryProductStockBo() { + + } + + public QueryProductStockBo(ProductStock dto) { + + super(dto); + } + + @Override + protected void afterInit(ProductStock dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + + this.taxPrice = NumberUtil.getNumber(dto.getTaxPrice(), 2); + this.taxAmount = NumberUtil.getNumber(dto.getTaxAmount(), 2); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/log/QueryProductStockLogBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/log/QueryProductStockLogBo.java new file mode 100644 index 0000000..ef43b65 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/product/log/QueryProductStockLogBo.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.sc.bo.stock.product.log; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryProductStockLogBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 商品类目 + */ + @ApiModelProperty("商品类目") + private String categoryName; + + /** + * 商品品牌 + */ + @ApiModelProperty("商品品牌") + private String brandName; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 原库存数量 + */ + @ApiModelProperty("原库存数量") + private Integer oriStockNum; + + /** + * 现库存数量 + */ + @ApiModelProperty("现库存数量") + private Integer curStockNum; + + /** + * 原含税成本价 + */ + @ApiModelProperty("原含税成本价") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @ApiModelProperty("现含税成本价") + private BigDecimal curTaxPrice; + + /** + * 含税金额 + */ + @ApiModelProperty("含税金额") + private BigDecimal taxAmount; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + private Integer bizType; + + public QueryProductStockLogBo() { + + } + + public QueryProductStockLogBo(ProductStockLog dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductStockLog dto) { + + return super.convert(dto, QueryProductStockLogBo::getBizType); + } + + @Override + protected void afterInit(ProductStockLog dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + + this.oriTaxPrice = NumberUtil.getNumber(dto.getOriTaxPrice(), 2); + this.curTaxPrice = NumberUtil.getNumber(dto.getCurTaxPrice(), 2); + this.taxAmount = NumberUtil.getNumber(dto.getTaxAmount(), 2); + + this.bizType = dto.getBizType().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/config/GetTakeStockConfigBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/config/GetTakeStockConfigBo.java new file mode 100644 index 0000000..7d79547 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/config/GetTakeStockConfigBo.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.sc.bo.stock.take.config; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 盘点参数 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetTakeStockConfigBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据 + */ + @ApiModelProperty("库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据") + private Boolean showProduct; + + /** + * 库存盘点单是否显示盘点任务创建时商品的系统库存数量 + */ + @ApiModelProperty("库存盘点单是否显示盘点任务创建时商品的系统库存数量") + private Boolean showStock; + + /** + * 盘点差异生成时是否自动调整盘点任务中商品的系统库存数量 + */ + @ApiModelProperty("盘点差异生成时是否自动调整盘点任务中商品的系统库存数量") + private Boolean autoChangeStock; + + /** + * 盘点差异单中的盘点数量是否允许手动修改 + */ + @ApiModelProperty("盘点差异单中的盘点数量是否允许手动修改") + private Boolean allowChangeNum; + + /** + * 盘点任务创建后多少小时内未完成,则自动作废 + */ + @ApiModelProperty("盘点任务创建后多少小时内未完成,则自动作废") + private Integer cancelHours; + + public GetTakeStockConfigBo() { + + } + + public GetTakeStockConfigBo(TakeStockConfig dto) { + + super(dto); + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/GetTakeStockPlanBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/GetTakeStockPlanBo.java new file mode 100644 index 0000000..76c8cb2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/GetTakeStockPlanBo.java @@ -0,0 +1,127 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 盘点任务 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetTakeStockPlanBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @ApiModelProperty("盘点类别") + private Integer takeType; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + private Integer takeStatus; + + /** + * 业务名称 + */ + @ApiModelProperty("业务名称") + private String bizName; + + public GetTakeStockPlanBo() { + + } + + public GetTakeStockPlanBo(TakeStockPlan dto) { + + super(dto); + } + + @Override + public
BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, GetTakeStockPlanBo::getTakeType, GetTakeStockPlanBo::getTakeStatus); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scName = sc.getName(); + + String bizId = dto.getBizId(); + if (dto.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (dto.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanBo.java new file mode 100644 index 0000000..b9a37f5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanBo.java @@ -0,0 +1,162 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 盘点任务 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryTakeStockPlanBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @ApiModelProperty("盘点类别") + private Integer takeType; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + private Integer takeStatus; + + /** + * 盘点内容 + */ + @ApiModelProperty("盘点内容") + private String bizName; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryTakeStockPlanBo() { + + } + + public QueryTakeStockPlanBo(TakeStockPlan dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, QueryTakeStockPlanBo::getTakeType, QueryTakeStockPlanBo::getTakeStatus); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + String bizId = dto.getBizId(); + if (dto.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (dto.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanProductBo.java new file mode 100644 index 0000000..f0826a5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/QueryTakeStockPlanProductBo.java @@ -0,0 +1,114 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryTakeStockPlanProductBo extends BaseBo { + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 初始库存 + */ + @ApiModelProperty("初始库存") + private Integer stockNum; + + public QueryTakeStockPlanProductBo(QueryTakeStockPlanProductDto dto) { + + super(dto); + } + + @Override + protected void afterInit(QueryTakeStockPlanProductDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (!config.getShowStock()) { + this.stockNum = null; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanFullBo.java new file mode 100644 index 0000000..fbfc4c8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanFullBo.java @@ -0,0 +1,279 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class TakeStockPlanFullBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @ApiModelProperty("盘点类别") + private Integer takeType; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + private Integer takeStatus; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 明细 + */ + @ApiModelProperty("明细") + private List details; + + public TakeStockPlanFullBo(TakeStockPlanFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(TakeStockPlanFullDto dto) { + + return super.convert(dto, TakeStockPlanFullBo::getTakeType, TakeStockPlanFullBo::getTakeStatus, + TakeStockPlanFullBo::getDetails); + } + + @Override + protected void afterInit(TakeStockPlanFullDto dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + this.details = CollectionUtil.isEmpty(dto.getDetails()) ? + CollectionUtil.emptyList() : + dto.getDetails().stream().map(t -> new DetailBo(t, this.id)).collect(Collectors.toList()); + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 原盘点数量(通过盘点单统计) + */ + @ApiModelProperty("原盘点数量(通过盘点单统计)") + private Integer oriTakeNum; + + /** + * 修改后的盘点数量 + */ + @ApiModelProperty("修改后的盘点数量") + private Integer takeNum; + + /** + * 出项数量 + */ + @ApiModelProperty("出项数量") + private Integer totalOutNum; + + /** + * 进项数量 + */ + @ApiModelProperty("进项数量") + private Integer totalInNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 差异数量 + */ + @ApiModelProperty("差异数量") + private Integer diffNum; + + /** + * 盘点任务ID + */ + @ApiModelProperty(value = "盘点任务ID", hidden = true) + @JsonIgnore + private String planId; + + public DetailBo(TakeStockPlanFullDto.DetailDto dto, String planId) { + + this.planId = planId; + + this.init(dto); + } + + @Override + public BaseBo convert(TakeStockPlanFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(TakeStockPlanFullDto.DetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (this.oriTakeNum != null || this.takeNum != null) { + + if (this.takeNum != null) { + this.diffNum = this.takeNum - this.stockNum; + } else { + this.diffNum = this.oriTakeNum - this.stockNum; + } + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanSelectorBo.java new file mode 100644 index 0000000..23eae19 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/plan/TakeStockPlanSelectorBo.java @@ -0,0 +1,89 @@ +package com.lframework.xingyun.sc.bo.stock.take.plan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class TakeStockPlanSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @ApiModelProperty("盘点类别") + private Integer takeType; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + private Integer takeStatus; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public TakeStockPlanSelectorBo(TakeStockPlan dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, TakeStockPlanSelectorBo::getTakeType, TakeStockPlanSelectorBo::getTakeStatus); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getCode(); + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/GetPreTakeStockSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/GetPreTakeStockSheetBo.java new file mode 100644 index 0000000..b0ef8da --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/GetPreTakeStockSheetBo.java @@ -0,0 +1,226 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +/** + *

+ * 预先盘点单 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetPreTakeStockSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + private Integer takeStatus; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 操作人 + */ + @ApiModelProperty("操作人") + private String updateBy; + + /** + * 操作时间 + */ + @ApiModelProperty("操作时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 明细 + */ + @ApiModelProperty("明细") + private List details; + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 初盘数量 + */ + @ApiModelProperty("初盘数量") + private Integer firstNum; + + /** + * 复盘数量 + */ + @ApiModelProperty("复盘数量") + private Integer secondNum; + + /** + * 抽盘数量 + */ + @ApiModelProperty("抽盘数量") + private Integer randNum; + + public SheetDetailBo(PreTakeStockSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + protected void afterInit(PreTakeStockSheetFullDto.SheetDetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + } + } + + public GetPreTakeStockSheetBo() { + + } + + public GetPreTakeStockSheetBo(PreTakeStockSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(PreTakeStockSheetFullDto dto) { + + return super.convert(dto, GetPreTakeStockSheetBo::getTakeStatus); + } + + @Override + protected void afterInit(PreTakeStockSheetFullDto dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scId = sc.getId(); + this.scName = sc.getName(); + + this.takeStatus = dto.getTakeStatus().getCode(); + + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockProductBo.java new file mode 100644 index 0000000..afd5983 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockProductBo.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class PreTakeStockProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + public PreTakeStockProductBo() { + + } + + public PreTakeStockProductBo(PreTakeStockProductDto dto) { + + super(dto); + } + + @Override + protected void afterInit(PreTakeStockProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockSheetSelectorBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockSheetSelectorBo.java new file mode 100644 index 0000000..da69117 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/PreTakeStockSheetSelectorBo.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class PreTakeStockSheetSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + private Integer takeStatus; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public PreTakeStockSheetSelectorBo(PreTakeStockSheet dto) { + + super(dto); + } + + @Override + public
BaseBo convert(PreTakeStockSheet dto) { + + return super.convert(dto, PreTakeStockSheetSelectorBo::getTakeStatus); + } + + @Override + protected void afterInit(PreTakeStockSheet dto) { + + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetBo.java new file mode 100644 index 0000000..92b66da --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetBo.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 预先盘点单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryPreTakeStockSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + private Integer takeStatus; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public QueryPreTakeStockSheetBo() { + + } + + public QueryPreTakeStockSheetBo(PreTakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(PreTakeStockSheet dto) { + + return super.convert(dto, QueryPreTakeStockSheetBo::getTakeStatus); + } + + @Override + protected void afterInit(PreTakeStockSheet dto) { + + this.takeStatus = dto.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetProductBo.java new file mode 100644 index 0000000..d1d286d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/pre/QueryPreTakeStockSheetProductBo.java @@ -0,0 +1,143 @@ +package com.lframework.xingyun.sc.bo.stock.take.pre; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryPreTakeStockSheetProductBo extends BaseBo { + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 盘点数量 + */ + @ApiModelProperty("盘点数量") + private Integer takeNum; + + public QueryPreTakeStockSheetProductBo(QueryPreTakeStockSheetProductDto dto, String scId) { + + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(QueryPreTakeStockSheetProductDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (dto.getTakeStatus() == PreTakeStockSheetStatus.FIRST_TAKE) { + this.takeNum = dto.getFirstNum(); + } else if (dto.getTakeStatus() == PreTakeStockSheetStatus.SECOND_TAKE) { + this.takeNum = dto.getSecondNum(); + } else if (dto.getTakeStatus() == PreTakeStockSheetStatus.RAND_TAKE) { + this.takeNum = dto.getRandNum(); + } + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (config.getShowStock()) { + ProductStockService productStockService = ApplicationUtil.getBean(ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.productId, this.scId); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/QueryTakeStockSheetBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/QueryTakeStockSheetBo.java new file mode 100644 index 0000000..ea67146 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/QueryTakeStockSheetBo.java @@ -0,0 +1,147 @@ +package com.lframework.xingyun.sc.bo.stock.take.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 盘点单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryTakeStockSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 盘点任务号 + */ + @ApiModelProperty("盘点任务号") + private String planCode; + + /** + * 仓库编号 + */ + @ApiModelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点任务-盘点类别 + */ + @ApiModelProperty("盘点任务-盘点类别") + private Integer takeType; + + /** + * 盘点任务-盘点状态 + */ + @ApiModelProperty("盘点任务-盘点状态") + private Integer takeStatus; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public QueryTakeStockSheetBo() { + + } + + public QueryTakeStockSheetBo(TakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockSheet dto) { + + return super.convert(dto, QueryTakeStockSheetBo::getTakeStatus, QueryTakeStockSheetBo::getStatus); + } + + @Override + protected void afterInit(TakeStockSheet dto) { + + this.status = dto.getStatus().getCode(); + + TakeStockPlanService takeStockPlanService = ApplicationUtil.getBean(TakeStockPlanService.class); + TakeStockPlan takeStockPlan = takeStockPlanService.getById(dto.getPlanId()); + + this.planCode = takeStockPlan.getCode(); + this.takeStatus = takeStockPlan.getTakeStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.takeType = takeStockPlan.getTakeType().getCode(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetFullBo.java new file mode 100644 index 0000000..f9412ca --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetFullBo.java @@ -0,0 +1,351 @@ +package com.lframework.xingyun.sc.bo.stock.take.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +/** + *

+ * 盘点单详情 Bo + *

+ * + * @author zmj + */ +@Data +public class TakeStockSheetFullBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 盘点任务ID + */ + @ApiModelProperty("盘点任务ID") + private String planId; + + /** + * 盘点任务号 + */ + @ApiModelProperty("盘点任务号") + private String planCode; + + /** + * 预先盘点单ID + */ + @ApiModelProperty("预先盘点单ID") + private String preSheetId; + + /** + * 预先盘点单号 + */ + @ApiModelProperty("预先盘点单号") + private String preSheetCode; + + /** + * 仓库名称 + */ + @ApiModelProperty("仓库名称") + private String scName; + + /** + * 盘点任务-盘点类别 + */ + @ApiModelProperty("盘点任务-盘点类别") + private Integer takeType; + + /** + * 业务名称 + */ + @ApiModelProperty("业务名称") + private String bizName; + + /** + * 盘点任务-盘点状态 + */ + @ApiModelProperty("盘点任务-盘点状态") + private Integer takeStatus; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 拒绝理由 + */ + @ApiModelProperty("拒绝理由") + private String refuseReason; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 明细 + */ + @ApiModelProperty("明细") + private List details; + + public TakeStockSheetFullBo(TakeStockSheetFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(TakeStockSheetFullDto dto) { + + return super.convert(dto, TakeStockSheetFullBo::getTakeStatus, TakeStockSheetFullBo::getStatus); + } + + @Override + protected void afterInit(TakeStockSheetFullDto dto) { + + this.status = dto.getStatus().getCode(); + + TakeStockPlanService takeStockPlanService = ApplicationUtil.getBean(TakeStockPlanService.class); + TakeStockPlan plan = takeStockPlanService.getById(dto.getPlanId()); + this.planCode = plan.getCode(); + this.takeType = plan.getTakeType().getCode(); + this.takeStatus = plan.getTakeStatus().getCode(); + + String bizId = plan.getBizId(); + if (plan.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (plan.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + + if (!StringUtil.isBlank(dto.getPreSheetId())) { + PreTakeStockSheetService preTakeStockSheetService = ApplicationUtil.getBean( + PreTakeStockSheetService.class); + PreTakeStockSheet preSheet = preTakeStockSheetService.getById(dto.getPreSheetId()); + this.preSheetCode = preSheet.getCode(); + } + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(this.approveBy)) { + this.approveBy = userService.findById(this.approveBy).getName(); + } + + this.details = dto.getDetails().stream().map(t -> new SheetDetailBo(t, this.planId)) + .collect(Collectors.toList()); + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 盘点数量 + */ + @ApiModelProperty("盘点数量") + private Integer takeNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 盘点任务ID + */ + @ApiModelProperty("盘点任务ID") + private String planId; + + public SheetDetailBo(TakeStockSheetFullDto.SheetDetailDto dto, String planId) { + + this.planId = planId; + + this.init(dto); + } + + @Override + protected void afterInit(TakeStockSheetFullDto.SheetDetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productId = product.getId(); + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (config.getShowStock()) { + TakeStockPlanDetailService takeStockPlanDetailService = ApplicationUtil.getBean( + TakeStockPlanDetailService.class); + GetTakeStockPlanDetailProductDto planDetail = takeStockPlanDetailService.getByPlanIdAndProductId( + this.planId, this.productId); + this.stockNum = planDetail.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetProductBo.java new file mode 100644 index 0000000..98035bb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/take/sheet/TakeStockSheetProductBo.java @@ -0,0 +1,128 @@ +package com.lframework.xingyun.sc.bo.stock.take.sheet; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class TakeStockSheetProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 库存数量 + */ + @ApiModelProperty("库存数量") + private Integer stockNum; + + /** + * 盘点任务ID + */ + @ApiModelProperty(value = "盘点任务ID", hidden = true) + @JsonIgnore + private String planId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", hidden = true) + @JsonIgnore + private String scId; + + public TakeStockSheetProductBo(TakeStockSheetProductDto dto, String planId, String scId) { + + this.planId = planId; + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(TakeStockSheetProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + TakeStockConfigService takeStockConfigService = ApplicationUtil.getBean( + TakeStockConfigService.class); + TakeStockConfig config = takeStockConfigService.get(); + if (config.getShowStock()) { + if (!StringUtil.isBlank(this.planId)) { + TakeStockPlanDetailService takeStockPlanDetailService = ApplicationUtil.getBean( + TakeStockPlanDetailService.class); + GetTakeStockPlanDetailProductDto product = takeStockPlanDetailService.getByPlanIdAndProductId( + this.planId, this.productId); + this.stockNum = product.getStockNum(); + } else { + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(this.productId, + this.scId); + this.stockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderBo.java new file mode 100644 index 0000000..d9ce8ac --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderBo.java @@ -0,0 +1,147 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 仓库调拨单 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryScTransferOrderBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 转出仓库编号 + */ + @ApiModelProperty("转出仓库编号") + private String sourceScCode; + + /** + * 转出仓库名称 + */ + @ApiModelProperty("转出仓库名称") + private String sourceScName; + + /** + * 转入仓库编号 + */ + @ApiModelProperty("转入仓库编号") + private String targetScCode; + + /** + * 转入仓库名称 + */ + @ApiModelProperty("转入仓库名称") + private String targetScName; + + /** + * 调拨数量 + */ + @ApiModelProperty("调拨数量") + private Integer totalNum; + + /** + * 调拨成本金额 + */ + @ApiModelProperty("调拨成本金额") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public QueryScTransferOrderBo() { + + } + + public QueryScTransferOrderBo(ScTransferOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(ScTransferOrder dto) { + + return super.convert(dto, QueryScTransferOrderBo::getStatus); + } + + @Override + protected void afterInit(ScTransferOrder dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sourceSc = storeCenterService.findById(dto.getSourceScId()); + this.sourceScCode = sourceSc.getCode(); + this.sourceScName = sourceSc.getName(); + + StoreCenter targetSc = storeCenterService.findById(dto.getTargetScId()); + this.targetScCode = targetSc.getCode(); + this.targetScName = targetSc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderDetailReceiveBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderDetailReceiveBo.java new file mode 100644 index 0000000..204d49d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/QueryScTransferOrderDetailReceiveBo.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryScTransferOrderDetailReceiveBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 收货数量 + */ + @ApiModelProperty("收货数量") + private Integer receiveNum; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + public QueryScTransferOrderDetailReceiveBo() { + } + + public QueryScTransferOrderDetailReceiveBo(ScTransferOrderDetailReceive dto) { + super(dto); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferOrderFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferOrderFullBo.java new file mode 100644 index 0000000..c3d8094 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferOrderFullBo.java @@ -0,0 +1,319 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.template.core.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +/** + *

+ * 仓库调拨单 GetBo + *

+ * + * @author zmj + */ +@Data +public class ScTransferOrderFullBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 转出仓库ID + */ + @ApiModelProperty("转出仓库ID") + private String sourceScId; + + /** + * 转出仓库名称 + */ + @ApiModelProperty("转出仓库名称") + private String sourceScName; + + /** + * 转入仓库ID + */ + @ApiModelProperty("转入仓库ID") + private String targetScId; + + /** + * 转入仓库名称 + */ + @ApiModelProperty("转入仓库名称") + private String targetScName; + + /** + * 调拨数量 + */ + @ApiModelProperty("调拨数量") + private Integer totalNum; + + /** + * 调拨成本金额 + */ + @ApiModelProperty("调拨成本金额") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + /** + * 明细 + */ + @ApiModelProperty("明细") + private List details; + + public ScTransferOrderFullBo(ScTransferOrderFullDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(ScTransferOrderFullDto dto) { + + return super.convert(dto, ScTransferOrderFullBo::getStatus); + } + + @Override + protected void afterInit(ScTransferOrderFullDto dto) { + + this.status = dto.getStatus().getCode(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sourceSc = storeCenterService.findById(dto.getSourceScId()); + this.sourceScName = sourceSc.getName(); + + StoreCenter targetSc = storeCenterService.findById(dto.getTargetScId()); + this.targetScName = targetSc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.details = dto.getDetails().stream().map(t -> new DetailBo(t, this.sourceScId, this.status)) + .collect(Collectors.toList()); + } + + @Data + public static class DetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 调拨数量 + */ + @ApiModelProperty("调拨数量") + private Integer transferNum; + + /** + * 当前库存数量 + */ + @ApiModelProperty("当前库存数量") + private Integer curStockNum; + + /** + * 已收货数量 + */ + @ApiModelProperty("已收货数量") + private Integer receiveNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 仓库ID + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private String scId; + + /** + * 状态 + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private Integer status; + + public DetailBo(ScTransferOrderFullDto.DetailDto dto, String scId, Integer status) { + + this.scId = scId; + this.status = status; + + this.init(dto); + } + + @Override + public BaseBo convert( + ScTransferOrderFullDto.DetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ScTransferOrderFullDto.DetailDto dto) { + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.brandName = productBrand.getName(); + this.categoryName = productCategory.getName(); + this.skuCode = product.getSkuCode(); + this.externalCode = product.getExternalCode(); + this.spec = product.getSpec(); + this.unit = product.getUnit(); + + if (EnumUtil.getByCode(ScTransferOrderStatus.class, this.status) + != ScTransferOrderStatus.APPROVE_PASS) { + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getProductId(), + this.scId); + this.curStockNum = productStock == null ? 0 : productStock.getStockNum(); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferProductBo.java new file mode 100644 index 0000000..84dcbae --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/transfer/ScTransferProductBo.java @@ -0,0 +1,105 @@ +package com.lframework.xingyun.sc.bo.stock.transfer; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ScTransferProductBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String productId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String productCode; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String productName; + + /** + * 类目名称 + */ + @ApiModelProperty("类目名称") + private String categoryName; + + /** + * 品牌名称 + */ + @ApiModelProperty("品牌名称") + private String brandName; + + /** + * SKU + */ + @ApiModelProperty("SKU") + private String skuCode; + + /** + * 外部编号 + */ + @ApiModelProperty("外部编号") + private String externalCode; + + /** + * 规格 + */ + @ApiModelProperty("规格") + private String spec; + + /** + * 单位 + */ + @ApiModelProperty("单位") + private String unit; + + /** + * 当前库存数量 + */ + @ApiModelProperty("当前库存数量") + private Integer curStockNum; + + /** + * 仓库ID + */ + @JsonIgnore + @ApiModelProperty(hidden = true) + private String scId; + + public ScTransferProductBo() { + + } + + public ScTransferProductBo(String scId, ScTransferProductDto dto) { + this.scId = scId; + + this.init(dto); + } + + @Override + protected void afterInit(ScTransferProductDto dto) { + + this.productId = dto.getId(); + this.productCode = dto.getCode(); + this.productName = dto.getName(); + + ProductStockService productStockService = ApplicationUtil.getBean( + ProductStockService.class); + ProductStock productStock = productStockService.getByProductIdAndScId(dto.getId(), + this.scId); + this.curStockNum = productStock == null ? 0 : productStock.getStockNum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/components/code/GenerateCodeTypePool.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/components/code/GenerateCodeTypePool.java new file mode 100644 index 0000000..f0e6e2e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/components/code/GenerateCodeTypePool.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.sc.components.code; + +import com.lframework.starter.web.components.code.GenerateCodeType; + +public interface GenerateCodeTypePool { + + /** + * 采购订单 + */ + GenerateCodeType PURCHASE_ORDER = GenerateCodeType.FLOW; + + /** + * 采购收货单 + */ + GenerateCodeType RECEIVE_SHEET = GenerateCodeType.FLOW; + + /** + * 采购退单 + */ + GenerateCodeType PURCHASE_RETURN = GenerateCodeType.FLOW; + + /** + * 销售订单 + */ + GenerateCodeType SALE_ORDER = GenerateCodeType.FLOW; + + /** + * 销售出库单 + */ + GenerateCodeType SALE_OUT_SHEET = GenerateCodeType.FLOW; + + /** + * 销售退货单 + */ + GenerateCodeType SALE_RETURN = GenerateCodeType.FLOW; + + /** + * 零售出库单 + */ + GenerateCodeType RETAIL_OUT_SHEET = GenerateCodeType.FLOW; + + /** + * 零售退货单 + */ + GenerateCodeType RETAIL_RETURN = GenerateCodeType.FLOW; + + /** + * 预先盘点单 + */ + GenerateCodeType PRE_TAKE_STOCK_SHEET = GenerateCodeType.FLOW; + + /** + * 盘点任务 + */ + GenerateCodeType TAKE_STOCK_PLAN = GenerateCodeType.FLOW; + + /** + * 盘点单 + */ + GenerateCodeType TAKE_STOCK_SHEET = GenerateCodeType.FLOW; + + /** + * 库存成本调整单 + */ + GenerateCodeType STOCK_COST_ADJUST_SHEET = GenerateCodeType.FLOW; + + /** + * 库存调整单 + */ + GenerateCodeType STOCK_ADJUST_SHEET = GenerateCodeType.FLOW; + + /** + * 仓库调拨单 + */ + GenerateCodeType SC_TRANSFER_ORDER = GenerateCodeType.FLOW; + + /** + * 物流单 + */ + GenerateCodeType LOGISTICS_SHEET = GenerateCodeType.FLOW; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ScSelectorController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ScSelectorController.java new file mode 100644 index 0000000..d5f5158 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ScSelectorController.java @@ -0,0 +1,281 @@ +package com.lframework.xingyun.sc.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; +import com.lframework.xingyun.sc.bo.purchase.PurchaseOrderSelectorBo; +import com.lframework.xingyun.sc.bo.purchase.receive.ReceiveSheetSelectorBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.reason.StockAdjustReasonSelectorBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.TakeStockPlanSelectorBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.PreTakeStockSheetSelectorBo; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.vo.purchase.PurchaseOrderSelectorVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveSheetSelectorVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据选择器 + * + * @author zmj + */ +@Api(tags = "数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class ScSelectorController extends DefaultBaseController { + + @Autowired + private PurchaseOrderService purchaseOrderService; + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Autowired + private PreTakeStockSheetService preTakeStockSheetService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Autowired + private StockAdjustReasonService stockAdjustReasonService; + + /** + * 采购订单 + */ + @ApiOperation("采购订单") + @GetMapping("/purchaseorder") + public InvokeResult> selector( + @Valid PurchaseOrderSelectorVo vo) { + + PageResult pageResult = purchaseOrderService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PurchaseOrderSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载采购订单 + */ + @ApiOperation("加载采购订单") + @PostMapping("/purchaseorder/load") + public InvokeResult> loadPurchaseOrder( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = purchaseOrderService.listByIds(ids); + List results = datas.stream().map(PurchaseOrderSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 采购收货单 + */ + @ApiOperation("采购收货单") + @GetMapping("/receivesheet") + public InvokeResult> selector( + @Valid ReceiveSheetSelectorVo vo) { + + PageResult pageResult = receiveSheetService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(ReceiveSheetSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载采购收货单 + */ + @ApiOperation("加载采购收货单") + @PostMapping("/receivesheet/load") + public InvokeResult> loadReceiveSheet( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = receiveSheetService.listByIds(ids); + List results = datas.stream().map(ReceiveSheetSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 盘点任务 + */ + @ApiOperation("盘点任务") + @GetMapping("/takestock/plan") + public InvokeResult> selector( + @Valid TakeStockPlanSelectorVo vo) { + + PageResult pageResult = takeStockPlanService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(TakeStockPlanSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载盘点任务 + */ + @ApiOperation("加载盘点任务") + @PostMapping("/takestock/plan/load") + public InvokeResult> loadTakeStockPlan( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = takeStockPlanService.listByIds(ids); + List results = datas.stream().map(TakeStockPlanSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 预先盘点单 + */ + @ApiOperation("预先盘点单") + @GetMapping("/takestock/pre") + public InvokeResult> selector( + @Valid PreTakeStockSheetSelectorVo vo) { + + PageResult pageResult = preTakeStockSheetService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PreTakeStockSheetSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载预先盘点单 + */ + @ApiOperation("加载预先盘点单") + @PostMapping("/takestock/pre/load") + public InvokeResult> loadPreTakeStock( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = preTakeStockSheetService.listByIds(ids); + List results = datas.stream().map(PreTakeStockSheetSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("订单支付方式") + @GetMapping("/paytype/order") + public InvokeResult> getOrderPayType( + @NotBlank(message = "订单ID不能为空!") String orderId) { + List datas = orderPayTypeService.findByOrderId(orderId); + List results = datas.stream().map(OrderPayTypeBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 库存调整原因 + */ + @ApiOperation("库存调整原因") + @GetMapping("/stock/adjust/reason") + public InvokeResult> selector( + @Valid StockAdjustReasonSelectorVo vo) { + + PageResult pageResult = stockAdjustReasonService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(StockAdjustReasonSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载库存调整原因 + */ + @ApiOperation("加载库存调整原因") + @PostMapping("/stock/adjust/reason/load") + public InvokeResult> loadStockAdjustReason( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().map(t -> stockAdjustReasonService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(StockAdjustReasonSelectorBo::new) + .collect(Collectors.toList()); + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/logistics/LogisticsSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/logistics/LogisticsSheetController.java new file mode 100644 index 0000000..e4a1445 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/logistics/LogisticsSheetController.java @@ -0,0 +1,372 @@ +package com.lframework.xingyun.sc.controller.logistics; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.logistics.GetLogisticsSheetBo; +import com.lframework.xingyun.sc.bo.logistics.GetLogisticsSheetDeliveryBo; +import com.lframework.xingyun.sc.bo.logistics.QueryLogisticsSheetBizOrderBo; +import com.lframework.xingyun.sc.bo.logistics.QueryLogisticsSheetBo; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.excel.logistics.LogisticsSheetDeliveryImportListener; +import com.lframework.xingyun.sc.excel.logistics.LogisticsSheetDeliveryImportModel; +import com.lframework.xingyun.sc.excel.logistics.LogisticsSheetExportModel; +import com.lframework.xingyun.sc.excel.logistics.LogisticsSheetImportListener; +import com.lframework.xingyun.sc.excel.logistics.LogisticsSheetImportModel; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import com.lframework.xingyun.sc.vo.logistics.CreateLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.DeliveryLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetCalcWeightOrVolumeVo; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetCalcWeightOrVolumeVo.BizOrderVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetBizOrderVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.UpdateLogisticsSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 物流单管理 + * + * @author zmj + */ +@Api(tags = "物流单管理") +@Validated +@RestController +@RequestMapping("/logistics/sheet") +public class LogisticsSheetController extends DefaultBaseController { + + @Autowired + private LogisticsSheetService logisticsSheetService; + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + /** + * 物流单列表 + */ + @ApiOperation("物流单列表") + @HasPermission({"logistics:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryLogisticsSheetVo vo) { + + PageResult pageResult = logisticsSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryLogisticsSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"logistics:sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "物流单ID不能为空!") String id) { + + LogisticsSheetFullDto data = logisticsSheetService.getDetail(id); + + GetLogisticsSheetBo result = new GetLogisticsSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询业务单据 + */ + @ApiOperation("查询业务单据") + @HasPermission({"logistics:sheet:add", "logistics:sheet:modify"}) + @GetMapping("/biz") + public InvokeResult> queryBizOrder( + @Valid QueryLogisticsSheetBizOrderVo vo) { + + PageResult pageResult = logisticsSheetService.queryBizOrder( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryLogisticsSheetBizOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 计算重量 + */ + @ApiOperation("计算重量") + @HasPermission({"logistics:sheet:add", "logistics:sheet:modify"}) + @PostMapping("/calc/weight") + public InvokeResult calcWeight( + @Valid @RequestBody LogisticsSheetCalcWeightOrVolumeVo vo) { + + BigDecimal totalWeight = BigDecimal.ZERO; + + List saleOutSheetIds = new ArrayList<>(); + List retailOutSheetIds = new ArrayList<>(); + + for (BizOrderVo bizOrder : vo.getBizOrders()) { + LogisticsSheetDetailBizType bizType = EnumUtil.getByCode(LogisticsSheetDetailBizType.class, + bizOrder.getBizType()); + + if (bizType == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + saleOutSheetIds.add(bizOrder.getBizId()); + } else if (bizType == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + retailOutSheetIds.add(bizOrder.getBizId()); + } + } + + if (CollectionUtil.isNotEmpty(saleOutSheetIds)) { + totalWeight = NumberUtil.add(totalWeight, + saleOutSheetDetailService.getTotalWeightBySheetIds(saleOutSheetIds)); + } + + if (CollectionUtil.isNotEmpty(retailOutSheetIds)) { + totalWeight = NumberUtil.add(totalWeight, + retailOutSheetDetailService.getTotalWeightBySheetIds(retailOutSheetIds)); + } + + return InvokeResultBuilder.success(totalWeight); + } + + /** + * 计算体积 + */ + @ApiOperation("计算体积") + @HasPermission({"logistics:sheet:add", "logistics:sheet:modify"}) + @PostMapping("/calc/volume") + public InvokeResult calcVolume( + @Valid @RequestBody LogisticsSheetCalcWeightOrVolumeVo vo) { + + BigDecimal totalVolume = BigDecimal.ZERO; + + List saleOutSheetIds = new ArrayList<>(); + List retailOutSheetIds = new ArrayList<>(); + + for (BizOrderVo bizOrder : vo.getBizOrders()) { + LogisticsSheetDetailBizType bizType = EnumUtil.getByCode(LogisticsSheetDetailBizType.class, + bizOrder.getBizType()); + + if (bizType == LogisticsSheetDetailBizType.SALE_OUT_SHEET) { + saleOutSheetIds.add(bizOrder.getBizId()); + } else if (bizType == LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) { + retailOutSheetIds.add(bizOrder.getBizId()); + } + } + + if (CollectionUtil.isNotEmpty(saleOutSheetIds)) { + totalVolume = NumberUtil.add(totalVolume, + saleOutSheetDetailService.getTotalVolumeBySheetIds(saleOutSheetIds)); + } + + if (CollectionUtil.isNotEmpty(retailOutSheetIds)) { + totalVolume = NumberUtil.add(totalVolume, + retailOutSheetDetailService.getTotalVolumeBySheetIds(retailOutSheetIds)); + } + + return InvokeResultBuilder.success(totalVolume); + } + + /** + * 创建物流单 + */ + @ApiOperation("创建物流单") + @HasPermission({"logistics:sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateLogisticsSheetVo vo) { + + String id = logisticsSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改物流单 + */ + @ApiOperation("修改物流单") + @HasPermission({"logistics:sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateLogisticsSheetVo vo) { + + logisticsSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除物流单 + */ + @ApiOperation("删除物流单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"logistics:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "物流单ID不能为空!") String id) { + + logisticsSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除物流单 + */ + @ApiOperation("批量删除物流单") + @HasPermission({"logistics:sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的物流单!") List ids) { + + logisticsSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 查询物流单发货信息 + */ + @ApiOperation("查询物流单发货信息") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"logistics:sheet:delivery"}) + @GetMapping("/delivery") + public InvokeResult queryDelivery( + @NotBlank(message = "ID不能为空!") String id) { + + LogisticsSheet sheet = logisticsSheetService.getById(id); + if (sheet == null) { + throw new DefaultClientException("物流单不存在!"); + } + + return InvokeResultBuilder.success(new GetLogisticsSheetDeliveryBo(sheet)); + } + + /** + * 物流单发货 + */ + @ApiOperation("物流单发货") + @HasPermission({"logistics:sheet:delivery"}) + @PutMapping("/delivery") + public InvokeResult delivery(@Valid DeliveryLogisticsSheetVo vo) { + + logisticsSheetService.delivery(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"logistics:sheet:export"}) + @PostMapping("/export") + public void export(@Valid QueryLogisticsSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("物流单信息", + LogisticsSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = logisticsSheetService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(LogisticsSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + @ApiOperation("下载导入模板") + @HasPermission({"logistics:sheet:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("物流单导入模板", LogisticsSheetImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"logistics:sheet:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + LogisticsSheetImportListener listener = new LogisticsSheetImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, LogisticsSheetImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载批量发货模板") + @HasPermission({"logistics:sheet:delivery"}) + @GetMapping("/import/template/delivery") + public void downloadDeliveryImportTemplate() { + ExcelUtil.exportXls("物流单批量发货模板", LogisticsSheetDeliveryImportModel.class); + } + + @ApiOperation("批量发货") + @HasPermission({"logistics:sheet:delivery"}) + @PostMapping("/import/delivery") + public InvokeResult deliveryImportExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + LogisticsSheetDeliveryImportListener listener = new LogisticsSheetDeliveryImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, LogisticsSheetDeliveryImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseConfigController.java new file mode 100644 index 0000000..d023617 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseConfigController.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.sc.bo.purchase.config.GetPurchaseConfigBo; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.vo.purchase.config.UpdatePurchaseConfigVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 采购参数设置 + * + * @author zmj + */ +@Api(tags = "采购参数设置") +@Validated +@RestController +@RequestMapping("/purchase/config") +public class PurchaseConfigController extends DefaultBaseController { + + @Autowired + private PurchaseConfigService purchaseConfigService; + + /** + * 查询详情 + */ + @ApiOperation("查询详情") + @GetMapping + public InvokeResult get() { + + PurchaseConfig config = purchaseConfigService.get(); + GetPurchaseConfigBo result = new GetPurchaseConfigBo(config); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@Valid UpdatePurchaseConfigVo vo) { + + purchaseConfigService.update(vo); + + purchaseConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseOrderController.java new file mode 100644 index 0000000..5e81bfa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseOrderController.java @@ -0,0 +1,479 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import cn.hutool.extra.spring.SpringUtil; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.components.security.UserDetailsService; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.purchase.*; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.excel.purchase.*; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.purchase.*; +import com.lframework.xingyun.template.core.entity.SysUser; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 采购订单管理 + * + * @author zmj + */ +@Api(tags = "采购订单管理") +@Validated +@RestController +@RequestMapping("/purchase/order") +public class PurchaseOrderController extends DefaultBaseController { + + @Autowired + private PurchaseOrderService purchaseOrderService; + + @Autowired + private ProductService productService; + + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:order:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "订单ID不能为空!") String id) { + + PurchaseOrderFullDto data = purchaseOrderService.getDetail(id); + if (data == null) { + throw new DefaultClientException("订单不存在!"); + } + + PrintPurchaseOrderBo result = new PrintPurchaseOrderBo(data); + + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo<>( + "print/purchase-order.ftl", result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 订单列表 + */ + @ApiOperation("订单列表") + @HasPermission({"purchase:order:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryPurchaseOrderVo vo) { + + PageResult pageResult = purchaseOrderService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryPurchaseOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"purchase:order:export"}) + @PostMapping("/export") + public void export(@Valid QueryPurchaseOrderVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("采购单信息", + PurchaseOrderExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = purchaseOrderService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(PurchaseOrderExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:order:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id) { + + PurchaseOrderFullDto data = purchaseOrderService.getDetail(id); + + GetPurchaseOrderBo result = new GetPurchaseOrderBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(收货业务) + */ + @ApiOperation("根据ID查询(收货业务)") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @GetMapping("/receive") + public InvokeResult getWithReceive( + @NotBlank(message = "订单ID不能为空!") String id) { + + PurchaseOrderWithReceiveDto data = purchaseOrderService.getWithReceive(id); + PurchaseOrderWithReceiveBo result = new PurchaseOrderWithReceiveBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(收货业务) + */ + @ApiOperation("查询列表(收货业务)") + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @GetMapping("/query/receive") + public InvokeResult> queryWithReceive( + @Valid QueryPurchaseOrderWithReceiveVo vo) { + + PageResult pageResult = purchaseOrderService.queryWithReceive(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryPurchaseOrderWithReceiveBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(收货业务) + */ + @ApiOperation("加载列表(收货业务)") + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @PostMapping("/query/receive/load") + public InvokeResult> loadWithReceive( + @RequestBody(required = false) List ids) { + + List datas = purchaseOrderService.listByIds(ids); + + List results = datas.stream() + .map(QueryPurchaseOrderWithReceiveBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建订单 + */ + @ApiOperation("创建订单") + @HasPermission({"purchase:order:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreatePurchaseOrderVo vo) { + + vo.validate(); + + String id = purchaseOrderService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改订单 + */ + @ApiOperation("修改订单") + @HasPermission({"purchase:order:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdatePurchaseOrderVo vo) { + + vo.validate(); + + purchaseOrderService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过订单 + */ + @ApiOperation("审核通过订单") + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassPurchaseOrderVo vo) { + + purchaseOrderService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过订单 + */ + @ApiOperation("批量审核通过订单") + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassPurchaseOrderVo vo) { + + purchaseOrderService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过订单 + */ + @ApiOperation("直接审核通过订单") + @HasPermission({"purchase:order:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreatePurchaseOrderVo vo) { + + purchaseOrderService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝订单 + */ + @ApiOperation("审核拒绝订单") + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefusePurchaseOrderVo vo) { + + purchaseOrderService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝订单 + */ + @ApiOperation("批量审核拒绝订单") + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefusePurchaseOrderVo vo) { + + purchaseOrderService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除订单 + */ + @ApiOperation("删除订单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:order:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "订单ID不能为空!") String id) { + + purchaseOrderService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除订单 + */ + @ApiOperation("批量删除订单") + @HasPermission({"purchase:order:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的订单!") List ids) { + + purchaseOrderService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 取消审核订单 + */ + @ApiOperation("取消审核订单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:order:approve"}) + @PatchMapping("/approve/cancel") + public InvokeResult cancelApprovePass(@NotBlank(message = "订单ID不能为空!") String id) { + + purchaseOrderService.cancelApprovePass(id); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"purchase:order:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("采购订单导入模板", PurchaseOrderImportModel.class); + } + + @ApiOperation("下载导入约定支付模板") + @HasPermission({"purchase:order:import"}) + @GetMapping("/import/template/paytype") + public void downloadImportPayTypeTemplate() { + ExcelUtil.exportXls("采购订单导入约定支付模板", PurchaseOrderPayTypeImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"purchase:order:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + PurchaseOrderImportListener listener = new PurchaseOrderImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, PurchaseOrderImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("导入约定支付") + @HasPermission({"purchase:order:import"}) + @PostMapping("/import/paytype") + public InvokeResult importPayTypeExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + PurchaseOrderPayTypeImportListener listener = new PurchaseOrderPayTypeImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, PurchaseOrderPayTypeImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品 + */ + @ApiOperation("根据关键字查询可采购商品") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true)}) + @HasPermission({"purchase:order:add", "purchase:order:modify", "purchase:receive:add", + "purchase:receive:modify", "purchase:return:add", "purchase:return:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchPurchaseProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + PageResult pageResult = purchaseOrderService.queryPurchaseByCondition( + getPageIndex(), getPageSize(), condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new PurchaseProductBo(scId, t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + + /** + * 根据SKU查询商品 + */ + @ApiOperation("根据SKU查询可采购商品") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "SKU", name = "sku", paramType = "query", required = true)}) + @HasPermission({"purchase:order:add", "purchase:order:modify", "purchase:receive:add", + "purchase:receive:modify", "purchase:return:add", "purchase:return:modify"}) + @GetMapping("/product/sku") + public InvokeResult searchPurchaseProductBySku( + @NotBlank(message = "仓库ID不能为空!") String scId, String sku) { + + if (StringUtil.isBlank(sku)) { + throw new DefaultClientException("SKU不能为空"); + } + + PurchaseProductDto dto = purchaseOrderService.queryPurchaseBySku(sku); + if (dto == null) { + throw new DefaultClientException("该SKU不存在"); + } + PurchaseProductBo bo = new PurchaseProductBo(scId, dto); + + return InvokeResultBuilder.success(bo); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询可采购商品列表") + @HasPermission({"purchase:order:add", "purchase:order:modify", "purchase:receive:add", + "purchase:receive:modify", "purchase:return:add", "purchase:return:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryPurchaseProductList( + @Valid QueryPurchaseProductVo vo) { + + PageResult pageResult = purchaseOrderService.queryPurchaseList( + getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new PurchaseProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 发送审批流程给ydool系统 + */ + @ApiOperation("发送审批流程给ydool系统") + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) + @HasPermission({"purchase:order:send:approve"}) + @PutMapping("/send/approve/{id}") + public InvokeResult sendApprove(@PathVariable("id") String id) { + return purchaseOrderService.sendApprove(id); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseReturnController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseReturnController.java new file mode 100644 index 0000000..dd5d637 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/PurchaseReturnController.java @@ -0,0 +1,273 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.purchase.returned.GetPurchaseReturnBo; +import com.lframework.xingyun.sc.bo.purchase.returned.PrintPurchaseReturnBo; +import com.lframework.xingyun.sc.bo.purchase.returned.QueryPurchaseReturnBo; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.excel.purchase.returned.PurchaseReturnExportModel; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import com.lframework.xingyun.sc.vo.purchase.returned.ApprovePassPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.ApproveRefusePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.BatchApprovePassPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.BatchApproveRefusePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.CreatePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.QueryPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.UpdatePurchaseReturnVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 采购退单管理 + * + * @author zmj + */ +@Api(tags = "采购退单管理") +@Validated +@RestController +@RequestMapping("/purchase/return") +public class PurchaseReturnController extends DefaultBaseController { + + @Autowired + private PurchaseReturnService purchaseReturnService; + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:return:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "退单ID不能为空!") String id) { + + PurchaseReturnFullDto data = purchaseReturnService.getDetail(id); + + PrintPurchaseReturnBo result = new PrintPurchaseReturnBo(data); + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo<>( + "print/purchase-return.ftl", result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 退单列表 + */ + @ApiOperation("退单列表") + @HasPermission({"purchase:return:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryPurchaseReturnVo vo) { + + PageResult pageResult = purchaseReturnService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryPurchaseReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"purchase:return:export"}) + @PostMapping("/export") + public void export(@Valid QueryPurchaseReturnVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("采购退货单信息", + PurchaseReturnExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = purchaseReturnService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(PurchaseReturnExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:return:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "退单ID不能为空!") String id) { + + PurchaseReturnFullDto data = purchaseReturnService.getDetail(id); + + GetPurchaseReturnBo result = new GetPurchaseReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建 + */ + @ApiOperation("创建") + @HasPermission({"purchase:return:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreatePurchaseReturnVo vo) { + + vo.validate(); + + String id = purchaseReturnService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"purchase:return:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdatePurchaseReturnVo vo) { + + vo.validate(); + + purchaseReturnService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"purchase:return:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassPurchaseReturnVo vo) { + + purchaseReturnService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"purchase:return:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassPurchaseReturnVo vo) { + + purchaseReturnService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"purchase:return:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreatePurchaseReturnVo vo) { + + purchaseReturnService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"purchase:return:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefusePurchaseReturnVo vo) { + + purchaseReturnService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"purchase:return:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefusePurchaseReturnVo vo) { + + purchaseReturnService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:return:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "采购退货单ID不能为空!") String id) { + + purchaseReturnService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"purchase:return:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的采购退货单!") List ids) { + + purchaseReturnService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/ReceiveSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/ReceiveSheetController.java new file mode 100644 index 0000000..5b81b35 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/purchase/ReceiveSheetController.java @@ -0,0 +1,410 @@ +package com.lframework.xingyun.sc.controller.purchase; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.purchase.receive.GetPaymentDateBo; +import com.lframework.xingyun.sc.bo.purchase.receive.GetReceiveSheetBo; +import com.lframework.xingyun.sc.bo.purchase.receive.PrintReceiveSheetBo; +import com.lframework.xingyun.sc.bo.purchase.receive.QueryReceiveSheetBo; +import com.lframework.xingyun.sc.bo.purchase.receive.QueryReceiveSheetWithReturnBo; +import com.lframework.xingyun.sc.bo.purchase.receive.ReceiveSheetWithReturnBo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.excel.purchase.receive.ReceiveSheetExportModel; +import com.lframework.xingyun.sc.excel.purchase.receive.ReceiveSheetImportListener; +import com.lframework.xingyun.sc.excel.purchase.receive.ReceiveSheetImportModel; +import com.lframework.xingyun.sc.excel.purchase.receive.ReceiveSheetPayTypeImportListener; +import com.lframework.xingyun.sc.excel.purchase.receive.ReceiveSheetPayTypeImportModel; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.purchase.receive.ApprovePassReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ApproveRefuseReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.BatchApprovePassReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.BatchApproveRefuseReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.CreateReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.purchase.receive.UpdateReceiveSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +/** + * 采购收货单管理 + * + * @author zmj + */ +@Api(tags = "采购收货单管理") +@Validated +@RestController +@RequestMapping("/purchase/receive/sheet") +public class ReceiveSheetController extends DefaultBaseController { + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:receive:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "订单ID不能为空!") String id) { + + ReceiveSheetFullDto data = receiveSheetService.getDetail(id); + + PrintReceiveSheetBo result = new PrintReceiveSheetBo(data); + + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo( + "print/receive-sheet.ftl", result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 订单列表 + */ + @ApiOperation("订单列表") + @HasPermission({"purchase:receive:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryReceiveSheetVo vo) { + + PageResult pageResult = receiveSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryReceiveSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"purchase:receive:export"}) + @PostMapping("/export") + public void export(@Valid QueryReceiveSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("采购收货单信息", + ReceiveSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = receiveSheetService.query(pageIndex, getExportSize(), + vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(ReceiveSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:receive:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id) { + + ReceiveSheetFullDto data = receiveSheetService.getDetail(id); + + GetReceiveSheetBo result = new GetReceiveSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据供应商ID查询默认付款日期 + */ + @ApiOperation("根据供应商ID查询默认付款日期") + @ApiImplicitParam(value = "供应商ID", name = "supplierId", paramType = "query", required = true) + @HasPermission({"purchase:receive:add", "purchase:receive:modify"}) + @GetMapping("/paymentdate") + public InvokeResult getPaymentDate( + @NotBlank(message = "供应商ID不能为空!") String supplierId) { + + GetPaymentDateDto data = receiveSheetService.getPaymentDate(supplierId); + + GetPaymentDateBo result = new GetPaymentDateBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(采购退货业务) + */ + @ApiOperation("根据ID查询(采购退货业务)") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:return:add", "purchase:return:modify"}) + @GetMapping("/return") + public InvokeResult getWithReturn( + @NotBlank(message = "收货单ID不能为空!") String id) { + + ReceiveSheetWithReturnDto data = receiveSheetService.getWithReturn(id); + ReceiveSheetWithReturnBo result = new ReceiveSheetWithReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(采购退货业务) + */ + @ApiOperation("查询列表(采购退货业务)") + @HasPermission({"purchase:return:add", "purchase:return:modify"}) + @GetMapping("/query/return") + public InvokeResult> queryWithReturn( + @Valid QueryReceiveSheetWithReturnVo vo) { + + PageResult pageResult = receiveSheetService.queryWithReturn(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryReceiveSheetWithReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(采购退货业务) + */ + @ApiOperation("加载列表(采购退货业务)") + @HasPermission({"purchase:return:add", "purchase:return:modify"}) + @PostMapping("/query/return/load") + public InvokeResult> loadWithReturn( + @RequestBody(required = false) List ids) { + + List datas = receiveSheetService.listByIds(ids); + + List results = datas.stream() + .map(QueryReceiveSheetWithReturnBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建 + */ + @ApiOperation("创建") + @HasPermission({"purchase:receive:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateReceiveSheetVo vo) { + + vo.validate(); + + String id = receiveSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"purchase:receive:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateReceiveSheetVo vo) { + + vo.validate(); + + receiveSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"purchase:receive:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassReceiveSheetVo vo) { + + receiveSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"purchase:receive:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassReceiveSheetVo vo) { + + receiveSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"purchase:receive:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateReceiveSheetVo vo) { + + receiveSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"purchase:receive:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseReceiveSheetVo vo) { + + receiveSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"purchase:receive:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseReceiveSheetVo vo) { + + receiveSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"purchase:receive:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "采购收货单ID不能为空!") String id) { + + receiveSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"purchase:receive:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的采购收货单!") List ids) { + + receiveSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("下载导入模板") + @HasPermission({"purchase:receive:import"}) + @GetMapping("/import/template") + public void downloadImportTemplate() { + ExcelUtil.exportXls("采购收货单导入模板", ReceiveSheetImportModel.class); + } + + @ApiOperation("下载导入支付方式模板") + @HasPermission({"purchase:receive:import"}) + @GetMapping("/import/template/paytype") + public void downloadImportPayTypeTemplate() { + ExcelUtil.exportXls("采购收货单导入支付方式模板", ReceiveSheetPayTypeImportModel.class); + } + + @ApiOperation("导入") + @HasPermission({"purchase:receive:import"}) + @PostMapping("/import") + public InvokeResult importExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + PurchaseConfig config = purchaseConfigService.get(); + if (config.getReceiveRequirePurchase()) { + throw new DefaultClientException("“采购收货单是否关联采购订单”必须设置为“否”才可以导入!"); + } + + ReceiveSheetImportListener listener = new ReceiveSheetImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ReceiveSheetImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("导入支付方式") + @HasPermission({"purchase:receive:import"}) + @PostMapping("/import/paytype") + public InvokeResult importPayTypeExcel(@NotBlank(message = "ID不能为空") String id, + @NotNull(message = "请上传文件") MultipartFile file) { + + ReceiveSheetPayTypeImportListener listener = new ReceiveSheetPayTypeImportListener(); + listener.setTaskId(id); + ExcelUtil.read(file, ReceiveSheetPayTypeImportModel.class, listener).sheet().doRead(); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailConfigController.java new file mode 100644 index 0000000..ffc2315 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailConfigController.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.controller.retail; + +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.sc.bo.retail.config.GetRetailConfigBo; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.vo.retail.config.UpdateRetailConfigVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 零售参数设置 + * + * @author zmj + */ +@Api(tags = "零售参数设置") +@Validated +@RestController +@RequestMapping("/retail/config") +public class RetailConfigController extends DefaultBaseController { + + @Autowired + private RetailConfigService retailConfigService; + + /** + * 查询详情 + */ + @ApiOperation("查询详情") + @GetMapping + public InvokeResult get() { + + RetailConfig config = retailConfigService.get(); + GetRetailConfigBo result = new GetRetailConfigBo(config); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@Valid UpdateRetailConfigVo vo) { + + retailConfigService.update(vo); + + retailConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailOutSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailOutSheetController.java new file mode 100644 index 0000000..fba188d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailOutSheetController.java @@ -0,0 +1,425 @@ +package com.lframework.xingyun.sc.controller.retail; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.purchase.receive.GetPaymentDateBo; +import com.lframework.xingyun.sc.bo.retail.RetailProductBo; +import com.lframework.xingyun.sc.bo.retail.out.GetRetailOutSheetBo; +import com.lframework.xingyun.sc.bo.retail.out.PrintRetailOutSheetBo; +import com.lframework.xingyun.sc.bo.retail.out.QueryRetailOutSheetBo; +import com.lframework.xingyun.sc.bo.retail.out.QueryRetailOutSheetWithReturnBo; +import com.lframework.xingyun.sc.bo.retail.out.RetailOutSheetWithReturnBo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.excel.retail.out.RetailOutSheetExportModel; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.retail.out.ApprovePassRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.ApproveRefuseRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.BatchApprovePassRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.BatchApproveRefuseRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.CreateRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailProductVo; +import com.lframework.xingyun.sc.vo.retail.out.UpdateRetailOutSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 零售出库单管理 + * + * @author zmj + */ +@Api(tags = "零售出库单管理") +@Validated +@RestController +@RequestMapping("/retail/out/sheet") +public class RetailOutSheetController extends DefaultBaseController { + + @Autowired + private RetailOutSheetService retailOutSheetService; + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"retail:out:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "订单ID不能为空!") String id) { + + RetailOutSheetFullDto data = retailOutSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("零售出库单不存在!"); + } + + PrintRetailOutSheetBo result = new PrintRetailOutSheetBo(data); + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo<>( + "print/retail-out-sheet.ftl", result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 订单列表 + */ + @ApiOperation("订单列表") + @HasPermission({"retail:out:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryRetailOutSheetVo vo) { + + PageResult pageResult = retailOutSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(QueryRetailOutSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"retail:out:export"}) + @PostMapping("/export") + public void export(@Valid QueryRetailOutSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("零售出库单信息", + RetailOutSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = retailOutSheetService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(RetailOutSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"retail:out:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id) { + + RetailOutSheetFullDto data = retailOutSheetService.getDetail(id); + + GetRetailOutSheetBo result = new GetRetailOutSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据会员ID查询默认付款日期 + */ + @ApiOperation("根据会员ID查询默认付款日期") + @ApiImplicitParam(value = "会员ID", name = "memberId", paramType = "query") + @HasPermission({"retail:out:add", "retail:out:modify"}) + @GetMapping("/paymentdate") + public InvokeResult getPaymentDate(String memberId) { + + GetPaymentDateDto data = retailOutSheetService.getPaymentDate(memberId); + + GetPaymentDateBo result = new GetPaymentDateBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(零售退货业务) + */ + @ApiOperation("根据ID查询(零售退货业务)") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"retail:return:add", "retail:return:modify"}) + @GetMapping("/return") + public InvokeResult getWithReturn( + @NotBlank(message = "出库单ID不能为空!") String id) { + + RetailOutSheetWithReturnDto data = retailOutSheetService.getWithReturn(id); + RetailOutSheetWithReturnBo result = new RetailOutSheetWithReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(零售退货业务) + */ + @ApiOperation("查询列表(零售退货业务)") + @HasPermission({"retail:return:add", "retail:return:modify"}) + @GetMapping("/query/return") + public InvokeResult> queryWithReturn( + @Valid QueryRetailOutSheetWithReturnVo vo) { + + PageResult pageResult = retailOutSheetService.queryWithReturn(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryRetailOutSheetWithReturnBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(零售退货业务) + */ + @ApiOperation("加载列表(零售退货业务)") + @HasPermission({"retail:return:add", "retail:return:modify"}) + @PostMapping("/query/return/load") + public InvokeResult> loadWithReturn( + @RequestBody(required = false) List ids) { + + List datas = retailOutSheetService.listByIds(ids); + + List results = datas.stream() + .map(QueryRetailOutSheetWithReturnBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建 + */ + @ApiOperation("创建") + @HasPermission({"retail:out:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateRetailOutSheetVo vo) { + + vo.validate(); + + String id = retailOutSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"retail:out:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateRetailOutSheetVo vo) { + + vo.validate(); + + retailOutSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"retail:out:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassRetailOutSheetVo vo) { + + retailOutSheetService.approvePass(vo); + + RetailOutSheet outSheet = retailOutSheetService.getById(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"retail:out:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassRetailOutSheetVo vo) { + + retailOutSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"retail:out:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateRetailOutSheetVo vo) { + + retailOutSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"retail:out:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseRetailOutSheetVo vo) { + + retailOutSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"retail:out:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseRetailOutSheetVo vo) { + + retailOutSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"retail:out:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "零售出库单ID不能为空!") String id) { + + retailOutSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"retail:out:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的零售出库单!") List ids) { + + retailOutSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品 + */ + @ApiOperation("根据关键字查询可零售商品") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true)}) + @HasPermission({"retail:out:add", "retail:out:modify", "retail:return:add", + "retail:return:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchRetailProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, String condition, Boolean isReturn) { + + if (isReturn == null) { + isReturn = false; + } + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + PageResult pageResult = retailOutSheetService.queryRetailByCondition( + getPageIndex(), + getPageSize(), condition, isReturn); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new RetailProductBo(scId, t)).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询可零售商品列表") + @HasPermission({"retail:out:add", "retail:out:modify", "retail:return:add", + "retail:return:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryRetailProductList( + @Valid QueryRetailProductVo vo) { + + PageResult pageResult = retailOutSheetService.queryRetailList( + getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new RetailProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 发送审批流程给ydool系统 + */ + @ApiOperation("发送审批流程给ydool系统") + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) + @HasPermission({"retail:out:send:approve"}) + @PutMapping("/send/approve/{id}") + public InvokeResult sendApprove(@PathVariable("id") String id) { + return retailOutSheetService.sendApprove(id); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailReturnController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailReturnController.java new file mode 100644 index 0000000..bb3aedb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/retail/RetailReturnController.java @@ -0,0 +1,279 @@ +package com.lframework.xingyun.sc.controller.retail; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.retail.returned.GetRetailReturnBo; +import com.lframework.xingyun.sc.bo.retail.returned.PrintRetailReturnBo; +import com.lframework.xingyun.sc.bo.retail.returned.QueryRetailReturnBo; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.excel.retail.returned.RetailReturnExportModel; +import com.lframework.xingyun.sc.service.retail.RetailReturnService; +import com.lframework.xingyun.sc.vo.retail.returned.ApprovePassRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.ApproveRefuseRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.BatchApprovePassRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.BatchApproveRefuseRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.CreateRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.QueryRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.UpdateRetailReturnVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 零售退单管理 + * + * @author zmj + */ +@Api(tags = "零售退单管理") +@Validated +@RestController +@RequestMapping("/retail/return") +public class RetailReturnController extends DefaultBaseController { + + @Autowired + private RetailReturnService retailReturnService; + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"retail:return:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "退单ID不能为空!") String id) { + + RetailReturnFullDto data = retailReturnService.getDetail(id); + if (data == null) { + throw new DefaultClientException("零售退货单不存在!"); + } + + PrintRetailReturnBo result = new PrintRetailReturnBo(data); + + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo<>( + "print/retail-return.ftl", result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 退单列表 + */ + @ApiOperation("退单列表") + @HasPermission({"retail:return:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryRetailReturnVo vo) { + + PageResult pageResult = retailReturnService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryRetailReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"retail:return:export"}) + @PostMapping("/export") + public void export(@Valid QueryRetailReturnVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("零售退货单信息", + RetailReturnExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = retailReturnService.query(pageIndex, getExportSize(), + vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(RetailReturnExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"retail:return:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "退单ID不能为空!") String id) { + + RetailReturnFullDto data = retailReturnService.getDetail(id); + + GetRetailReturnBo result = new GetRetailReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建 + */ + @ApiOperation("创建") + @HasPermission({"retail:return:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateRetailReturnVo vo) { + + vo.validate(); + + String id = retailReturnService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"retail:return:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateRetailReturnVo vo) { + + vo.validate(); + + retailReturnService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"retail:return:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassRetailReturnVo vo) { + + retailReturnService.approvePass(vo); + + RetailReturn r = retailReturnService.getById(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"retail:return:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassRetailReturnVo vo) { + + retailReturnService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"retail:return:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateRetailReturnVo vo) { + + retailReturnService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"retail:return:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseRetailReturnVo vo) { + + retailReturnService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"retail:return:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseRetailReturnVo vo) { + + retailReturnService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"retail:return:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "零售退货单ID不能为空!") String id) { + + retailReturnService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"retail:return:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的零售退货单!") List ids) { + + retailReturnService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleConfigController.java new file mode 100644 index 0000000..fad5cb0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleConfigController.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.sc.bo.sale.config.GetSaleConfigBo; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.vo.sale.config.UpdateSaleConfigVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 销售参数设置 + * + * @author zmj + */ +@Api(tags = "销售参数设置") +@Validated +@RestController +@RequestMapping("/sale/config") +public class SaleConfigController extends DefaultBaseController { + + @Autowired + private SaleConfigService saleConfigService; + + /** + * 查询详情 + */ + @ApiOperation("查询详情") + @GetMapping + public InvokeResult get() { + + SaleConfig config = saleConfigService.get(); + GetSaleConfigBo result = new GetSaleConfigBo(config); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@Valid UpdateSaleConfigVo vo) { + + saleConfigService.update(vo); + + saleConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java new file mode 100644 index 0000000..7346ab9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOrderController.java @@ -0,0 +1,398 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.sale.GetSaleOrderBo; +import com.lframework.xingyun.sc.bo.sale.PrintSaleOrderBo; +import com.lframework.xingyun.sc.bo.sale.QuerySaleOrderBo; +import com.lframework.xingyun.sc.bo.sale.QuerySaleOrderWithOutBo; +import com.lframework.xingyun.sc.bo.sale.SaleOrderWithOutBo; +import com.lframework.xingyun.sc.bo.sale.SaleProductBo; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.excel.sale.SaleOrderExportModel; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.vo.sale.ApprovePassSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.ApproveRefuseSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.BatchApprovePassSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.BatchApproveRefuseSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.CreateSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderWithOutVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleProductVo; +import com.lframework.xingyun.sc.vo.sale.UpdateSaleOrderVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 销售订单管理 + * + * @author zmj + */ +@Api(tags = "销售订单管理") +@Validated +@RestController +@RequestMapping("/sale/order") +public class SaleOrderController extends DefaultBaseController { + + @Autowired + private SaleOrderService saleOrderService; + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:order:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOrderFullDto data = saleOrderService.getDetail(id); + if (data == null) { + throw new DefaultClientException("订单不存在!"); + } + + PrintSaleOrderBo result = new PrintSaleOrderBo(data); + + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo<>( + "print/sale-order.ftl", + result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 订单列表 + */ + @ApiOperation("订单列表") + @HasPermission({"sale:order:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySaleOrderVo vo) { + + PageResult pageResult = saleOrderService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"sale:order:export"}) + @PostMapping("/export") + public void export(@Valid QuerySaleOrderVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("销售单信息", + SaleOrderExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = saleOrderService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SaleOrderExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:order:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "订单ID不能为空!") String id) { + + SaleOrderFullDto data = saleOrderService.getDetail(id); + + GetSaleOrderBo result = new GetSaleOrderBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(出库业务) + */ + @ApiOperation("根据ID查询(出库业务)") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:out:add", "sale:out:modify"}) + @GetMapping("/out") + public InvokeResult getWithOut( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOrderWithOutDto data = saleOrderService.getWithOut(id); + SaleOrderWithOutBo result = new SaleOrderWithOutBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(出库业务) + */ + @ApiOperation("查询列表(出库业务)") + @HasPermission({"sale:out:add", "sale:out:modify"}) + @GetMapping("/query/out") + public InvokeResult> queryWithOut( + @Valid QuerySaleOrderWithOutVo vo) { + + PageResult pageResult = saleOrderService.queryWithOut(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOrderWithOutBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(出库业务) + */ + @ApiOperation("加载列表(出库业务)") + @HasPermission({"sale:out:add", "sale:out:modify"}) + @PostMapping("/query/out/load") + public InvokeResult> getWithOut( + @RequestBody(required = false) List ids) { + + List datas = saleOrderService.listByIds(ids); + + List results = datas.stream() + .map(QuerySaleOrderWithOutBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建订单 + */ + @ApiOperation("创建订单") + @HasPermission({"sale:order:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSaleOrderVo vo) { + + vo.validate(); + + String id = saleOrderService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改订单 + */ + @ApiOperation("修改订单") + @HasPermission({"sale:order:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSaleOrderVo vo) { + + vo.validate(); + + saleOrderService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过订单 + */ + @ApiOperation("审核通过订单") + @HasPermission({"sale:order:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSaleOrderVo vo) { + + saleOrderService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过订单 + */ + @ApiOperation("批量审核通过订单") + @HasPermission({"sale:order:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass(@RequestBody @Valid BatchApprovePassSaleOrderVo vo) { + + saleOrderService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过订单 + */ + @ApiOperation("直接审核通过订单") + @HasPermission({"sale:order:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSaleOrderVo vo) { + + saleOrderService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝订单 + */ + @ApiOperation("审核拒绝订单") + @HasPermission({"sale:order:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSaleOrderVo vo) { + + saleOrderService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝订单 + */ + @ApiOperation("批量审核拒绝订单") + @HasPermission({"sale:order:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseSaleOrderVo vo) { + + saleOrderService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除订单 + */ + @ApiOperation("删除订单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:order:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "订单ID不能为空!") String id) { + + saleOrderService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除订单 + */ + @ApiOperation("批量删除订单") + @HasPermission({"sale:order:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的订单!") List ids) { + + saleOrderService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品 + */ + @ApiOperation("根据关键字查询可销售商品") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true)}) + @HasPermission({"sale:order:add", "sale:order:modify", "sale:out:add", "sale:out:modify", + "sale:return:add", "sale:return:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchSaleProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, String condition, Boolean isReturn) { + + if (isReturn == null) { + isReturn = false; + } + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + PageResult pageResult = saleOrderService.querySaleByCondition(getPageIndex(), + getPageSize(), condition, isReturn); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new SaleProductBo(scId, t)).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询可销售商品列表") + @HasPermission({"sale:order:add", "sale:order:modify", "sale:out:add", "sale:out:modify", + "sale:return:add", "sale:return:modify"}) + @GetMapping("/product/list") + public InvokeResult> querySaleProductList( + @Valid QuerySaleProductVo vo) { + + PageResult pageResult = saleOrderService.querySaleList(getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new SaleProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 发送审批流程给ydool系统 + */ + @ApiOperation("发送审批流程给ydool系统") + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) + @HasPermission({"sale:order:send:approve"}) + @PutMapping("/send/approve/{id}") + public InvokeResult sendApprove(@PathVariable("id") String id) { + return saleOrderService.sendApprove(id); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOutSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOutSheetController.java new file mode 100644 index 0000000..da5755f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleOutSheetController.java @@ -0,0 +1,358 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.purchase.receive.GetPaymentDateBo; +import com.lframework.xingyun.sc.bo.sale.out.GetSaleOutSheetBo; +import com.lframework.xingyun.sc.bo.sale.out.PrintSaleOutSheetBo; +import com.lframework.xingyun.sc.bo.sale.out.QuerySaleOutSheetBo; +import com.lframework.xingyun.sc.bo.sale.out.QuerySaleOutSheetWithReturnBo; +import com.lframework.xingyun.sc.bo.sale.out.SaleOutSheetWithReturnBo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.excel.sale.out.SaleOutSheetExportModel; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.vo.sale.out.ApprovePassSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.ApproveRefuseSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.BatchApprovePassSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.BatchApproveRefuseSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.CreateSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.sale.out.UpdateSaleOutSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 销售出库单管理 + * + * @author zmj + */ +@Api(tags = "销售出库单管理") +@Validated +@RestController +@RequestMapping("/sale/out/sheet") +public class SaleOutSheetController extends DefaultBaseController { + + @Autowired + private SaleOutSheetService saleOutSheetService; + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:out:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOutSheetFullDto data = saleOutSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("销售出库单不存在!"); + } + + PrintSaleOutSheetBo result = new PrintSaleOutSheetBo(data); + + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo<>( + "print/sale-out-sheet.ftl", result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 订单列表 + */ + @ApiOperation("订单列表") + @HasPermission({"sale:out:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySaleOutSheetVo vo) { + + PageResult pageResult = saleOutSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOutSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"sale:out:export"}) + @PostMapping("/export") + public void export(@Valid QuerySaleOutSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("销售出库单信息", + SaleOutSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = saleOutSheetService.query(pageIndex, getExportSize(), + vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SaleOutSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:out:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "订单ID不能为空!") String id) { + + SaleOutSheetFullDto data = saleOutSheetService.getDetail(id); + + GetSaleOutSheetBo result = new GetSaleOutSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据客户ID查询默认付款日期 + */ + @ApiOperation("根据客户ID查询默认付款日期") + @ApiImplicitParam(value = "客户ID", name = "customerId", paramType = "query", required = true) + @HasPermission({"sale:out:add", "sale:out:modify"}) + @GetMapping("/paymentdate") + public InvokeResult getPaymentDate( + @NotBlank(message = "客户ID不能为空!") String customerId) { + + GetPaymentDateDto data = saleOutSheetService.getPaymentDate(customerId); + + GetPaymentDateBo result = new GetPaymentDateBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询(销售退货业务) + */ + @ApiOperation("根据ID查询(销售退货业务)") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:return:add", "sale:return:modify"}) + @GetMapping("/return") + public InvokeResult getWithReturn( + @NotBlank(message = "出库单ID不能为空!") String id) { + + SaleOutSheetWithReturnDto data = saleOutSheetService.getWithReturn(id); + SaleOutSheetWithReturnBo result = new SaleOutSheetWithReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 查询列表(销售退货业务) + */ + @ApiOperation("查询列表(销售退货业务)") + @HasPermission({"sale:return:add", "sale:return:modify"}) + @GetMapping("/query/return") + public InvokeResult> queryWithReturn( + @Valid QuerySaleOutSheetWithReturnVo vo) { + + PageResult pageResult = saleOutSheetService.queryWithReturn(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleOutSheetWithReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载列表(销售退货业务) + */ + @ApiOperation("加载列表(销售退货业务)") + @HasPermission({"sale:return:add", "sale:return:modify"}) + @PostMapping("/query/return/load") + public InvokeResult> loadWithReturn( + @RequestBody(required = false) List ids) { + + List datas = saleOutSheetService.listByIds(ids); + + List results = datas.stream() + .map(QuerySaleOutSheetWithReturnBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 创建 + */ + @ApiOperation("创建") + @HasPermission({"sale:out:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSaleOutSheetVo vo) { + + vo.validate(); + + String id = saleOutSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"sale:out:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSaleOutSheetVo vo) { + + vo.validate(); + + saleOutSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"sale:out:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSaleOutSheetVo vo) { + + saleOutSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"sale:out:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassSaleOutSheetVo vo) { + + saleOutSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"sale:out:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSaleOutSheetVo vo) { + + saleOutSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"sale:out:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSaleOutSheetVo vo) { + + saleOutSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"sale:out:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseSaleOutSheetVo vo) { + + saleOutSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:out:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "销售出库单ID不能为空!") String id) { + + saleOutSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"sale:out:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的销售出库单!") List ids) { + + saleOutSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleReturnController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleReturnController.java new file mode 100644 index 0000000..6d39a37 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/sale/SaleReturnController.java @@ -0,0 +1,276 @@ +package com.lframework.xingyun.sc.controller.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.bo.print.A4ExcelPortraitPrintBo; +import com.lframework.xingyun.sc.bo.sale.returned.GetSaleReturnBo; +import com.lframework.xingyun.sc.bo.sale.returned.PrintSaleReturnBo; +import com.lframework.xingyun.sc.bo.sale.returned.QuerySaleReturnBo; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.excel.sale.returned.SaleReturnExportModel; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import com.lframework.xingyun.sc.vo.sale.returned.ApprovePassSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.ApproveRefuseSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.BatchApprovePassSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.BatchApproveRefuseSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.CreateSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.QuerySaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.UpdateSaleReturnVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 销售退单管理 + * + * @author zmj + */ +@Api(tags = "销售退单管理") +@Validated +@RestController +@RequestMapping("/sale/return") +public class SaleReturnController extends DefaultBaseController { + + @Autowired + private SaleReturnService saleReturnService; + + /** + * 打印 + */ + @ApiOperation("打印") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:return:query"}) + @GetMapping("/print") + public InvokeResult> print( + @NotBlank(message = "退单ID不能为空!") String id) { + + SaleReturnFullDto data = saleReturnService.getDetail(id); + + if (data == null) { + throw new DefaultClientException("销售退单不存在!"); + } + + PrintSaleReturnBo result = new PrintSaleReturnBo(data); + + A4ExcelPortraitPrintBo printResult = new A4ExcelPortraitPrintBo( + "print/sale-return.ftl", result); + + return InvokeResultBuilder.success(printResult); + } + + /** + * 退单列表 + */ + @ApiOperation("退单列表") + @HasPermission({"sale:return:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySaleReturnVo vo) { + + PageResult pageResult = saleReturnService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySaleReturnBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"sale:return:export"}) + @PostMapping("/export") + public void export(@Valid QuerySaleReturnVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("销售退货单信息", + SaleReturnExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = saleReturnService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SaleReturnExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:return:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "退单ID不能为空!") String id) { + + SaleReturnFullDto data = saleReturnService.getDetail(id); + + GetSaleReturnBo result = new GetSaleReturnBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建 + */ + @ApiOperation("创建") + @HasPermission({"sale:return:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSaleReturnVo vo) { + + vo.validate(); + + String id = saleReturnService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"sale:return:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSaleReturnVo vo) { + + vo.validate(); + + saleReturnService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"sale:return:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSaleReturnVo vo) { + + saleReturnService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"sale:return:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass(@RequestBody @Valid BatchApprovePassSaleReturnVo vo) { + + saleReturnService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"sale:return:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSaleReturnVo vo) { + + saleReturnService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"sale:return:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSaleReturnVo vo) { + + saleReturnService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"sale:return:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseSaleReturnVo vo) { + + saleReturnService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"sale:return:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "销售退货单ID不能为空!") String id) { + + saleReturnService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"sale:return:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的销售退货单!") List ids) { + + saleReturnService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockController.java new file mode 100644 index 0000000..0567ceb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockController.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.sc.controller.stock; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.product.QueryProductStockBo; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.excel.stock.ProductStockExportModel; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 商品库存 + * + * @author zmj + */ +@Api(tags = "商品库存") +@Validated +@RestController +@RequestMapping("/stock/product") +public class ProductStockController extends DefaultBaseController { + + @Autowired + private ProductStockService productStockService; + + /** + * 查询商品库存 + */ + @ApiOperation("查询商品库存") + @HasPermission({"stock:product:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductStockVo vo) { + + PageResult pageResult = productStockService.query(getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryProductStockBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出商品库存 + */ + @ApiOperation("导出商品库存") + @HasPermission({"stock:product:export"}) + @GetMapping("/export") + public void export(@Valid QueryProductStockVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("商品库存信息", + ProductStockExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = productStockService.query(pageIndex, getExportSize(), + vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(ProductStockExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockLogController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockLogController.java new file mode 100644 index 0000000..68e25fd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/ProductStockLogController.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.sc.controller.stock; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.product.log.QueryProductStockLogBo; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.excel.stock.ProductStockLogExportModel; +import com.lframework.xingyun.sc.service.stock.ProductStockLogService; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 商品库存变动记录 + * + * @author zmj + */ +@Api(tags = "商品库存变动记录") +@Validated +@RestController +@RequestMapping("/stock/product/log") +public class ProductStockLogController extends DefaultBaseController { + + @Autowired + private ProductStockLogService productStockLogService; + + /** + * 查询商品库存变动记录 + */ + @ApiOperation("查询商品库存变动记录") + @HasPermission({"stock:product-log:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryProductStockLogVo vo) { + + PageResult pageResult = productStockLogService.query(getPageIndex(vo), + getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryProductStockLogBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出商品库存变动记录 + */ + @ApiOperation("导出商品库存变动记录") + @HasPermission({"stock:product-log:export"}) + @GetMapping("/export") + public void export(@Valid QueryProductStockLogVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("商品库存变动记录信息", + ProductStockLogExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = productStockLogService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(ProductStockLogExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustReasonController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustReasonController.java new file mode 100644 index 0000000..a94bf6e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustReasonController.java @@ -0,0 +1,157 @@ +package com.lframework.xingyun.sc.controller.stock.adjust; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.reason.GetStockAdjustReasonBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.reason.QueryStockAdjustReasonBo; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.CreateStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.UpdateStockAdjustReasonVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 库存调整原因 + * + * @author zmj + */ +@Api(tags = "库存调整原因") +@Validated +@RestController +@RequestMapping("/stock/adjust/reason") +public class StockAdjustReasonController extends DefaultBaseController { + + @Autowired + private StockAdjustReasonService stockAdjustReasonService; + + /** + * 库存调整原因列表 + */ + @ApiOperation("库存调整原因列表") + @HasPermission({"stock:adjust:reason:query", "stock:adjust:reason:add", + "stock:adjust:reason:modify"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryStockAdjustReasonVo vo) { + + PageResult pageResult = stockAdjustReasonService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryStockAdjustReasonBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询库存调整原因 + */ + @ApiOperation("查询库存调整原因") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:adjust:reason:query", "stock:adjust:reason:add", + "stock:adjust:reason:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + StockAdjustReason data = stockAdjustReasonService.findById(id); + if (data == null) { + throw new DefaultClientException("库存调整原因不存在!"); + } + + GetStockAdjustReasonBo result = new GetStockAdjustReasonBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用库存调整原因 + */ + @ApiOperation("批量停用库存调整原因") + @HasPermission({"stock:adjust:reason:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的库存调整原因!") @RequestBody List ids) { + + stockAdjustReasonService.batchUnable(ids); + + for (String id : ids) { + stockAdjustReasonService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用库存调整原因 + */ + @ApiOperation("批量启用库存调整原因") + @HasPermission({"stock:adjust:reason:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的库存调整原因!") @RequestBody List ids) { + + stockAdjustReasonService.batchEnable(ids); + + for (String id : ids) { + stockAdjustReasonService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增库存调整原因 + */ + @ApiOperation("新增库存调整原因") + @HasPermission({"stock:adjust:reason:add"}) + @PostMapping + public InvokeResult create(@Valid CreateStockAdjustReasonVo vo) { + + stockAdjustReasonService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改库存调整原因 + */ + @ApiOperation("修改库存调整原因") + @HasPermission({"stock:adjust:reason:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateStockAdjustReasonVo vo) { + + stockAdjustReasonService.update(vo); + + stockAdjustReasonService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustSheetController.java new file mode 100644 index 0000000..5064192 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockAdjustSheetController.java @@ -0,0 +1,347 @@ +package com.lframework.xingyun.sc.controller.stock.adjust; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.QueryStockAdjustSheetBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.StockAdjustProductBo; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.StockAdjustSheetFullBo; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.excel.stock.adjust.StockAdjustSheetExportModel; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetService; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.ApprovePassStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.ApproveRefuseStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.BatchApprovePassStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.BatchApproveRefuseStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.CreateStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.UpdateStockAdjustSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 库存调整单 Controller + * + * @author zmj + */ +@Api(tags = "库存调整单") +@Validated +@RestController +@RequestMapping("/stock/adjust") +public class StockAdjustSheetController extends DefaultBaseController { + + @Autowired + private StockAdjustSheetService stockAdjustSheetService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"stock:adjust:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryStockAdjustSheetVo vo) { + + PageResult pageResult = stockAdjustSheetService.query( + getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryStockAdjustSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:adjust:query"}) + @GetMapping("/detail") + public InvokeResult getDetail( + @NotBlank(message = "id不能为空!") String id) { + + StockAdjustSheetFullDto data = stockAdjustSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("库存调整单不存在!"); + } + + StockAdjustSheetFullBo result = new StockAdjustSheetFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"stock:adjust:export"}) + @PostMapping("/export") + public void export(@Valid QueryStockAdjustSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("库存调整单信息", + StockAdjustSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = stockAdjustSheetService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(StockAdjustSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据关键字查询商品列表 + */ + @ApiOperation("根据关键字查询商品列表") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true)}) + @HasPermission({"stock:adjust:add", "stock:adjust:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, + String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + PageResult pageResult = stockAdjustSheetService.queryStockAdjustByCondition( + getPageIndex(), getPageSize(), scId, condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new StockAdjustProductBo(scId, t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 根据扫码信息SKU查询商品信息 + */ + @ApiOperation("根据扫码信息SKU查询商品信息") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "SKU", name = "SKU", paramType = "query", required = true)}) + @HasPermission({"stock:adjust:add", "stock:adjust:modify"}) + @GetMapping("/product/sku") + public InvokeResult searchProductBySku( + @NotBlank(message = "仓库ID不能为空!") String scId, + String sku) { + + if (StringUtil.isBlank(sku)) { + throw new DefaultClientException("请输入商品SKU信息"); + } + + StockAdjustProductDto stockAdjustProductDto = stockAdjustSheetService.queryStockAdjustBySku(scId, sku); + if (stockAdjustProductDto == null) { + throw new DefaultClientException("商品不存在!"); + } + StockAdjustProductBo stockAdjustProductBo = new StockAdjustProductBo(scId, stockAdjustProductDto); + + return InvokeResultBuilder.success(stockAdjustProductBo); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询商品列表") + @HasPermission({"stock:adjust:add", "stock:adjust:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryStockAdjustProductVo vo) { + + PageResult pageResult = stockAdjustSheetService.queryStockAdjustList( + getPageIndex(), + getPageSize(), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new StockAdjustProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"stock:adjust:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateStockAdjustSheetVo vo) { + + vo.validate(); + + stockAdjustSheetService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"stock:adjust:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateStockAdjustSheetVo vo) { + + vo.validate(); + + stockAdjustSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:adjust:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "id不能为空!") String id) { + + stockAdjustSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"stock:adjust:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的库存调整单!") List ids) { + + stockAdjustSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"stock:adjust:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassStockAdjustSheetVo vo) { + + stockAdjustSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"stock:adjust:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassStockAdjustSheetVo vo) { + + stockAdjustSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"stock:adjust:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateStockAdjustSheetVo vo) { + + stockAdjustSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"stock:adjust:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseStockAdjustSheetVo vo) { + + stockAdjustSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"stock:adjust:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseStockAdjustSheetVo vo) { + + stockAdjustSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + + /** + * 发送审批流程给ydool系统 + */ + @ApiOperation("发送审批流程给ydool系统") + @ApiImplicitParam(value = "ID", name = "id", paramType = "path", required = true) + @HasPermission({"stock:adjust:send:approve"}) + @PutMapping("/send/approve/{id}") + public InvokeResult sendApprove(@PathVariable("id") String id) { + return stockAdjustSheetService.sendApprove(id); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockCostAdjustSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockCostAdjustSheetController.java new file mode 100644 index 0000000..a428991 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/adjust/StockCostAdjustSheetController.java @@ -0,0 +1,314 @@ +package com.lframework.xingyun.sc.controller.stock.adjust; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.adjust.cost.QueryStockCostAdjustSheetBo; +import com.lframework.xingyun.sc.bo.stock.adjust.cost.StockCostAdjustProductBo; +import com.lframework.xingyun.sc.bo.stock.adjust.cost.StockCostAdjustSheetFullBo; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheet; +import com.lframework.xingyun.sc.excel.stock.adjust.StockCostAdjustSheetExportModel; +import com.lframework.xingyun.sc.service.stock.adjust.StockCostAdjustSheetService; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.ApprovePassStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.ApproveRefuseStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.BatchApprovePassStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.BatchApproveRefuseStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.CreateStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.UpdateStockCostAdjustSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 库存成本调整单 Controller + * + * @author zmj + */ +@Api(tags = "库存成本调整单") +@Validated +@RestController +@RequestMapping("/stock/adjust/cost") +public class StockCostAdjustSheetController extends DefaultBaseController { + + @Autowired + private StockCostAdjustSheetService stockCostAdjustSheetService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"stock:adjust:cost:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryStockCostAdjustSheetVo vo) { + + PageResult pageResult = stockCostAdjustSheetService.query( + getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryStockCostAdjustSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:adjust:cost:query"}) + @GetMapping("/detail") + public InvokeResult getDetail( + @NotBlank(message = "id不能为空!") String id) { + + StockCostAdjustSheetFullDto data = stockCostAdjustSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("库存成本调整单不存在!"); + } + + StockCostAdjustSheetFullBo result = new StockCostAdjustSheetFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"stock:adjust:cost:export"}) + @PostMapping("/export") + public void export(@Valid QueryStockCostAdjustSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("库存成本调整单信息", + StockCostAdjustSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = stockCostAdjustSheetService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(StockCostAdjustSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据关键字查询商品列表 + */ + @ApiOperation("根据关键字查询商品列表") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true)}) + @HasPermission({"stock:adjust:cost:add", "stock:adjust:cost:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, + String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + PageResult pageResult = stockCostAdjustSheetService.queryStockCostAdjustByCondition( + getPageIndex(), getPageSize(), scId, condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(StockCostAdjustProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询商品列表") + @HasPermission({"stock:adjust:cost:add", "stock:adjust:cost:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryStockCostAdjustProductVo vo) { + + PageResult pageResult = stockCostAdjustSheetService.queryStockCostAdjustList( + getPageIndex(), + getPageSize(), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(StockCostAdjustProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"stock:adjust:cost:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateStockCostAdjustSheetVo vo) { + + vo.validate(); + + stockCostAdjustSheetService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"stock:adjust:cost:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateStockCostAdjustSheetVo vo) { + + vo.validate(); + + stockCostAdjustSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:adjust:cost:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "id不能为空!") String id) { + + stockCostAdjustSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"stock:adjust:cost:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的库存成本调整单!") List ids) { + + stockCostAdjustSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"stock:adjust:cost:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassStockCostAdjustSheetVo vo) { + + stockCostAdjustSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"stock:adjust:cost:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassStockCostAdjustSheetVo vo) { + + stockCostAdjustSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"stock:adjust:cost:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateStockCostAdjustSheetVo vo) { + + stockCostAdjustSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"stock:adjust:cost:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseStockCostAdjustSheetVo vo) { + + stockCostAdjustSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"stock:adjust:cost:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseStockCostAdjustSheetVo vo) { + + stockCostAdjustSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/PreTakeStockSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/PreTakeStockSheetController.java new file mode 100644 index 0000000..744b7c2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/PreTakeStockSheetController.java @@ -0,0 +1,272 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.take.pre.GetPreTakeStockSheetBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.PreTakeStockProductBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.QueryPreTakeStockSheetBo; +import com.lframework.xingyun.sc.bo.stock.take.pre.QueryPreTakeStockSheetProductBo; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.excel.stock.take.pre.PreTakeStockSheetExportModel; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.vo.stock.take.pre.CreatePreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockProductVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.UpdatePreTakeStockSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 预先盘点单 Controller + * + * @author zmj + */ +@Api(tags = "预先盘点单") +@Validated +@RestController +@RequestMapping("/stock/take/pre") +public class PreTakeStockSheetController extends DefaultBaseController { + + @Autowired + private PreTakeStockSheetService preTakeStockSheetService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"stock:take:pre:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryPreTakeStockSheetVo vo) { + + PageResult pageResult = preTakeStockSheetService.query(getPageIndex(vo), + getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryPreTakeStockSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出列表 + */ + @ApiOperation("导出列表") + @HasPermission({"stock:take:pre:export"}) + @PostMapping("/export") + public void export(@Valid QueryPreTakeStockSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("预先盘点单信息", + PreTakeStockSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = preTakeStockSheetService.query(pageIndex, + getExportSize(), + vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(PreTakeStockSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:pre:query"}) + @GetMapping + public InvokeResult getDetail(@NotBlank(message = "id不能为空!") String id) { + + PreTakeStockSheetFullDto data = preTakeStockSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("预先盘点单不存在!"); + } + + GetPreTakeStockSheetBo result = new GetPreTakeStockSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据预先盘点单、盘点任务查询商品信息 + */ + @ApiOperation("根据预先盘点单、盘点任务查询商品信息") + @ApiImplicitParams({ + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true), + @ApiImplicitParam(value = "盘点任务ID", name = "planId", paramType = "query", required = true)}) + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/products") + public InvokeResult> getProducts( + @NotBlank(message = "ID不能为空!") String id, + @NotBlank(message = "盘点任务ID不能为空!") String planId) { + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(planId); + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + planId = null; + } + + List datas = preTakeStockSheetService.getProducts(id, planId); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream() + .map(t -> new QueryPreTakeStockSheetProductBo(t, takeStockPlan.getScId())) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"stock:take:pre:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreatePreTakeStockSheetVo vo) { + + vo.validate(); + + preTakeStockSheetService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"stock:take:pre:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdatePreTakeStockSheetVo vo) { + + vo.validate(); + + preTakeStockSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:pre:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "ID不能为空!") String id) { + + preTakeStockSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @HasPermission({"stock:take:pre:delete"}) + @DeleteMapping("/batch") + public InvokeResult batchDelete( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择要执行操作的预先盘点单!") @RequestBody List ids) { + + preTakeStockSheetService.batchDelete(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 根据关键字查询商品列表 + */ + @ApiOperation("根据关键字查询预先盘点单商品列表") + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true) + @HasPermission({"stock:take:pre:add", "stock:take:pre:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts(String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + PageResult pageResult = preTakeStockSheetService.queryPreTakeStockByCondition( + getPageIndex(), getPageSize(), condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PreTakeStockProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询预先盘点单商品列表") + @HasPermission({"stock:take:pre:add", "stock:take:pre:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryPreTakeStockProductVo vo) { + + PageResult pageResult = preTakeStockSheetService.queryPreTakeStockList( + getPageIndex(vo), getPageSize(vo), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(PreTakeStockProductBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockConfigController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockConfigController.java new file mode 100644 index 0000000..81ba12b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockConfigController.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.sc.bo.stock.take.config.GetTakeStockConfigBo; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.vo.stock.take.config.UpdateTakeStockConfigVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 盘点参数 Controller + * + * @author zmj + */ +@Api(tags = "盘点参数") +@Validated +@RestController +@RequestMapping("/stock/take/config") +public class TakeStockConfigController extends DefaultBaseController { + + @Autowired + private TakeStockConfigService takeStockConfigService; + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @HasPermission({"stock:take:config:modify", "stock:take:plan:handle:diff"}) + @GetMapping + public InvokeResult get() { + + TakeStockConfig data = takeStockConfigService.get(); + if (data == null) { + throw new DefaultClientException("盘点参数不存在!"); + } + + GetTakeStockConfigBo result = new GetTakeStockConfigBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"stock:take:config:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateTakeStockConfigVo vo) { + + takeStockConfigService.update(vo); + + takeStockConfigService.cleanCacheByKey(null); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockPlanController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockPlanController.java new file mode 100644 index 0000000..f459b85 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockPlanController.java @@ -0,0 +1,284 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.starter.web.common.threads.DefaultRunnable; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.CronUtil; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.take.plan.GetTakeStockPlanBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.QueryTakeStockPlanBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.QueryTakeStockPlanProductBo; +import com.lframework.xingyun.sc.bo.stock.take.plan.TakeStockPlanFullBo; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.excel.stock.take.plan.TakeStockPlanExportModel; +import com.lframework.xingyun.sc.impl.stock.take.TakeStockPlanServiceImpl; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.vo.stock.take.plan.CancelTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.CreateTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.HandleTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.QueryTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.UpdateTakeStockPlanVo; +import com.lframework.xingyun.template.core.components.qrtz.QrtzHandler; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 盘点任务 Controller + * + * @author zmj + */ +@Api(tags = "盘点任务") +@Validated +@RestController +@RequestMapping("/stock/take/plan") +public class TakeStockPlanController extends DefaultBaseController { + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Autowired + private TakeStockConfigService takeStockConfigService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"stock:take:plan:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryTakeStockPlanVo vo) { + + PageResult pageResult = takeStockPlanService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryTakeStockPlanBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出列表 + */ + @ApiOperation("导出列表") + @HasPermission({"stock:take:plan:export"}) + @PostMapping("/export") + public void export(@Valid QueryTakeStockPlanVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("盘点任务信息", + TakeStockPlanExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = takeStockPlanService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(TakeStockPlanExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:plan:query", "stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + TakeStockPlan data = takeStockPlanService.getById(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + GetTakeStockPlanBo result = new GetTakeStockPlanBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询详情") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:plan:query", "stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/detail") + public InvokeResult getDetail(@NotBlank(message = "id不能为空!") String id) { + + TakeStockPlanFullDto data = takeStockPlanService.getDetail(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + TakeStockPlanFullBo result = new TakeStockPlanFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据盘点任务ID查询商品信息 + */ + @ApiOperation("根据盘点任务ID查询商品信息") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/products") + public InvokeResult> getProducts( + @NotBlank(message = "id不能为空!") String id) { + + TakeStockConfig config = takeStockConfigService.get(); + if (!config.getShowProduct()) { + // 如果不显示商品的话,则显示emptyList + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = takeStockPlanService.getProducts(id); + if (CollectionUtil.isEmpty(datas)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List results = datas.stream().map(QueryTakeStockPlanProductBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"stock:take:plan:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateTakeStockPlanVo vo) { + + vo.validate(); + + String id = takeStockPlanService.create(vo); + + TakeStockConfig config = takeStockConfigService.get(); + + Map params = new HashMap<>(); + params.put("id", id); + params.put(StringPool.TENANT_ID_QRTZ, TenantContextHolder.getTenantId()); + + ThreadUtil.execAsync(new DefaultRunnable(() -> { + // 自动作废 + QrtzHandler.addJob(TakeStockPlanServiceImpl.AutoCancelJob.class, + CronUtil.getDateTimeCron(LocalDateTime.now().plusHours(config.getCancelHours())), params); + })); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"stock:take:plan:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateTakeStockPlanVo vo) { + + takeStockPlanService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 差异生成 + */ + @ApiOperation("差异生成") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:plan:create-diff"}) + @PatchMapping("/diff") + public InvokeResult createDiff(@NotBlank(message = "ID不能为空!") String id) { + + takeStockPlanService.createDiff(id); + + return InvokeResultBuilder.success(); + } + + /** + * 差异处理 + */ + @ApiOperation("差异处理") + @HasPermission({"stock:take:plan:handle-diff"}) + @PatchMapping("/handle") + public InvokeResult handleDiff(@Valid @RequestBody HandleTakeStockPlanVo vo) { + + takeStockPlanService.handleDiff(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 作废 + */ + @ApiOperation("作废") + @HasPermission({"stock:take:plan:cancel"}) + @PatchMapping("/cancel") + public InvokeResult cancel(@Valid CancelTakeStockPlanVo vo) { + + takeStockPlanService.cancel(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:plan:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "ID不能为空!") String id) { + + takeStockPlanService.deleteById(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockSheetController.java new file mode 100644 index 0000000..83d6005 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/take/TakeStockSheetController.java @@ -0,0 +1,342 @@ +package com.lframework.xingyun.sc.controller.stock.take; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.take.sheet.QueryTakeStockSheetBo; +import com.lframework.xingyun.sc.bo.stock.take.sheet.TakeStockSheetFullBo; +import com.lframework.xingyun.sc.bo.stock.take.sheet.TakeStockSheetProductBo; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.excel.stock.take.sheet.TakeStockSheetExportModel; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.sheet.ApprovePassTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.ApproveRefuseTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.BatchApprovePassTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.BatchApproveRefuseTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.CreateTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetProductVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.UpdateTakeStockSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 盘点单 Controller + * + * @author zmj + */ +@Api(tags = "盘点单") +@Validated +@RestController +@RequestMapping("/stock/take/sheet") +public class TakeStockSheetController extends DefaultBaseController { + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"stock:take:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryTakeStockSheetVo vo) { + + PageResult pageResult = takeStockSheetService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryTakeStockSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出列表 + */ + @ApiOperation("导出列表") + @HasPermission({"stock:take:sheet:export"}) + @PostMapping("/export") + public void export(@Valid QueryTakeStockSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("库存盘点单信息", + TakeStockSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = takeStockSheetService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(TakeStockSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:sheet:query"}) + @GetMapping("/detail") + public InvokeResult getDetail(@NotBlank(message = "id不能为空!") String id) { + + TakeStockSheetFullDto data = takeStockSheetService.getDetail(id); + if (data == null) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockSheetFullBo result = new TakeStockSheetFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据关键字查询商品列表 + */ + @ApiOperation("根据关键字查询商品列表") + @ApiImplicitParams({ + @ApiImplicitParam(value = "盘点任务ID", name = "planId", paramType = "query", required = true), + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true)}) + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts( + @NotBlank(message = "盘点任务ID不能为空!") String planId, + String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(planId); + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + planId = null; + } + PageResult pageResult = takeStockSheetService.queryTakeStockByCondition( + getPageIndex(), + getPageSize(), planId, condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + String finalPlanId = planId; + results = datas.stream() + .map(t -> new TakeStockSheetProductBo(t, finalPlanId, takeStockPlan.getScId())) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询商品列表") + @HasPermission({"stock:take:sheet:add", "stock:take:sheet:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryTakeStockSheetProductVo vo) { + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(vo.getPlanId()); + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + vo.setPlanId(null); + } + + PageResult pageResult = takeStockSheetService.queryTakeStockList( + getPageIndex(), + getPageSize(), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream() + .map(t -> new TakeStockSheetProductBo(t, vo.getPlanId(), takeStockPlan.getScId())) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"stock:take:sheet:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateTakeStockSheetVo vo) { + + takeStockSheetService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"stock:take:sheet:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateTakeStockSheetVo vo) { + + takeStockSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"stock:take:sheet:approve"}) + @PostMapping("/approve/direct") + public InvokeResult directApprovePass(@Valid @RequestBody CreateTakeStockSheetVo vo) { + + takeStockSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"stock:take:sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@Valid ApprovePassTakeStockSheetVo vo) { + + takeStockSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"stock:take:sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @Valid @RequestBody BatchApprovePassTakeStockSheetVo vo) { + + takeStockSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"stock:take:sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@Valid ApproveRefuseTakeStockSheetVo vo) { + + takeStockSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"stock:take:sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @Valid @RequestBody BatchApproveRefuseTakeStockSheetVo vo) { + + takeStockSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 取消审核 + */ + @ApiOperation("取消审核") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:sheet:cancel-approve"}) + @PatchMapping("/approve/cancel") + public InvokeResult cancelApprovePass(@NotBlank(message = "ID不能为空!") String id) { + + takeStockSheetService.cancelApprovePass(id); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + */ + @ApiOperation("删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:take:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "ID不能为空!") String id) { + + takeStockSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"stock:take:sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult batchDelete( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择要执行操作的库存盘点单!") @RequestBody List ids) { + + takeStockSheetService.batchDelete(ids); + + return InvokeResultBuilder.success(); + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/transfer/ScTransferOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/transfer/ScTransferOrderController.java new file mode 100644 index 0000000..9f9c1d5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/stock/transfer/ScTransferOrderController.java @@ -0,0 +1,367 @@ +package com.lframework.xingyun.sc.controller.stock.transfer; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.bo.stock.transfer.QueryScTransferOrderBo; +import com.lframework.xingyun.sc.bo.stock.transfer.QueryScTransferOrderDetailReceiveBo; +import com.lframework.xingyun.sc.bo.stock.transfer.ScTransferOrderFullBo; +import com.lframework.xingyun.sc.bo.stock.transfer.ScTransferProductBo; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import com.lframework.xingyun.sc.excel.stock.transfer.ScTransferOrderExportModel; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailReceiveService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderService; +import com.lframework.xingyun.sc.vo.stock.transfer.ApprovePassScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ApproveRefuseScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.BatchApprovePassScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.BatchApproveRefuseScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.CreateScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferOrderDetailReceiveVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferProductVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ReceiveScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.UpdateScTransferOrderVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 仓库调拨单 Controller + * + * @author zmj + */ +@Api(tags = "仓库调拨单") +@Validated +@RestController +@RequestMapping("/stock/transfer/sc") +public class ScTransferOrderController extends DefaultBaseController { + + @Autowired + private ScTransferOrderService scTransferOrderService; + + @Autowired + private ScTransferOrderDetailReceiveService scTransferOrderDetailReceiveService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"stock:sc-transfer:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryScTransferOrderVo vo) { + + PageResult pageResult = scTransferOrderService.query( + getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryScTransferOrderBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:sc-transfer:query"}) + @GetMapping("/detail") + public InvokeResult getDetail( + @NotBlank(message = "id不能为空!") String id) { + + ScTransferOrderFullDto data = scTransferOrderService.getDetail(id); + if (data == null) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + ScTransferOrderFullBo result = new ScTransferOrderFullBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"stock:sc-transfer:export"}) + @PostMapping("/export") + public void export(@Valid QueryScTransferOrderVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("仓库调拨单信息", + ScTransferOrderExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = scTransferOrderService.query(pageIndex, + getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(ScTransferOrderExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据关键字查询商品列表 + */ + @ApiOperation("根据关键字查询商品列表") + @ApiImplicitParams({ + @ApiImplicitParam(value = "仓库ID", name = "scId", paramType = "query", required = true), + @ApiImplicitParam(value = "关键字", name = "condition", paramType = "query", required = true)}) + @HasPermission({"stock:sc-transfer:add", "stock:sc-transfer:modify"}) + @GetMapping("/product/search") + public InvokeResult> searchProducts( + @NotBlank(message = "仓库ID不能为空!") String scId, + String condition) { + + if (StringUtil.isBlank(condition)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + PageResult pageResult = scTransferOrderService.queryScTransferByCondition( + getPageIndex(), getPageSize(), scId, condition); + List results = CollectionUtil.emptyList(); + List datas = pageResult.getDatas(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new ScTransferProductBo(scId, t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 查询商品列表 + */ + @ApiOperation("查询商品列表") + @HasPermission({"stock:sc-transfer:add", "stock:sc-transfer:modify"}) + @GetMapping("/product/list") + public InvokeResult> queryProductList( + @Valid QueryScTransferProductVo vo) { + + PageResult pageResult = scTransferOrderService.queryScTransferList( + getPageIndex(), + getPageSize(), vo); + List results = null; + List datas = pageResult.getDatas(); + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(t -> new ScTransferProductBo(vo.getScId(), t)) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"stock:sc-transfer:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateScTransferOrderVo vo) { + + vo.validate(); + + scTransferOrderService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"stock:sc-transfer:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateScTransferOrderVo vo) { + + vo.validate(); + + scTransferOrderService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"stock:sc-transfer:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "id不能为空!") String id) { + + scTransferOrderService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除 + */ + @ApiOperation("批量删除") + @HasPermission({"stock:sc-transfer:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的仓库调拨单!") List ids) { + + scTransferOrderService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过 + */ + @ApiOperation("审核通过") + @HasPermission({"stock:sc-transfer:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassScTransferOrderVo vo) { + + scTransferOrderService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过 + */ + @ApiOperation("批量审核通过") + @HasPermission({"stock:sc-transfer:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassScTransferOrderVo vo) { + + scTransferOrderService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过 + */ + @ApiOperation("直接审核通过") + @HasPermission({"stock:sc-transfer:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateScTransferOrderVo vo) { + + scTransferOrderService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝 + */ + @ApiOperation("审核拒绝") + @HasPermission({"stock:sc-transfer:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseScTransferOrderVo vo) { + + scTransferOrderService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝 + */ + @ApiOperation("批量审核拒绝") + @HasPermission({"stock:sc-transfer:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseScTransferOrderVo vo) { + + scTransferOrderService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 收货 + */ + @ApiOperation("收货") + @HasPermission({"stock:sc-transfer:receive"}) + @PatchMapping("/receive") + public InvokeResult receive(@RequestBody @Valid ReceiveScTransferOrderVo vo) { + + scTransferOrderService.receive(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 收货记录 + */ + @ApiOperation("收货记录") + @HasPermission({"stock:sc-transfer:query"}) + @GetMapping("/receive/detail") + public InvokeResult> receiveDetail( + @Valid QueryScTransferOrderDetailReceiveVo vo) { + + Wrapper queryWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetailReceive.class) + .eq(ScTransferOrderDetailReceive::getOrderId, vo.getOrderId()) + .eq(ScTransferOrderDetailReceive::getDetailId, vo.getDetailId()) + .orderByAsc(ScTransferOrderDetailReceive::getCreateTime); + + Page page = new Page<>(getPageIndex(vo), getPageSize(vo)); + Page pageInfo = scTransferOrderDetailReceiveService.page(page, + queryWrapper); + PageResult pageResult = PageResultUtil.convert(pageInfo); + List datas = pageResult.getDatas(); + List results = datas.stream() + .map(QueryScTransferOrderDetailReceiveBo::new).collect( + Collectors.toList()); + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolPurchaseOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolPurchaseOrderController.java new file mode 100644 index 0000000..39ad38e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolPurchaseOrderController.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.sc.controller.ydool; + +import com.lframework.starter.web.annotations.OpenApi; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + * 云朵里采购订单管理 + * + * @author zmj + */ +@Api(tags = "云朵里采购订单管理") +@Validated +@RestController +@RequestMapping("/ydool/purchase/order") +public class YdoolPurchaseOrderController extends DefaultBaseController { + + @Autowired + private PurchaseOrderService purchaseOrderService; + + @Autowired + private ProductService productService; + + /** + * ydool将审批结果推送过来 + */ + @ApiOperation("ydool将审批结果推送过来") + @OpenApi + @PostMapping("/approve") + public InvokeResult approve(@RequestBody @Valid YdoolApproveOrderVo vo) { + purchaseOrderService.approve(vo); + return InvokeResultBuilder.success(); + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolRetailOutSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolRetailOutSheetController.java new file mode 100644 index 0000000..392fc9a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolRetailOutSheetController.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.controller.ydool; + +import com.lframework.starter.web.annotations.OpenApi; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * 云朵里零售出库单管理 + * + * @author zmj + */ +@Api(tags = "云朵里零售出库单管理") +@Validated +@RestController +@RequestMapping("/ydool/retail/out/sheet") +public class YdoolRetailOutSheetController extends DefaultBaseController { + + @Autowired + private RetailOutSheetService retailOutSheetService; + + /** + * ydool将审批结果推送过来 + */ + @ApiOperation("ydool将审批结果推送过来") + @OpenApi + @PostMapping("/approve") + public InvokeResult approve(@RequestBody @Valid YdoolApproveOrderVo vo) { + retailOutSheetService.approve(vo); + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolSaleOrderController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolSaleOrderController.java new file mode 100644 index 0000000..52d0e84 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolSaleOrderController.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.controller.ydool; + +import com.lframework.starter.web.annotations.OpenApi; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * 云朵里销售订单管理 + * + * @author zmj + */ +@Api(tags = "云朵里销售订单管理") +@Validated +@RestController +@RequestMapping("/ydool/sale/order") +public class YdoolSaleOrderController extends DefaultBaseController { + @Autowired + private SaleOrderService saleOrderService; + + /** + * ydool将审批结果推送过来 + */ + @ApiOperation("ydool将审批结果推送过来") + @OpenApi + @PostMapping("/approve") + public InvokeResult approve(@RequestBody @Valid YdoolApproveOrderVo vo) { + saleOrderService.approve(vo); + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolStockAdjustSheetController.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolStockAdjustSheetController.java new file mode 100644 index 0000000..e317aea --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/ydool/YdoolStockAdjustSheetController.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.controller.ydool; + +import com.lframework.starter.web.annotations.OpenApi; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetService; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * 云朵里库存调整单 Controller + * + * @author zmj + */ +@Api(tags = "云朵里库存调整单") +@Validated +@RestController +@RequestMapping("/ydool/stock/adjust") +public class YdoolStockAdjustSheetController extends DefaultBaseController { + + @Autowired + private StockAdjustSheetService stockAdjustSheetService; + + /** + * ydool将审批结果推送过来 + */ + @ApiOperation("ydool将审批结果推送过来") + @OpenApi + @PostMapping("/approve") + public InvokeResult approve(@RequestBody @Valid YdoolApproveOrderVo vo) { + stockAdjustSheetService.approve(vo); + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetBizOrderDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetBizOrderDto.java new file mode 100644 index 0000000..db750fc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetBizOrderDto.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.dto.logistics; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class LogisticsSheetBizOrderDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务单据号 + */ + private String bizCode; + + /** + * 仓库ID + */ + private String scId; + + /** + * 收货人ID + */ + private String receiverId; + + /** + * 业务类型 + */ + private LogisticsSheetDetailBizType bizType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetFullDto.java new file mode 100644 index 0000000..44cc19e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/logistics/LogisticsSheetFullDto.java @@ -0,0 +1,182 @@ +package com.lframework.xingyun.sc.dto.logistics; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class LogisticsSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 物流单号 + */ + private String logisticsNo; + + /** + * 物流公司ID + */ + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + private String senderName; + + /** + * 寄件人联系电话 + */ + private String senderTelephone; + + /** + * 寄件人省 + */ + private String senderProvinceId; + + /** + * 寄件人市 + */ + private String senderCityId; + + /** + * 寄件人区 + */ + private String senderDistrictId; + + /** + * 寄件人地址 + */ + private String senderAddress; + + /** + * 收件人姓名 + */ + private String receiverName; + + /** + * 收件人联系电话 + */ + private String receiverTelephone; + + /** + * 收件人省 + */ + private String receiverProvinceId; + + /** + * 收件人市 + */ + private String receiverCityId; + + /** + * 收件人区 + */ + private String receiverDistrictId; + + /** + * 收件人地址 + */ + private String receiverAddress; + + /** + * 状态 + */ + private LogisticsSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 总重量 + */ + private BigDecimal totalWeight; + + /** + * 总体积 + */ + private BigDecimal totalVolume; + + /** + * 物流费 + */ + private BigDecimal totalAmount; + + /** + * 发货人 + */ + private String deliveryBy; + + /** + * 发货时间 + */ + private LocalDateTime deliveryTime; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 物流单ID + */ + private String sheetId; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private LogisticsSheetDetailBizType bizType; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderFullDto.java new file mode 100644 index 0000000..27a1d61 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderFullDto.java @@ -0,0 +1,164 @@ +package com.lframework.xingyun.sc.dto.purchase; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class PurchaseOrderFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 预计到货日期 + */ + private LocalDate expectArriveDate; + + /** + * 采购数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 采购金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建人ID + */ + private String createById; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private PurchaseOrderStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + + /** + * 订单明细 + */ + private List details; + + + @Data + public static class OrderDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private Integer orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率 + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderWithReceiveDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderWithReceiveDto.java new file mode 100644 index 0000000..a041cff --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseOrderWithReceiveDto.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.sc.dto.purchase; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +/** + * 采购订单在收货业务的Dto + */ +@Data +public class PurchaseOrderWithReceiveDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private Integer orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已收货数量 + */ + private Integer receiveNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseProductDto.java new file mode 100644 index 0000000..3fe2776 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/PurchaseProductDto.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.dto.purchase; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class PurchaseProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 采购价 + */ + private BigDecimal purchasePrice; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 状态 + */ + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/GetPaymentDateDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/GetPaymentDateDto.java new file mode 100644 index 0000000..4cb36f6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/GetPaymentDateDto.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.dto.purchase.receive; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.time.LocalDate; +import lombok.Data; + +@Data +public class GetPaymentDateDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 是否允许修改付款日期 + */ + private Boolean allowModify; + + /** + * 默认付款日期 + */ + private LocalDate paymentDate; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetFullDto.java new file mode 100644 index 0000000..702a781 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetFullDto.java @@ -0,0 +1,178 @@ +package com.lframework.xingyun.sc.dto.purchase.receive; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class ReceiveSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 采购订单ID + */ + private String purchaseOrderId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 到货日期 + */ + private LocalDate receiveDate; + + /** + * 采购数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 采购金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private ReceiveSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class OrderDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 收货数量 + */ + private Integer orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率 + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 采购订单明细ID + */ + private String purchaseOrderDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetWithReturnDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetWithReturnDto.java new file mode 100644 index 0000000..a73d1ef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/receive/ReceiveSheetWithReturnDto.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.sc.dto.purchase.receive; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +/** + * 采购收货单在采购退货业务的Dto + */ +@Data +public class ReceiveSheetWithReturnDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 收货数量 + */ + private Integer orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已退货数量 + */ + private Integer returnNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/returned/PurchaseReturnFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/returned/PurchaseReturnFullDto.java new file mode 100644 index 0000000..fe1d0dc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/purchase/returned/PurchaseReturnFullDto.java @@ -0,0 +1,173 @@ +package com.lframework.xingyun.sc.dto.purchase.returned; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class PurchaseReturnFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 收货单ID + */ + private String receiveSheetId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private PurchaseReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 退单明细 + */ + private List details; + + @Data + public static class ReturnDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private Integer returnNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率 + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 收货单明细ID + */ + private String receiveSheetDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/RetailProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/RetailProductDto.java new file mode 100644 index 0000000..f46b615 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/RetailProductDto.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.dto.retail; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class RetailProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 零售价 + */ + private BigDecimal retailPrice; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 状态 + */ + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetDetailLotDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetDetailLotDto.java new file mode 100644 index 0000000..aac3927 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetDetailLotDto.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.dto.retail.out; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class RetailOutSheetDetailLotDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 已退货数量 + */ + private Integer returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetFullDto.java new file mode 100644 index 0000000..b1962f4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetFullDto.java @@ -0,0 +1,193 @@ +package com.lframework.xingyun.sc.dto.retail.out; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class RetailOutSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 出库总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建人ID + */ + private String createById; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售订单明细ID + */ + private String saleOrderDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetWithReturnDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetWithReturnDto.java new file mode 100644 index 0000000..cf96f1b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/out/RetailOutSheetWithReturnDto.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.dto.retail.out; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +@Data +public class RetailOutSheetWithReturnDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已退货数量 + */ + private Integer returnNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/returned/RetailReturnFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/returned/RetailReturnFullDto.java new file mode 100644 index 0000000..c37de0d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/retail/returned/RetailReturnFullDto.java @@ -0,0 +1,188 @@ +package com.lframework.xingyun.sc.dto.retail.returned; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class RetailReturnFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 退货总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 零售出库单ID + */ + private String outSheetId; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class ReturnDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private Integer returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 零售出库单明细ID + */ + private String outSheetDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderFullDto.java new file mode 100644 index 0000000..3c1f32d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderFullDto.java @@ -0,0 +1,171 @@ +package com.lframework.xingyun.sc.dto.sale; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class SaleOrderFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 销售总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建人ID + */ + private String createById; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOrderStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class OrderDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderWithOutDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderWithOutDto.java new file mode 100644 index 0000000..71fc2b9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleOrderWithOutDto.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.sc.dto.sale; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +/** + * 销售订单在出库业务的Dto + */ +@Data +public class SaleOrderWithOutDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 销售数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已出库数量 + */ + private Integer outNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleProductDto.java new file mode 100644 index 0000000..a1b27b6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/SaleProductDto.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.dto.sale; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SaleProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 销售价 + */ + private BigDecimal salePrice; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 状态 + */ + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetDetailLotDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetDetailLotDto.java new file mode 100644 index 0000000..95b411d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetDetailLotDto.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.dto.sale.out; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SaleOutSheetDetailLotDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 已退货数量 + */ + private Integer returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetFullDto.java new file mode 100644 index 0000000..5580f24 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetFullDto.java @@ -0,0 +1,193 @@ +package com.lframework.xingyun.sc.dto.sale.out; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class SaleOutSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 出库总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 销售订单ID + */ + private String saleOrderId; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售订单明细ID + */ + private String saleOrderDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetWithReturnDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetWithReturnDto.java new file mode 100644 index 0000000..3df6549 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/out/SaleOutSheetWithReturnDto.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.dto.sale.out; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import lombok.Data; + +@Data +public class SaleOutSheetWithReturnDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已退货数量 + */ + private Integer returnNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/returned/SaleReturnFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/returned/SaleReturnFullDto.java new file mode 100644 index 0000000..fef7952 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/sale/returned/SaleReturnFullDto.java @@ -0,0 +1,188 @@ +package com.lframework.xingyun.sc.dto.sale.returned; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class SaleReturnFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 退货总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 销售出库单ID + */ + private String outSheetId; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 订单明细 + */ + private List details; + + @Data + public static class ReturnDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private Integer returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售出库单明细ID + */ + private String outSheetDetailId; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustDiffDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustDiffDto.java new file mode 100644 index 0000000..4f92c49 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustDiffDto.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.dto.stock.adjust.cost; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class StockCostAdjustDiffDto implements Serializable, BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * 库存数量 + */ + private Integer stockNum = 0; + + /** + * 原价 + */ + private BigDecimal oriPrice = BigDecimal.ZERO; + + /** + * 调整金额 + */ + private BigDecimal diffAmount = BigDecimal.ZERO; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustProductDto.java new file mode 100644 index 0000000..c39774e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustProductDto.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.dto.stock.adjust.cost; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class StockCostAdjustProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 档案采购价 + */ + private BigDecimal purchasePrice; + + /** + * 库存数量 + */ + private Integer stockNum; + + /** + * 调价前成本价 + */ + private BigDecimal oriPrice; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustSheetFullDto.java new file mode 100644 index 0000000..d905966 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustSheetFullDto.java @@ -0,0 +1,134 @@ +package com.lframework.xingyun.sc.dto.stock.adjust.cost; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +/** + *

+ * 库存成本调整单详情 Dto + *

+ * + * @author zmj + */ +@Data +public class StockCostAdjustSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 调价品种数 + */ + private Integer productNum; + + /** + * 库存调价差额 + */ + private BigDecimal diffAmount; + + /** + * 状态 + */ + private StockCostAdjustSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 档案采购价 + */ + private BigDecimal purchasePrice; + + /** + * 库存数量 + */ + private Integer stockNum; + + /** + * 调整前成本价 + */ + private BigDecimal oriPrice; + + /** + * 调整后成本价 + */ + private BigDecimal price; + + /** + * 库存调价差额 + */ + private BigDecimal diffAmount; + + /** + * 备注 + */ + private String description; + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java new file mode 100644 index 0000000..b3efb21 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.sc.dto.stock.adjust.stock; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class StockAdjustProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 当前库存数量 + */ + private Integer curStockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustSheetFullDto.java new file mode 100644 index 0000000..b16dd38 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustSheetFullDto.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.sc.dto.stock.adjust.stock; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.StockAdjustSheetBizType; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +/** + *

+ * 库存成本调整单详情 Dto + *

+ * + * @author zmj + */ +@Data +public class StockAdjustSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 业务类型 + */ + private StockAdjustSheetBizType bizType; + + /** + * 调整原因ID + */ + private String reasonId; + + /** + * 状态 + */ + private StockAdjustSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 创建人ID + */ + private String createById; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 调整库存数量 + */ + private Integer stockNum; + + /** + * 备注 + */ + private String description; + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/GetTakeStockPlanDetailProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/GetTakeStockPlanDetailProductDto.java new file mode 100644 index 0000000..5ca2ac2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/GetTakeStockPlanDetailProductDto.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.dto.stock.take.plan; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +/** + * 查询盘点任务详情中的商品信息 Dto + */ +@Data +public class GetTakeStockPlanDetailProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 详情ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 库存数量 + */ + private Integer stockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/QueryTakeStockPlanProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/QueryTakeStockPlanProductDto.java new file mode 100644 index 0000000..07836bd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/QueryTakeStockPlanProductDto.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.dto.stock.take.plan; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryTakeStockPlanProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + private String productId; + + /** + * 初始库存 + */ + private Integer stockNum; + + /** + * 出项数量 + */ + private Integer totalOutNum; + + /** + * 入项数量 + */ + private Integer totalInNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/TakeStockPlanFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/TakeStockPlanFullDto.java new file mode 100644 index 0000000..89d1a50 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/plan/TakeStockPlanFullDto.java @@ -0,0 +1,123 @@ +package com.lframework.xingyun.sc.dto.stock.take.plan; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class TakeStockPlanFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点类别 + */ + private TakeStockPlanType takeType; + + /** + * 备注 + */ + private String description; + + /** + * 盘点状态 + */ + private TakeStockPlanStatus takeStatus; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 库存数量 + */ + private Integer stockNum; + + /** + * 盘点数量 + */ + private Integer oriTakeNum; + + /** + * 修改后的盘点数量 + */ + private Integer takeNum; + + /** + * 出项数量 + */ + private Integer totalOutNum; + + /** + * 进项数量 + */ + private Integer totalInNum; + + /** + * 成本价 + */ + private BigDecimal taxPrice; + + /** + * 备注 + */ + private String description; + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockProductDto.java new file mode 100644 index 0000000..577264a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockProductDto.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.sc.dto.stock.take.pre; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class PreTakeStockProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockSheetFullDto.java new file mode 100644 index 0000000..70ce79c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/PreTakeStockSheetFullDto.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.sc.dto.stock.take.pre; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +/** + *

+ * 预先盘点单 Dto + *

+ * + * @author zmj + */ +@Data +public class PreTakeStockSheetFullDto implements BaseDto, Serializable { + + public static final String CACHE_NAME = "PreTakeStockSheetFullDto"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点状态 + */ + private PreTakeStockSheetStatus takeStatus; + + /** + * 备注 + */ + private String description; + + /** + * 操作人ID + */ + private String updateBy; + + /** + * 操作时间 + */ + private LocalDateTime updateTime; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 初盘数量 + */ + private Integer firstNum; + + /** + * 复盘数量 + */ + private Integer secondNum; + + /** + * 抽盘数量 + */ + private Integer randNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/QueryPreTakeStockSheetProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/QueryPreTakeStockSheetProductDto.java new file mode 100644 index 0000000..84e82ef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/pre/QueryPreTakeStockSheetProductDto.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.dto.stock.take.pre; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryPreTakeStockSheetProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + private String productId; + + /** + * 初盘数量 + */ + private Integer firstNum; + + /** + * 复盘数量 + */ + private Integer secondNum; + + /** + * 抽盘数量 + */ + private Integer randNum; + + /** + * 预先盘点单状态 + */ + private PreTakeStockSheetStatus takeStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetFullDto.java new file mode 100644 index 0000000..b13f197 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetFullDto.java @@ -0,0 +1,123 @@ +package com.lframework.xingyun.sc.dto.stock.take.sheet; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +/** + *

+ * 盘点单详情 Dto + *

+ * + * @author zmj + */ +@Data +public class TakeStockSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 盘点任务ID + */ + private String planId; + + /** + * 预先盘点单ID + */ + private String preSheetId; + + /** + * 仓库ID + */ + private String scId; + + /** + * 状态 + */ + private TakeStockSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 拒绝理由 + */ + private String refuseReason; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 明细 + */ + private List details; + + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 盘点数量 + */ + private Integer takeNum; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetProductDto.java new file mode 100644 index 0000000..b154ad6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/take/sheet/TakeStockSheetProductDto.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.sc.dto.stock.take.sheet; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class TakeStockSheetProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferOrderFullDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferOrderFullDto.java new file mode 100644 index 0000000..877783b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferOrderFullDto.java @@ -0,0 +1,124 @@ +package com.lframework.xingyun.sc.dto.stock.transfer; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +/** + *

+ * 仓库调拨单详情 Dto + *

+ * + * @author zmj + */ +@Data +public class ScTransferOrderFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 转出仓库ID + */ + private String sourceScId; + + /** + * 转入仓库ID + */ + private String targetScId; + + /** + * 调拨数量 + */ + private Integer totalNum; + + /** + * 调拨成本金额 + */ + private BigDecimal totalAmount; + + /** + * 状态 + */ + private ScTransferOrderStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class DetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 商品ID + */ + private String productId; + + /** + * 调拨数量 + */ + private Integer transferNum; + + /** + * 已收货数量 + */ + private Integer receiveNum; + + /** + * 备注 + */ + private String description; + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferProductDto.java new file mode 100644 index 0000000..f9d36ec --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/transfer/ScTransferProductDto.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.sc.dto.stock.transfer; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class ScTransferProductDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类目ID + */ + private String categoryId; + + /** + * 类目名称 + */ + private String categoryName; + + /** + * 品牌ID + */ + private String brandId; + + /** + * 品牌名称 + */ + private String brandName; + + /** + * SKU + */ + private String skuCode; + + /** + * 外部编号 + */ + private String externalCode; + + /** + * 规格 + */ + private String spec; + + /** + * 单位 + */ + private String unit; + + /** + * 当前库存数量 + */ + private Integer curStockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheet.java new file mode 100644 index 0000000..8749af1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheet.java @@ -0,0 +1,178 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 物流单 + *

+ * + * @author zmj + * @since 2023-06-13 + */ +@Data +@TableName("tbl_logistics_sheet") +public class LogisticsSheet extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "LogisticsSheet"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 物流单号 + */ + private String logisticsNo; + + /** + * 物流公司ID + */ + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + private String senderName; + + /** + * 寄件人联系电话 + */ + private String senderTelephone; + + /** + * 寄件人省 + */ + private String senderProvinceId; + + /** + * 寄件人市 + */ + private String senderCityId; + + /** + * 寄件人区 + */ + private String senderDistrictId; + + /** + * 寄件人地址 + */ + private String senderAddress; + + /** + * 收件人姓名 + */ + private String receiverName; + + /** + * 收件人联系电话 + */ + private String receiverTelephone; + + /** + * 收件人省 + */ + private String receiverProvinceId; + + /** + * 收件人市 + */ + private String receiverCityId; + + /** + * 收件人区 + */ + private String receiverDistrictId; + + /** + * 收件人地址 + */ + private String receiverAddress; + + /** + * 总重量 + */ + private BigDecimal totalWeight; + + /** + * 总体积 + */ + private BigDecimal totalVolume; + + /** + * 物流费 + */ + private BigDecimal totalAmount; + + /** + * 状态 + */ + private LogisticsSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 发货人 + */ + private String deliveryBy; + + /** + * 发货时间 + */ + private LocalDateTime deliveryTime; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheetDetail.java new file mode 100644 index 0000000..7071ac3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/LogisticsSheetDetail.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import lombok.Data; + +/** + *

+ * 物流单 + *

+ * + * @author zmj + * @since 2023-06-13 + */ +@Data +@TableName("tbl_logistics_sheet_detail") +public class LogisticsSheetDetail extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "LogisticsSheetDetail"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 物流单ID + */ + private String sheetId; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private LogisticsSheetDetailBizType bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/OrderPayType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/OrderPayType.java new file mode 100644 index 0000000..f87626f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/OrderPayType.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-03-28 + */ +@Data +@TableName("tbl_order_pay_type") +public class OrderPayType extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "OrderPayType"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 订单ID + */ + private String orderId; + + /** + * 支付方式ID + */ + private String payTypeId; + + /** + * 支付金额 + */ + private BigDecimal payAmount; + + /** + * 支付内容 + */ + private String text; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheet.java new file mode 100644 index 0000000..c4c506c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheet.java @@ -0,0 +1,86 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 预先盘点单 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_pre_take_stock_sheet") +public class PreTakeStockSheet extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PreTakeStockSheet"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点状态 + */ + private PreTakeStockSheetStatus takeStatus; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheetDetail.java new file mode 100644 index 0000000..687d84f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PreTakeStockSheetDetail.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * 预先盘点单详情 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_pre_take_stock_sheet_detail") +public class PreTakeStockSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 预先盘点单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 初盘数量 + */ + private Integer firstNum; + + /** + * 复盘数量 + */ + private Integer secondNum; + + /** + * 抽盘数量 + */ + private Integer randNum; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStock.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStock.java new file mode 100644 index 0000000..f9090fe --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStock.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_product_stock") +public class ProductStock extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 商品ID + */ + private String productId; + + /** + * 库存数量 + */ + private Integer stockNum; + + /** + * 含税价格 + */ + private BigDecimal taxPrice; + + /** + * 含税金额 + */ + private BigDecimal taxAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockLog.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockLog.java new file mode 100644 index 0000000..a85f046 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ProductStockLog.java @@ -0,0 +1,111 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-14 + */ +@Data +@TableName("tbl_product_stock_log") +public class ProductStockLog extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 仓库ID + */ + private String scId; + + /** + * 商品ID + */ + private String productId; + + /** + * 原库存数量 + */ + private Integer oriStockNum; + + /** + * 现库存数量 + */ + private Integer curStockNum; + + /** + * 原含税成本价 + */ + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + private BigDecimal curTaxPrice; + + /** + * 变动库存数量 + */ + private Integer stockNum; + + /** + * 变动含税金额 + */ + private BigDecimal taxAmount; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + private String bizId; + + /** + * 业务单据号 + */ + private String bizCode; + + /** + * 业务单据明细ID + */ + private String bizDetailId; + + /** + * 业务类型 + */ + private ProductStockBizType bizType; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseConfig.java new file mode 100644 index 0000000..9e0ee93 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseConfig.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_config") +public class PurchaseConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "PurchaseConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 采购收货单是否关联采购订单 + */ + private Boolean receiveRequirePurchase; + + /** + * 采购收货单是否多次关联采购订单 + */ + private Boolean receiveMultipleRelatePurchase; + + /** + * 采购退货单是否关联采购收货单 + */ + private Boolean purchaseReturnRequireReceive; + + /** + * 采购退货单是否多次关联采购收货单 + */ + private Boolean purchaseReturnMultipleRelateReceive; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrder.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrder.java new file mode 100644 index 0000000..4a26855 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrder.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_order") +public class PurchaseOrder extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 预计到货日期 + */ + private LocalDate expectArriveDate; + + /** + * 采购数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 采购金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private PurchaseOrderStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetail.java new file mode 100644 index 0000000..0155721 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseOrderDetail.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_purchase_order_detail") +public class PurchaseOrderDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 订单ID + */ + private String orderId; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private Integer orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已收货数量 + */ + private Integer receiveNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturn.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturn.java new file mode 100644 index 0000000..f0086cf --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturn.java @@ -0,0 +1,146 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-16 + */ +@Data +@TableName("tbl_purchase_return") +public class PurchaseReturn extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 收货单ID + */ + private String receiveSheetId; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private PurchaseReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturnDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturnDetail.java new file mode 100644 index 0000000..c76d8f6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/PurchaseReturnDetail.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-16 + */ +@Data +@TableName("tbl_purchase_return_detail") +public class PurchaseReturnDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 收货单ID + */ + private String returnId; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private Integer returnNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 收货单明细ID + */ + private String receiveSheetDetailId; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheet.java new file mode 100644 index 0000000..5b2012f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheet.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-09 + */ +@Data +@TableName("tbl_receive_sheet") +public class ReceiveSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 采购员ID + */ + private String purchaserId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 到货日期 + */ + private LocalDate receiveDate; + + /** + * 采购单ID + */ + private String purchaseOrderId; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 收货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private ReceiveSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetail.java new file mode 100644 index 0000000..21c4c55 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ReceiveSheetDetail.java @@ -0,0 +1,79 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-09 + */ +@Data +@TableName("tbl_receive_sheet_detail") +public class ReceiveSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 收货单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 采购数量 + */ + private Integer orderNum; + + /** + * 采购价 + */ + private BigDecimal taxPrice; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 采购订单明细ID + */ + private String purchaseOrderDetailId; + + /** + * 已退货数量 + */ + private Integer returnNum; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailConfig.java new file mode 100644 index 0000000..fb25457 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailConfig.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_retail_config") +public class RetailConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "RetailConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 零售出库单上的会员是否必填 + */ + private Boolean retailOutSheetRequireMember; + + /** + * 零售退货单是否关联零售出库单 + */ + private Boolean retailReturnRequireOutStock; + + /** + * 零售退货单是否多次关联零售出库单 + */ + private Boolean retailReturnMultipleRelateOutStock; + + /** + * 零售退货单上的会员是否必填 + */ + private Boolean retailReturnRequireMember; + + /** + * 零售出库单是否需要发货 + */ + private Boolean retailOutSheetRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheet.java new file mode 100644 index 0000000..25aac1f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheet.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_retail_out_sheet") +public class RetailOutSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 出库金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetail.java new file mode 100644 index 0000000..54eabcd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetail.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_retail_out_sheet_detail") +public class RetailOutSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 已退货数量 + */ + private Integer returnNum; + + /** + * 组合商品原始明细ID + */ + private String oriBundleDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailBundle.java new file mode 100644 index 0000000..2182b2a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailBundle.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-05-26 + */ +@Data +@TableName("tbl_retail_out_sheet_detail_bundle") +public class RetailOutSheetDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "RetailOutSheetDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private Integer orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private Integer productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailLot.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailLot.java new file mode 100644 index 0000000..1f4c535 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailOutSheetDetailLot.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-03 + */ +@Data +@TableName("tbl_retail_out_sheet_detail_lot") +public class RetailOutSheetDetailLot extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 已退货数量 + */ + private Integer returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturn.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturn.java new file mode 100644 index 0000000..14a18d9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturn.java @@ -0,0 +1,146 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_retail_return") +public class RetailReturn extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 会员ID + */ + private String memberId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 出库单ID + */ + private String outSheetId; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private RetailReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturnDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturnDetail.java new file mode 100644 index 0000000..c3e875d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/RetailReturnDetail.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_retail_return_detail") +public class RetailReturnDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 退货单ID + */ + private String returnId; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private Integer returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 出库单明细ID + */ + private String outSheetDetailId; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleConfig.java new file mode 100644 index 0000000..cd62683 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleConfig.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-09-12 + */ +@Data +@TableName("tbl_sale_config") +public class SaleConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SaleConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 销售出库单是否关联销售订单 + */ + private Boolean outStockRequireSale; + + /** + * 销售出库单是否多次关联销售订单 + */ + private Boolean outStockMultipleRelateSale; + + /** + * 销售退货单是否关联销售出库单 + */ + private Boolean saleReturnRequireOutStock; + + /** + * 销售退货单是否多次关联销售出库单 + */ + private Boolean saleReturnMultipleRelateOutStock; + + /** + * 销售出库单是否需要物流单 + */ + private Boolean outStockRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrder.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrder.java new file mode 100644 index 0000000..2e0a232 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrder.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-21 + */ +@Data +@TableName("tbl_sale_order") +public class SaleOrder extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 销售数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 销售金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOrderStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetail.java new file mode 100644 index 0000000..84209fe --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetail.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-21 + */ +@Data +@TableName("tbl_sale_order_detail") +public class SaleOrderDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 订单ID + */ + private String orderId; + + /** + * 商品ID + */ + private String productId; + + /** + * 销售数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 已出库数量 + */ + private Integer outNum; + + /** + * 组合商品原始明细ID + */ + private String oriBundleDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetailBundle.java new file mode 100644 index 0000000..7fe1f7f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOrderDetailBundle.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-05-26 + */ +@Data +@TableName("tbl_sale_order_detail_bundle") +public class SaleOrderDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SaleOrderDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 销售单ID + */ + private String orderId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private Integer orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private Integer productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheet.java new file mode 100644 index 0000000..7d8c73c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheet.java @@ -0,0 +1,144 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_sale_out_sheet") +public class SaleOutSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 销售单ID + */ + private String saleOrderId; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 出库金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleOutSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetail.java new file mode 100644 index 0000000..4cd348e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetail.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-10-26 + */ +@Data +@TableName("tbl_sale_out_sheet_detail") +public class SaleOutSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 销售订单明细ID + */ + private String saleOrderDetailId; + + /** + * 已退货数量 + */ + private Integer returnNum; + + /** + * 组合商品原始明细ID + */ + private String oriBundleDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailBundle.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailBundle.java new file mode 100644 index 0000000..ffd3da3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailBundle.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2023-05-26 + */ +@Data +@TableName("tbl_sale_out_sheet_detail_bundle") +public class SaleOutSheetDetailBundle extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SaleOutSheetDetailBundle"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 出库单ID + */ + private String sheetId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 组合商品ID + */ + private String mainProductId; + + /** + * 组合商品数量 + */ + private Integer orderNum; + + /** + * 单品ID + */ + private String productId; + + /** + * 单品数量 + */ + private Integer productOrderNum; + + /** + * 单品原价 + */ + private BigDecimal productOriPrice; + + /** + * 单品含税价格 + */ + private BigDecimal productTaxPrice; + + /** + * 单品税率 + */ + private BigDecimal productTaxRate; + + /** + * 单品明细ID + */ + private String productDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailLot.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailLot.java new file mode 100644 index 0000000..98428aa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleOutSheetDetailLot.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-03 + */ +@Data +@TableName("tbl_sale_out_sheet_detail_lot") +public class SaleOutSheetDetailLot extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 明细ID + */ + private String detailId; + + /** + * 出库数量 + */ + private Integer orderNum; + + /** + * 已退货数量 + */ + private Integer returnNum; + + /** + * 含税成本金额 + */ + private BigDecimal costTaxAmount; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturn.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturn.java new file mode 100644 index 0000000..a6024e9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturn.java @@ -0,0 +1,146 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_sale_return") +public class SaleReturn extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 销售员ID + */ + private String salerId; + + /** + * 付款日期 + */ + private LocalDate paymentDate; + + /** + * 出库单ID + */ + private String outSheetId; + + /** + * 商品数量 + */ + private Integer totalNum; + + /** + * 赠品数量 + */ + private Integer totalGiftNum; + + /** + * 退货金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SaleReturnStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturnDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturnDetail.java new file mode 100644 index 0000000..733aac4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/SaleReturnDetail.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.SettleStatus; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-04 + */ +@Data +@TableName("tbl_sale_return_detail") +public class SaleReturnDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 退货单ID + */ + private String returnId; + + /** + * 商品ID + */ + private String productId; + + /** + * 退货数量 + */ + private Integer returnNum; + + /** + * 原价 + */ + private BigDecimal oriPrice; + + /** + * 现价 + */ + private BigDecimal taxPrice; + + /** + * 折扣率(%) + */ + private BigDecimal discountRate; + + /** + * 是否赠品 + */ + private Boolean isGift; + + /** + * 税率(%) + */ + private BigDecimal taxRate; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 出库单明细ID + */ + private String outSheetDetailId; + + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrder.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrder.java new file mode 100644 index 0000000..3f05317 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrder.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 仓库调拨单 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_sc_transfer_order") +public class ScTransferOrder extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 转出仓库ID + */ + private String sourceScId; + + /** + * 转入仓库ID + */ + private String targetScId; + + /** + * 调拨数量 + */ + private Integer totalNum; + + /** + * 调拨成本金额 + */ + private BigDecimal totalAmount; + + /** + * 状态 + */ + private ScTransferOrderStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetail.java new file mode 100644 index 0000000..fb162fa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetail.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * 仓库调拨单明细 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_sc_transfer_order_detail") +public class ScTransferOrderDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 调拨单ID + */ + private String orderId; + + /** + * 商品ID + */ + private String productId; + + /** + * 调拨数量 + */ + private Integer transferNum; + + /** + * 成本价 + */ + private BigDecimal taxPrice; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + + /** + * 已收货数量 + */ + private Integer receiveNum; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetailReceive.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetailReceive.java new file mode 100644 index 0000000..5b27dc3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/ScTransferOrderDetailReceive.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 仓库调拨单收货明细 + *

+ * + * @author zmj + * @since 2023-05-24 + */ +@Data +@TableName("tbl_sc_transfer_order_detail_receive") +public class ScTransferOrderDetailReceive extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 调拨单ID + */ + private String orderId; + + /** + * 明细ID + */ + private String detailId; + + /** + * 收货数量 + */ + private Integer receiveNum; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustReason.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustReason.java new file mode 100644 index 0000000..be0aa61 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustReason.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 库存调整原因 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_stock_adjust_reason") +public class StockAdjustReason extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "StockAdjustReason"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheet.java new file mode 100644 index 0000000..0b894e8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheet.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.StockAdjustSheetBizType; +import com.lframework.xingyun.sc.enums.StockAdjustSheetStatus; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 库存调整单 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_stock_adjust_sheet") +public class StockAdjustSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 业务类型 + */ + private StockAdjustSheetBizType bizType; + + /** + * 调整原因ID + */ + private String reasonId; + + /** + * 状态 + */ + private StockAdjustSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheetDetail.java new file mode 100644 index 0000000..c0b6b54 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockAdjustSheetDetail.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * 库存调整单明细 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +@Data +@TableName("tbl_stock_adjust_sheet_detail") +public class StockAdjustSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单据ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 调整库存数量 + */ + private Integer stockNum; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockCostAdjustSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockCostAdjustSheet.java new file mode 100644 index 0000000..9fbd41c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockCostAdjustSheet.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 库存成本调整单 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_stock_cost_adjust_sheet") +public class StockCostAdjustSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 调价品种数 + */ + private Integer productNum; + + /** + * 库存调价差额 + */ + private BigDecimal diffAmount; + + /** + * 状态 + */ + private StockCostAdjustSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝原因 + */ + private String refuseReason; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockCostAdjustSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockCostAdjustSheetDetail.java new file mode 100644 index 0000000..ef3da73 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/StockCostAdjustSheetDetail.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * 库存成本调整单明细 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_stock_cost_adjust_sheet_detail") +public class StockCostAdjustSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单据ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 库存数量 + */ + private Integer stockNum; + + /** + * 档案采购价 + */ + private BigDecimal purchasePrice; + + /** + * 调整前成本价 + */ + private BigDecimal oriPrice; + + /** + * 调整后成本价 + */ + private BigDecimal price; + + /** + * 库存调价差额 + */ + private BigDecimal diffAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockConfig.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockConfig.java new file mode 100644 index 0000000..e5d63c4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockConfig.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * 盘点参数 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_config") +public class TakeStockConfig extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "TakeStockConfig"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据 + */ + private Boolean showProduct; + + /** + * 库存盘点单是否显示盘点任务创建时商品的系统库存数量 + */ + private Boolean showStock; + + /** + * 盘点差异生成时是否自动调整盘点任务中商品的系统库存数量 + */ + private Boolean autoChangeStock; + + /** + * 盘点差异单中的盘点数量是否允许手动修改 + */ + private Boolean allowChangeNum; + + /** + * 盘点任务创建后多少小时内未完成,则自动作废 + */ + private Integer cancelHours; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlan.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlan.java new file mode 100644 index 0000000..e798491 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlan.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 盘点任务 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_plan") +public class TakeStockPlan extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "TakeStockPlan"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 仓库ID + */ + private String scId; + + /** + * 盘点类别 + */ + private TakeStockPlanType takeType; + + /** + * 业务ID + */ + private String bizId; + + /** + * 盘点状态 + */ + private TakeStockPlanStatus takeStatus; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlanDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlanDetail.java new file mode 100644 index 0000000..19c9864 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockPlanDetail.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * 盘点任务详情 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_plan_detail") +public class TakeStockPlanDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 盘点任务ID + */ + private String planId; + + /** + * 商品ID + */ + private String productId; + + /** + * 初始库存数量 + */ + private Integer stockNum; + + /** + * 盘点数量 + */ + private Integer oriTakeNum; + + /** + * 修改后的盘点数量 + */ + private Integer takeNum; + + /** + * 出项数量 + */ + private Integer totalOutNum; + + /** + * 入项数量 + */ + private Integer totalInNum; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheet.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheet.java new file mode 100644 index 0000000..afb34ef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheet.java @@ -0,0 +1,111 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 盘点单 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_sheet") +public class TakeStockSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 业务单据号 + */ + private String code; + + /** + * 盘点任务ID + */ + private String planId; + + /** + * 预先盘点单ID + */ + private String preSheetId; + + /** + * 仓库ID + */ + private String scId; + + /** + * 状态 + */ + private TakeStockSheetStatus status; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 拒绝理由 + */ + private String refuseReason; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheetDetail.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheetDetail.java new file mode 100644 index 0000000..0fa12c4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/entity/TakeStockSheetDetail.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.sc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * 盘点单详情 + *

+ * + * @author zmj + */ +@Data +@TableName("tbl_take_stock_sheet_detail") +public class TakeStockSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 盘点单ID + */ + private String sheetId; + + /** + * 商品ID + */ + private String productId; + + /** + * 盘点数量 + */ + private Integer takeNum; + + /** + * 备注 + */ + private String description; + + /** + * 排序 + */ + private Integer orderNo; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetDetailBizType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetDetailBizType.java new file mode 100644 index 0000000..d7398c4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetDetailBizType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum LogisticsSheetDetailBizType implements BaseEnum { + SALE_OUT_SHEET(1, "销售出库单"), RETAIL_OUT_SHEET(2, "零售出库单"); + + @EnumValue + private final Integer code; + + private final String desc; + + LogisticsSheetDetailBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetStatus.java new file mode 100644 index 0000000..bee571e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/LogisticsSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum LogisticsSheetStatus implements BaseEnum { + CREATED(0, "待发货"), DELIVERY(3, "已发货"); + + @EnumValue + private final Integer code; + + private final String desc; + + LogisticsSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/OrderAddressOrderType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/OrderAddressOrderType.java new file mode 100644 index 0000000..30e743a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/OrderAddressOrderType.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum OrderAddressOrderType implements BaseEnum { + PURCHASE_ORDER(0, "采购订单"), RECEIVE_SHEET(1, "采购收货单"), PURCHASE_RETURN(2, "采购退单"), + SALE_ORDER(3, "采购订单"), OUT_SHEET(4, "销售出库单"), SALE_RETURN(5, "销售退单"), + RETAIL_OUT_SHEET(6, "零售出库单"), RETAIL_RETURN(7, "销售退单"); + + @EnumValue + private final Integer code; + + private final String desc; + + OrderAddressOrderType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PreTakeStockSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PreTakeStockSheetStatus.java new file mode 100644 index 0000000..83f68a5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PreTakeStockSheetStatus.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum PreTakeStockSheetStatus implements BaseEnum { + FIRST_TAKE(0, "初盘"), SECOND_TAKE(1, "复盘"), RAND_TAKE(2, "抽盘"), + ; + + @EnumValue + private final Integer code; + + private final String desc; + + PreTakeStockSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ProductStockBizType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ProductStockBizType.java new file mode 100644 index 0000000..ee9debc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ProductStockBizType.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum ProductStockBizType implements BaseEnum { + PURCHASE(1, "采购入库"), PURCHASE_RETURN(2, "采购退货出库"), SALE(3, "销售出库"), SALE_RETURN(4, + "销售退货入库"), RETAIL(5, + "零售出库"), RETAIL_RETURN(6, "零售退货入库"), TAKE_STOCK_IN(7, "盘点入库"), TAKE_STOCK_OUT(8, + "盘点出库"), STOCK_COST_ADJUST( + 9, "库存成本调整"), STOCK_ADJUST(10, "库存调整"), SC_TRANSFER(11, "仓库调拨"); + + @EnumValue + private final Integer code; + + private final String desc; + + ProductStockBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOrderStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOrderStatus.java new file mode 100644 index 0000000..840b38e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseOrderStatus.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum PurchaseOrderStatus implements BaseEnum { + CREATED(0, "待审核"), + APPROVE_ING(1, "审核中"), + APPROVE_PASS(3, "审核通过"), + APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + PurchaseOrderStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseReturnStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseReturnStatus.java new file mode 100644 index 0000000..dcf6846 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/PurchaseReturnStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum PurchaseReturnStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + PurchaseReturnStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ReceiveSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ReceiveSheetStatus.java new file mode 100644 index 0000000..8719d76 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ReceiveSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum ReceiveSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + ReceiveSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOutSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOutSheetStatus.java new file mode 100644 index 0000000..63177c2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailOutSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum RetailOutSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"), APPROVE_ING(1, "审核中"); + + @EnumValue + private Integer code; + + private String desc; + + RetailOutSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailReturnStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailReturnStatus.java new file mode 100644 index 0000000..b46a453 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/RetailReturnStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum RetailReturnStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + RetailReturnStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOrderStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOrderStatus.java new file mode 100644 index 0000000..0a776ed --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOrderStatus.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SaleOrderStatus implements BaseEnum { + CREATED(0, "待审核"), + APPROVE_ING(1, "审核中"), + APPROVE_PASS(3, "审核通过"), + APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + SaleOrderStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOutSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOutSheetStatus.java new file mode 100644 index 0000000..794a8b3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleOutSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SaleOutSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + SaleOutSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleReturnStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleReturnStatus.java new file mode 100644 index 0000000..ce8d1c0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SaleReturnStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SaleReturnStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + SaleReturnStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScOpLogType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScOpLogType.java new file mode 100644 index 0000000..d755598 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScOpLogType.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.sc.enums; + +public interface ScOpLogType { + + // 物流单管理 + int LOGISTICS = 2000; + + // 采购业务 + int PURCHASE = 2001; + + // 零售业务 + int RETAIL = 2002; + + // 销售业务 + int SALE = 2003; + + // 库存调整 + int STOCK_ADJUST = 2004; + + // 仓库调拨 + int SC_TRANSFER = 2005; + + // 库存盘点 + int TAKE_STOCK = 2006; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOrderStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOrderStatus.java new file mode 100644 index 0000000..ca573d5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/ScTransferOrderStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum ScTransferOrderStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"), PART_RECEIVED(9, "部分收货"), RECEIVED(12, "已收货"); + + @EnumValue + private Integer code; + + private String desc; + + ScTransferOrderStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SettleStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SettleStatus.java new file mode 100644 index 0000000..cd6ce64 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/SettleStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleStatus implements BaseEnum { + UN_SETTLE(0, "未结算"), PART_SETTLE(1, "结算中"), SETTLED(3, "已结算"), UN_REQUIRE(6, "无需结算"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetBizType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetBizType.java new file mode 100644 index 0000000..20f2ba0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetBizType.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum StockAdjustSheetBizType implements BaseEnum { + IN(0, "入库"), OUT(2, "出库"); + + @EnumValue + private Integer code; + + private String desc; + + StockAdjustSheetBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } + + /** + * 根据code返回desc + */ + public static String descByCode(Integer code) { + + for (StockAdjustSheetBizType item : StockAdjustSheetBizType.values()) { + if (item.getCode().equals(code)) { + return item.getDesc(); + } + } + + return null; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetStatus.java new file mode 100644 index 0000000..e7c7cc0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockAdjustSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum StockAdjustSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"), APPROVE_ING(1, "审核中"); + + @EnumValue + private Integer code; + + private String desc; + + StockAdjustSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockCostAdjustSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockCostAdjustSheetStatus.java new file mode 100644 index 0000000..d65c1d0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/StockCostAdjustSheetStatus.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum StockCostAdjustSheetStatus implements BaseEnum { + CREATED(0, "待审核"), + APPROVE_ING(1, "审核中"), + APPROVE_PASS(3, "审核通过"), + APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private Integer code; + + private String desc; + + StockCostAdjustSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanStatus.java new file mode 100644 index 0000000..9a0edd8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum TakeStockPlanStatus implements BaseEnum { + CREATED(0, "盘点任务生成"), DIFF_CREATED(6, "盘点差异生成"), FINISHED(9, "盘点完成"), CANCELED(12, "盘点已作废"); + + @EnumValue + private final Integer code; + + private final String desc; + + TakeStockPlanStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanType.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanType.java new file mode 100644 index 0000000..480cfd4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockPlanType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum TakeStockPlanType implements BaseEnum { + ALL(0, "全场盘点"), SIMPLE(1, "单品盘点"), CATEGORY(2, "类目盘点"), BRAND(3, "品牌盘点"); + + @EnumValue + private final Integer code; + + private final String desc; + + TakeStockPlanType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockSheetStatus.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockSheetStatus.java new file mode 100644 index 0000000..7b962ad --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/enums/TakeStockSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum TakeStockSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + TakeStockSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportListener.java new file mode 100644 index 0000000..565fd0d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportListener.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.vo.logistics.DeliveryLogisticsSheetVo; +import java.math.BigDecimal; +import java.util.List; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class LogisticsSheetDeliveryImportListener extends + ExcelImportListener { + + @Override + protected void doInvoke(LogisticsSheetDeliveryImportModel data, AnalysisContext context) { + + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不能为空"); + } + + LogisticsSheetService logisticsSheetService = ApplicationUtil.getBean( + LogisticsSheetService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(LogisticsSheet.class) + .eq(LogisticsSheet::getCode, data.getCode()); + LogisticsSheet sheet = logisticsSheetService.getOne(queryWrapper); + if (sheet == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不存在"); + } + data.setId(sheet.getId()); + + if (data.getTotalAmount() != null) { + if (NumberUtil.lt(data.getTotalAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”最多允许2位小数"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + LogisticsSheetService logisticsSheetService = ApplicationUtil.getBean( + LogisticsSheetService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + LogisticsSheetDeliveryImportModel data = datas.get(i); + + DeliveryLogisticsSheetVo deliveryLogisticsSheetVo = new DeliveryLogisticsSheetVo(); + deliveryLogisticsSheetVo.setId(data.getId()); + deliveryLogisticsSheetVo.setLogisticsNo(data.getLogisticsNo()); + deliveryLogisticsSheetVo.setTotalAmount(data.getTotalAmount()); + + try { + logisticsSheetService.delivery(deliveryLogisticsSheetVo); + } catch (Exception e) { + throw new DefaultClientException( + "第" + (i + 1) + "行发货失败,失败原因:" + e.getMessage()); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportModel.java new file mode 100644 index 0000000..366ae8a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetDeliveryImportModel.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class LogisticsSheetDeliveryImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 单据号 + */ + @ExcelRequired + @ExcelProperty("单据号") + private String code; + + /** + * 物流单号 + */ + @ExcelProperty("物流单号") + private String logisticsNo; + + /** + * 物流费 + */ + @ExcelProperty("物流费(元)") + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportModel.java new file mode 100644 index 0000000..0b5f27e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetExportModel.java @@ -0,0 +1,211 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class LogisticsSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("单号") + private String code; + + /** + * 物流单号 + */ + @ExcelProperty("物流单号") + private String logisticsNo; + + /** + * 物流公司 + */ + @ExcelProperty("物流公司") + private String logisticsCompanyName; + + /** + * 寄件人姓名 + */ + @ExcelProperty("寄件人姓名") + private String senderName; + + /** + * 寄件人联系电话 + */ + @ExcelProperty("寄件人联系电话") + private String senderTelephone; + + /** + * 寄件人省 + */ + @ExcelProperty("寄件人省") + private String senderProvinceName; + + /** + * 寄件人市 + */ + @ExcelProperty("寄件人市") + private String senderCityName; + + /** + * 寄件人区 + */ + @ExcelProperty("寄件人区") + private String senderDistrictName; + + /** + * 寄件人地址 + */ + @ExcelProperty("寄件人地址") + private String senderAddress; + + /** + * 收件人姓名 + */ + @ExcelProperty("收件人姓名") + private String receiverName; + + /** + * 收件人联系电话 + */ + @ExcelProperty("收件人联系电话") + private String receiverTelephone; + + /** + * 收件人省 + */ + @ExcelProperty("收件人省") + private String receiverProvinceName; + + /** + * 收件人市 + */ + @ExcelProperty("收件人市") + private String receiverCityName; + + /** + * 收件人区 + */ + @ExcelProperty("收件人区") + private String receiverDistrictName; + + /** + * 收件人地址 + */ + @ExcelProperty("收件人地址") + private String receiverAddress; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 总重量 + */ + @ExcelProperty("总重量(kg)") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @ExcelProperty("总体积(cm³)") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @ExcelProperty("物流费(元)") + private BigDecimal totalAmount; + + /** + * 创建人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 创建时间 + */ + @ExcelProperty("操作时间") + private Date createTime; + + /** + * 发货人 + */ + @ExcelProperty("发货人") + private String deliveryBy; + + /** + * 发货时间 + */ + @ExcelProperty("发货时间") + private Date deliveryTime; + + public LogisticsSheetExportModel() { + + } + + public LogisticsSheetExportModel(LogisticsSheet dto) { + + super(dto); + } + + @Override + protected void afterInit(LogisticsSheet dto) { + + LogisticsCompanyService logisticsCompanyService = ApplicationUtil.getBean( + LogisticsCompanyService.class); + LogisticsCompany logisticsCompany = logisticsCompanyService.findById( + dto.getLogisticsCompanyId()); + this.logisticsCompanyName = logisticsCompany.getName(); + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + DicCityDto senderProvince = dicCityService.findById(dto.getSenderProvinceId()); + this.senderProvinceName = senderProvince.getName(); + + DicCityDto senderCity = dicCityService.findById(dto.getSenderCityId()); + this.senderCityName = senderCity.getName(); + + DicCityDto senderDistrict = dicCityService.findById(dto.getSenderDistrictId()); + this.senderDistrictName = senderDistrict.getName(); + + DicCityDto receiverProvince = dicCityService.findById(dto.getReceiverProvinceId()); + this.receiverProvinceName = receiverProvince.getName(); + + DicCityDto receiverCity = dicCityService.findById(dto.getReceiverCityId()); + this.receiverCityName = receiverCity.getName(); + + DicCityDto receiverDistrict = dicCityService.findById(dto.getReceiverDistrictId()); + this.receiverDistrictName = receiverDistrict.getName(); + + this.status = dto.getStatus().getDesc(); + + if (StringUtil.isNotBlank(dto.getDeliveryBy())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto deliveryBy = userService.findById(dto.getDeliveryBy()); + this.deliveryBy = deliveryBy.getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportListener.java new file mode 100644 index 0000000..5ef88e7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportListener.java @@ -0,0 +1,336 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.xingyun.basedata.entity.LogisticsCompany; +import com.lframework.xingyun.basedata.service.logistics.LogisticsCompanyService; +import com.lframework.xingyun.core.dto.dic.city.DicCityDto; +import com.lframework.xingyun.core.service.DicCityService; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.vo.logistics.CreateLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetBizOrderVo; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class LogisticsSheetImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(LogisticsSheetImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getSaleOutSheetCodes()) && StringUtil.isBlank( + data.getRetailOutSheetCodes())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + + "行“销售出库单号、零售出库单号”不能同时为空"); + } + + if (StringUtil.isNotBlank(data.getSaleOutSheetCodes())) { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + List arr = CollectionUtil.toList( + data.getSaleOutSheetCodes().split(StringPool.STR_SPLIT)); + Wrapper querySaleOutSheetWrapper = Wrappers.lambdaQuery(SaleOutSheet.class) + .in(SaleOutSheet::getCode, arr); + List saleOutSheets = saleOutSheetService.list(querySaleOutSheetWrapper); + if (saleOutSheets.size() != arr.size()) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“销售出库单号(" + arr.stream() + .filter(t -> !saleOutSheets.contains(t)) + .collect(Collectors.joining(StringPool.STR_SPLIT_CN)) + ")”不存在"); + } + + data.setSaleOutSheetIds(new HashMap<>()); + for (SaleOutSheet saleOutSheet : saleOutSheets) { + data.getSaleOutSheetIds().put(saleOutSheet.getId(), saleOutSheet.getCode()); + } + } + + if (StringUtil.isNotBlank(data.getRetailOutSheetCodes())) { + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + List arr = CollectionUtil.toList( + data.getRetailOutSheetCodes().split(StringPool.STR_SPLIT)); + Wrapper queryRetailOutSheetWrapper = Wrappers.lambdaQuery( + RetailOutSheet.class).in(RetailOutSheet::getCode, arr); + List retailOutSheets = retailOutSheetService.list(queryRetailOutSheetWrapper); + if (retailOutSheets.size() != arr.size()) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“零售出库单号(" + arr.stream() + .filter(t -> !retailOutSheets.contains(t)) + .collect(Collectors.joining(StringPool.STR_SPLIT_CN)) + ")”不存在"); + } + + data.setRetailOutSheetIds(new HashMap<>()); + for (RetailOutSheet retailOutSheet : retailOutSheets) { + data.getRetailOutSheetIds().put(retailOutSheet.getId(), retailOutSheet.getCode()); + } + } + + if (StringUtil.isBlank(data.getLogisticsCompanyCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流公司编号”不能为空"); + } + LogisticsCompanyService logisticsCompanyService = ApplicationUtil.getBean( + LogisticsCompanyService.class); + Wrapper queryLogisticsCompanyWrapper = Wrappers.lambdaQuery( + LogisticsCompany.class).eq(LogisticsCompany::getCode, data.getLogisticsCompanyCode()); + LogisticsCompany logisticsCompany = logisticsCompanyService.getOne( + queryLogisticsCompanyWrapper); + if (logisticsCompany == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流公司编号”不存在"); + } + data.setLogisticsCompanyId(logisticsCompany.getId()); + + if (StringUtil.isBlank(data.getSenderName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人姓名”不能为空"); + } + if (StringUtil.isBlank(data.getSenderTelephone())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人联系电话”不能为空"); + } + if (StringUtil.isBlank(data.getSenderProvinceName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人省”不能为空"); + } + if (StringUtil.isBlank(data.getSenderCityName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人市”不能为空"); + } + if (StringUtil.isBlank(data.getSenderDistrictName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人区”不能为空"); + } + + DicCityService dicCityService = ApplicationUtil.getBean(DicCityService.class); + List allCitys = dicCityService.getAll(); + DicCityDto senderProvince = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName() + .equals(data.getSenderProvinceName())) + .findFirst().orElse(null); + if (senderProvince == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人省”不存在"); + } + data.setSenderProvinceId(senderProvince.getId()); + + DicCityDto senderCity = allCitys.stream() + .filter(t -> senderProvince.getId().equals(t.getParentId()) && t.getName() + .equals(data.getSenderCityName())) + .findFirst().orElse(null); + if (senderCity == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人市”不存在"); + } + data.setSenderCityId(senderCity.getId()); + + DicCityDto senderDistrict = allCitys.stream() + .filter(t -> senderCity.getId().equals(t.getParentId()) && t.getName() + .equals(data.getSenderDistrictName())) + .findFirst().orElse(null); + if (senderDistrict == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人区”错误不存在"); + } + data.setSenderDistrictId(senderDistrict.getId()); + + if (StringUtil.isBlank(data.getSenderAddress())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“寄件人地址”不能为空"); + } + + if (StringUtil.isBlank(data.getReceiverName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人姓名”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverTelephone())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人联系电话”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverProvinceName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人省”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverCityName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人市”不能为空"); + } + if (StringUtil.isBlank(data.getReceiverDistrictName())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人区”不能为空"); + } + + DicCityDto receiverProvince = allCitys.stream() + .filter(t -> StringUtil.isEmpty(t.getParentId()) && t.getName() + .equals(data.getReceiverProvinceName())) + .findFirst().orElse(null); + if (receiverProvince == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人省”不存在"); + } + data.setReceiverProvinceId(receiverProvince.getId()); + + DicCityDto receiverCity = allCitys.stream() + .filter(t -> receiverProvince.getId().equals(t.getParentId()) && t.getName() + .equals(data.getReceiverCityName())) + .findFirst().orElse(null); + if (receiverCity == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人市”不存在"); + } + data.setReceiverCityId(receiverCity.getId()); + + DicCityDto receiverDistrict = allCitys.stream() + .filter(t -> receiverCity.getId().equals(t.getParentId()) && t.getName() + .equals(data.getReceiverDistrictName())) + .findFirst().orElse(null); + if (receiverDistrict == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人区”错误不存在"); + } + data.setReceiverDistrictId(receiverDistrict.getId()); + + if (StringUtil.isBlank(data.getReceiverAddress())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收件人地址”不能为空"); + } + if (data.getTotalWeight() != null) { + if (NumberUtil.lt(data.getTotalWeight(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总重量”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalWeight(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总重量”最多允许2位小数"); + } + } + + if (data.getTotalVolume() != null) { + if (NumberUtil.lt(data.getTotalVolume(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总体积”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalVolume(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“总体积”最多允许2位小数"); + } + } + + if (data.getTotalAmount() != null) { + if (NumberUtil.lt(data.getTotalAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”不能小于0"); + } + if (!NumberUtil.isNumberPrecision(data.getTotalAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“物流费”最多允许2位小数"); + } + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + LogisticsSheetService logisticsSheetService = ApplicationUtil.getBean( + LogisticsSheetService.class); + + LogisticsSheetDetailService logisticsSheetDetailService = ApplicationUtil.getBean( + LogisticsSheetDetailService.class); + + List datas = this.getDatas(); + for (int i = 0; i < datas.size(); i++) { + LogisticsSheetImportModel data = datas.get(i); + if (CollectionUtil.isNotEmpty(data.getSaleOutSheetIds())) { + for (Entry entry : data.getSaleOutSheetIds().entrySet()) { + if (logisticsSheetDetailService.getByBizId(entry.getKey(), + LogisticsSheetDetailBizType.SALE_OUT_SHEET) != null) { + throw new DefaultClientException( + "销售出库单【" + entry.getValue() + "】已关联物流单,不允许再次关联物流单"); + } + } + } + + if (CollectionUtil.isNotEmpty(data.getRetailOutSheetIds())) { + for (Entry entry : data.getRetailOutSheetIds().entrySet()) { + if (logisticsSheetDetailService.getByBizId(entry.getKey(), + LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) != null) { + throw new DefaultClientException( + "零售出库单【" + entry.getValue() + "】已关联物流单,不允许再次关联物流单"); + } + } + } + + CreateLogisticsSheetVo createLogisticsSheetVo = new CreateLogisticsSheetVo(); + createLogisticsSheetVo.setLogisticsNo(data.getLogisticsNo()); + createLogisticsSheetVo.setLogisticsCompanyId(data.getLogisticsCompanyId()); + createLogisticsSheetVo.setSenderName(data.getSenderName()); + createLogisticsSheetVo.setSenderTelephone(data.getSenderTelephone()); + createLogisticsSheetVo.setSenderProvinceId(data.getSenderProvinceId()); + createLogisticsSheetVo.setSenderCityId(data.getSenderCityId()); + createLogisticsSheetVo.setSenderDistrictId(data.getSenderDistrictId()); + createLogisticsSheetVo.setSenderAddress(data.getSenderAddress()); + createLogisticsSheetVo.setReceiverName(data.getReceiverName()); + createLogisticsSheetVo.setReceiverTelephone(data.getReceiverTelephone()); + createLogisticsSheetVo.setReceiverProvinceId(data.getReceiverProvinceId()); + createLogisticsSheetVo.setReceiverCityId(data.getReceiverCityId()); + createLogisticsSheetVo.setReceiverDistrictId(data.getReceiverDistrictId()); + createLogisticsSheetVo.setReceiverAddress(data.getReceiverAddress()); + createLogisticsSheetVo.setTotalWeight(data.getTotalWeight()); + createLogisticsSheetVo.setTotalVolume(data.getTotalVolume()); + createLogisticsSheetVo.setTotalAmount(data.getTotalAmount()); + createLogisticsSheetVo.setDescription(data.getDescription()); + createLogisticsSheetVo.setBizOrders(new ArrayList<>()); + if (CollectionUtil.isNotEmpty(data.getSaleOutSheetIds())) { + for (Entry entry : data.getSaleOutSheetIds().entrySet()) { + LogisticsSheetBizOrderVo bizOrderVo = new LogisticsSheetBizOrderVo(); + bizOrderVo.setBizId(entry.getKey()); + bizOrderVo.setBizType(LogisticsSheetDetailBizType.SALE_OUT_SHEET.getCode()); + createLogisticsSheetVo.getBizOrders().add(bizOrderVo); + } + } + + if (CollectionUtil.isNotEmpty(data.getRetailOutSheetIds())) { + for (Entry entry : data.getRetailOutSheetIds().entrySet()) { + LogisticsSheetBizOrderVo bizOrderVo = new LogisticsSheetBizOrderVo(); + bizOrderVo.setBizId(entry.getKey()); + bizOrderVo.setBizType(LogisticsSheetDetailBizType.RETAIL_OUT_SHEET.getCode()); + createLogisticsSheetVo.getBizOrders().add(bizOrderVo); + } + } + + try { + logisticsSheetService.create(createLogisticsSheetVo); + } catch (Exception e) { + throw new DefaultClientException( + "第" + (i + 1) + "行新增失败,失败原因:" + e.getMessage()); + } + + this.setSuccessProcess(i); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportModel.java new file mode 100644 index 0000000..8535870 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/logistics/LogisticsSheetImportModel.java @@ -0,0 +1,200 @@ +package com.lframework.xingyun.sc.excel.logistics; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.math.BigDecimal; +import java.util.Map; +import lombok.Data; + +@Data +public class LogisticsSheetImportModel implements ExcelModel { + + /** + * 物流单号 + */ + @ExcelProperty("物流单号") + private String logisticsNo; + + /** + * 销售出库单ID + */ + @ExcelIgnore + private Map saleOutSheetIds; + + /** + * 销售出库单号 + */ + @ExcelProperty("销售出库单号,多个用,分隔") + private String saleOutSheetCodes; + + /** + * 零售出库单ID + */ + @ExcelIgnore + private Map retailOutSheetIds; + + /** + * 零售出库单号 + */ + @ExcelProperty("零售出库单号,多个用,分隔") + private String retailOutSheetCodes; + + /** + * 物流公司ID + */ + @ExcelIgnore + private String logisticsCompanyId; + + /** + * 物流公司编号 + */ + @ExcelRequired + @ExcelProperty("物流公司编号") + private String logisticsCompanyCode; + + /** + * 寄件人姓名 + */ + @ExcelRequired + @ExcelProperty("寄件人姓名") + private String senderName; + + /** + * 寄件人联系电话 + */ + @ExcelRequired + @ExcelProperty("寄件人联系电话") + private String senderTelephone; + + /** + * 寄件人省ID + */ + @ExcelIgnore + private String senderProvinceId; + + /** + * 寄件人省 + */ + @ExcelRequired + @ExcelProperty("寄件人省") + private String senderProvinceName; + + /** + * 寄件人市ID + */ + @ExcelIgnore + private String senderCityId; + + /** + * 寄件人市 + */ + @ExcelRequired + @ExcelProperty("寄件人市") + private String senderCityName; + + /** + * 寄件人区ID + */ + @ExcelIgnore + private String senderDistrictId; + + /** + * 寄件人区 + */ + @ExcelRequired + @ExcelProperty("寄件人区") + private String senderDistrictName; + + /** + * 寄件人地址 + */ + @ExcelRequired + @ExcelProperty("寄件人地址") + private String senderAddress; + + /** + * 收件人姓名 + */ + @ExcelRequired + @ExcelProperty("收件人姓名") + private String receiverName; + + /** + * 收件人联系电话 + */ + @ExcelRequired + @ExcelProperty("收件人联系电话") + private String receiverTelephone; + + /** + * 收件人省ID + */ + @ExcelIgnore + private String receiverProvinceId; + + /** + * 收件人省 + */ + @ExcelRequired + @ExcelProperty("收件人省") + private String receiverProvinceName; + + /** + * 收件人市ID + */ + @ExcelIgnore + private String receiverCityId; + + /** + * 收件人市 + */ + @ExcelRequired + @ExcelProperty("收件人市") + private String receiverCityName; + + /** + * 收件人区ID + */ + @ExcelIgnore + private String receiverDistrictId; + + /** + * 收件人区 + */ + @ExcelRequired + @ExcelProperty("收件人区") + private String receiverDistrictName; + + /** + * 收件人地址 + */ + @ExcelRequired + @ExcelProperty("收件人地址") + private String receiverAddress; + + /** + * 总重量 + */ + @ExcelProperty("总重量(kg)") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @ExcelProperty("总体积(cm³)") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @ExcelProperty("物流费(元)") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportModel.java new file mode 100644 index 0000000..ab57610 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderExportModel.java @@ -0,0 +1,198 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class PurchaseOrderExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ExcelProperty("采购员") + private String purchaserName; + + /** + * 预计到货日期 + */ + @ExcelProperty("预计到货日期") + @DateTimeFormat(StringPool.DATE_PATTERN) + private Date expectArriveDate; + + /** + * 采购数量 + */ + @ExcelProperty("采购数量") + private Integer purchaseNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 采购金额 + */ + @ExcelProperty("采购金额") + private BigDecimal purchaseAmount; + + /** + * 约定支付 + */ + @ExcelProperty("约定支付") + private String payTypeStr; + + /** + * 备注 + */ + @ExcelProperty("订单备注") + private String description; + + /** + * 创建人 + */ + @ExcelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ExcelProperty("创建时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 拒绝原因 + */ + @ExcelProperty("拒绝原因") + private String refuseReason; + + public PurchaseOrderExportModel() { + + } + + public PurchaseOrderExportModel(PurchaseOrder dto) { + + super(dto); + } + + @Override + public
BaseBo convert(PurchaseOrder dto) { + + return this; + } + + @Override + protected void afterInit(PurchaseOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScName(sc.getName()); + this.setSupplierName(supplier.getName()); + if (!StringUtil.isBlank(dto.getPurchaserId())) { + UserDto purchaser = userService.findById(dto.getPurchaserId()); + this.setPurchaserName(purchaser.getName()); + } + this.setExpectArriveDate(DateUtil.toDate(dto.getExpectArriveDate())); + this.setPurchaseNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setPurchaseAmount(dto.getTotalAmount()); + this.setDescription(dto.getDescription()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + + this.setStatus(dto.getStatus().getDesc()); + this.setRefuseReason(dto.getRefuseReason()); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportListener.java new file mode 100644 index 0000000..4c123ab --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportListener.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.purchase.CreatePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.PurchaseProductVo; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class PurchaseOrderImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(PurchaseOrderImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getScCode())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不能为空"); + } else { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getScCode()); + StoreCenter sc = storeCenterService.getOne(queryWrapper); + if (sc == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不存在"); + } + + data.setScId(sc.getId()); + } + if (StringUtil.isBlank(data.getSupplierCode())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不能为空"); + } else { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getSupplierCode()); + Supplier supplier = supplierService.getOne(queryWrapper); + if (supplier == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“供应商编号”不存在"); + } + + data.setSupplierId(supplier.getId()); + } + if (!StringUtil.isBlank(data.getPurchaserCode())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto purchaser = userService.findByCode(data.getPurchaserCode()); + if (purchaser == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购员编号”不存在"); + } + data.setPurchaserId(purchaser.getId()); + } + if (data.getExpectArriveDate() == null) { + data.setExpectArriveDate(new Date()); + } + if (StringUtil.isBlank(data.getProductCode())) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“商品编号”不能为空"); + } else { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getProductCode()); + Product product = productService.getOne(queryWrapper); + if (product == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不存在"); + } + data.setProductId(product.getId()); + } + + if (!"是".equals(data.getGift()) && !"否".equals(data.getGift())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否赠品”只能填“是”或“否”"); + } + + boolean isGift = "是".equals(data.getGift()); + if (!isGift) { + // 非赠品 + if (data.getPurchasePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”不能为空"); + } + if (NumberUtil.le(data.getPurchasePrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”必须大于0"); + } + if (!NumberUtil.isNumberPrecision(data.getPurchasePrice(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”最多允许2位小数"); + } + } else { + // 赠品 + data.setPurchasePrice(BigDecimal.ZERO); + } + if (data.getPurchaseNum() == null) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“采购数量”不能为空"); + } + if (data.getPurchaseNum() <= 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购数量”必须大于0"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据仓库、供应商、采购员、预计到货日期 分组 + Map> groupByMap = this.getDatas().stream().collect( + Collectors.groupingBy( + t -> t.getScCode() + "_" + t.getSupplierCode() + "_" + t.getPurchaserCode() + "_" + + DateUtil.toLocalDate(t.getExpectArriveDate()))); + + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + + int index = 0; + for (List value : groupByMap.values()) { + PurchaseOrderImportModel valueObj = value.get(0); + CreatePurchaseOrderVo createPurchaseOrderVo = new CreatePurchaseOrderVo(); + createPurchaseOrderVo.setScId(valueObj.getScId()); + createPurchaseOrderVo.setSupplierId(valueObj.getSupplierId()); + createPurchaseOrderVo.setPurchaserId(valueObj.getPurchaserId()); + createPurchaseOrderVo.setExpectArriveDate( + DateUtil.toLocalDate(valueObj.getExpectArriveDate())); + createPurchaseOrderVo.setDescription(valueObj.getDescription()); + + List products = new ArrayList<>(); + for (PurchaseOrderImportModel data : value) { + PurchaseProductVo purchaseProductVo = new PurchaseProductVo(); + purchaseProductVo.setProductId(data.getProductId()); + purchaseProductVo.setPurchasePrice(data.getPurchasePrice()); + purchaseProductVo.setPurchaseNum(data.getPurchaseNum()); + purchaseProductVo.setDescription(data.getDetailDescription()); + + products.add(purchaseProductVo); + + index++; + this.setSuccessProcessByIndex(index); + } + createPurchaseOrderVo.setProducts(products); + + purchaseOrderService.create(createPurchaseOrderVo); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportModel.java new file mode 100644 index 0000000..164a91c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderImportModel.java @@ -0,0 +1,103 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class PurchaseOrderImportModel implements ExcelModel { + + /** + * 仓库ID + */ + @ExcelIgnore + private String scId; + + /** + * 仓库编号 + */ + @ExcelRequired + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 供应商ID + */ + @ExcelIgnore + private String supplierId; + + /** + * 供应商编号 + */ + @ExcelRequired + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 采购员ID + */ + @ExcelIgnore + private String purchaserId; + + /** + * 采购员编号 + */ + @ExcelProperty("采购员编号") + private String purchaserCode; + + /** + * 预计到货日期 + */ + @ExcelProperty("预计到货日期") + private Date expectArriveDate; + + /** + * 商品ID + */ + @ExcelIgnore + private String productId; + + /** + * 商品编号 + */ + @ExcelRequired + @ExcelProperty("商品编号") + private String productCode; + + /** + * 采购价 + */ + @ExcelRequired + @ExcelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 采购数量 + */ + @ExcelRequired + @ExcelProperty("采购数量") + private Integer purchaseNum; + + /** + * 是否赠品 + */ + @ExcelRequired + @ExcelProperty("是否赠品") + private String gift; + + /** + * 单据明细备注 + */ + @ExcelProperty("单据明细备注") + private String detailDescription; + + /** + * 单据备注 + */ + @ExcelProperty("单据备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportListener.java new file mode 100644 index 0000000..88a7341 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportListener.java @@ -0,0 +1,143 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class PurchaseOrderPayTypeImportListener extends + ExcelImportListener { + + @Override + protected void doInvoke(PurchaseOrderPayTypeImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不能为空"); + } + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean(PurchaseOrderService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(PurchaseOrder.class) + .eq(PurchaseOrder::getCode, data.getCode()); + PurchaseOrder order = purchaseOrderService.getOne(queryWrapper); + if (order == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不存在"); + } + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“单据号”的状态为“" + + PurchaseOrderStatus.APPROVE_PASS.getDesc() + "”,不允许导入支付方式"); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean( + OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”已关联支付方式,不允许重复导入"); + } + data.setId(order.getId()); + data.setTotalAmount(order.getTotalAmount()); + + if (StringUtil.isBlank(data.getPayTypeCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不能为空"); + } + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + Wrapper queryPayTypeWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, data.getPayTypeCode()); + PayType payType = payTypeService.getOne(queryPayTypeWrapper); + if (payType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不存在"); + } + + data.setPayTypeId(payType.getId()); + + if (data.getPayAmount() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”不能为空"); + } + + if (NumberUtil.le(data.getPayAmount(), BigDecimal.ZERO)) { + // 如果 <= 0 + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”必须大于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getPayAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”最多允许2位小数"); + } + + if (payType.getRecText()) { + if (StringUtil.isBlank(data.getText())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付内容”不能为空"); + } + } else { + data.setText(null); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据ID 分组 + Map> groupByMap = this.getDatas().stream() + .collect( + Collectors.groupingBy(PurchaseOrderPayTypeImportModel::getId)); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean( + OrderPayTypeService.class); + + int index = 0; + for (Entry> entry : groupByMap.entrySet()) { + List value = entry.getValue(); + String id = entry.getKey(); + + BigDecimal totalAmount = value.stream().map(PurchaseOrderPayTypeImportModel::getPayAmount) + .reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, value.get(0).getTotalAmount())) { + throw new DefaultClientException( + "单据号:" + value.get(0).getCode() + "所有支付方式的支付金额不等于含税总金额,请检查"); + } + + orderPayTypeService.create(id, value.stream().map(t -> { + OrderPayTypeVo orderPayTypeVo = new OrderPayTypeVo(); + orderPayTypeVo.setId(t.getPayTypeId()); + orderPayTypeVo.setPayAmount(t.getPayAmount()); + orderPayTypeVo.setText(t.getText()); + + return orderPayTypeVo; + }).collect(Collectors.toList())); + + index++; + this.setSuccessProcessByIndex(index); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportModel.java new file mode 100644 index 0000000..1025beb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/PurchaseOrderPayTypeImportModel.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.excel.purchase; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class PurchaseOrderPayTypeImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 单据号 + */ + @ExcelRequired + @ExcelProperty("单据号") + private String code; + + /** + * 支付方式ID + */ + @ExcelIgnore + private String payTypeId; + + /** + * 支付方式编号 + */ + @ExcelRequired + @ExcelProperty("支付方式编号") + private String payTypeCode; + + /** + * 支付金额 + */ + @ExcelRequired + @ExcelProperty("支付金额") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @ExcelProperty("支付内容") + private String text; + + /** + * 单据总金额 + */ + @ExcelIgnore + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportModel.java new file mode 100644 index 0000000..b2488d7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetExportModel.java @@ -0,0 +1,199 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class ReceiveSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ExcelProperty("采购员") + private String purchaserName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private Integer receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 实际到货日期 + */ + @ExcelProperty("实际到货日期") + @DateTimeFormat(StringPool.DATE_PATTERN) + private Date receiveDate; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 采购订单号 + */ + @ExcelProperty("采购订单号") + private String purchaseOrderCode; + + public ReceiveSheetExportModel() { + + } + + public ReceiveSheetExportModel(ReceiveSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(ReceiveSheet dto) { + + return this; + } + + @Override + protected void afterInit(ReceiveSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto purchaser = null; + if (!StringUtil.isBlank(dto.getPurchaserId())) { + purchaser = userService.findById(dto.getPurchaserId()); + } + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setPurchaserName(purchaser == null ? null : purchaser.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setReceiveDate(DateUtil.toDate(dto.getReceiveDate())); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getPurchaseOrderId())) { + PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean( + PurchaseOrderService.class); + PurchaseOrder purchaseOrder = purchaseOrderService.getById(dto.getPurchaseOrderId()); + this.setPurchaseOrderCode(purchaseOrder.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportListener.java new file mode 100644 index 0000000..256bc98 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportListener.java @@ -0,0 +1,179 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.purchase.receive.CreateReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveProductVo; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ReceiveSheetImportListener extends ExcelImportListener { + + @Override + protected void doInvoke(ReceiveSheetImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getScCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不能为空"); + } else { + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(StoreCenter.class) + .eq(StoreCenter::getCode, data.getScCode()); + StoreCenter sc = storeCenterService.getOne(queryWrapper); + if (sc == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“仓库编号”不存在"); + } + + data.setScId(sc.getId()); + } + if (StringUtil.isBlank(data.getSupplierCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“供应商编号”不能为空"); + } else { + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Supplier.class) + .eq(Supplier::getCode, data.getSupplierCode()); + Supplier supplier = supplierService.getOne(queryWrapper); + if (supplier == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“供应商编号”不存在"); + } + + data.setSupplierId(supplier.getId()); + } + if (!StringUtil.isBlank(data.getPurchaserCode())) { + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto purchaser = userService.findByCode(data.getPurchaserCode()); + if (purchaser == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购员编号”不存在"); + } + data.setPurchaserId(purchaser.getId()); + } + if (data.getPaymentDate() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“付款日期”不存在"); + } + if (data.getReceiveDate() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“实际到货日期”不存在"); + } + if (StringUtil.isBlank(data.getProductCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不能为空"); + } else { + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(Product.class) + .eq(Product::getCode, data.getProductCode()); + Product product = productService.getOne(queryWrapper); + if (product == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“商品编号”不存在"); + } + data.setProductId(product.getId()); + } + + if (!"是".equals(data.getGift()) && !"否".equals(data.getGift())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“是否赠品”只能填“是”或“否”"); + } + + boolean isGift = "是".equals(data.getGift()); + if (!isGift) { + // 非赠品 + if (data.getPurchasePrice() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”不能为空"); + } + if (NumberUtil.le(data.getPurchasePrice(), 0)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”必须大于0"); + } + if (!NumberUtil.isNumberPrecision(data.getPurchasePrice(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“采购价”最多允许2位小数"); + } + } else { + // 赠品 + data.setPurchasePrice(BigDecimal.ZERO); + } + if (data.getReceiveNum() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收货数量”不能为空"); + } + if (data.getReceiveNum() <= 0) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“收货数量”必须大于0"); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据仓库、供应商、采购员、预计到货日期 分组 + Map> groupByMap = this.getDatas().stream().collect( + Collectors.groupingBy( + t -> t.getScCode() + "_" + t.getSupplierCode() + "_" + t.getPurchaserCode() + "_" + + DateUtil.toLocalDate(t.getPaymentDate()) + "_" + DateUtil.toLocalDate( + t.getReceiveDate()))); + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + + int index = 0; + for (List value : groupByMap.values()) { + ReceiveSheetImportModel valueObj = value.get(0); + CreateReceiveSheetVo createReceiveSheetVo = new CreateReceiveSheetVo(); + createReceiveSheetVo.setScId(valueObj.getScId()); + createReceiveSheetVo.setSupplierId(valueObj.getSupplierId()); + createReceiveSheetVo.setPurchaserId(valueObj.getPurchaserId()); + createReceiveSheetVo.setPaymentDate(DateUtil.toLocalDate(valueObj.getPaymentDate())); + createReceiveSheetVo.setAllowModifyPaymentDate(Boolean.TRUE); + createReceiveSheetVo.setReceiveDate(DateUtil.toLocalDate(valueObj.getReceiveDate())); + createReceiveSheetVo.setDescription(valueObj.getDescription()); + createReceiveSheetVo.setRequired(Boolean.FALSE); + + List products = new ArrayList<>(); + for (ReceiveSheetImportModel data : value) { + ReceiveProductVo purchaseProductVo = new ReceiveProductVo(); + purchaseProductVo.setProductId(data.getProductId()); + purchaseProductVo.setPurchasePrice(data.getPurchasePrice()); + purchaseProductVo.setReceiveNum(data.getReceiveNum()); + purchaseProductVo.setDescription(data.getDetailDescription()); + + products.add(purchaseProductVo); + + index++; + this.setSuccessProcessByIndex(index); + } + createReceiveSheetVo.setProducts(products); + + receiveSheetService.create(createReceiveSheetVo); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportModel.java new file mode 100644 index 0000000..0da2609 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetImportModel.java @@ -0,0 +1,111 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class ReceiveSheetImportModel implements ExcelModel { + + /** + * 仓库ID + */ + @ExcelIgnore + private String scId; + + /** + * 仓库编号 + */ + @ExcelRequired + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 供应商ID + */ + @ExcelIgnore + private String supplierId; + + /** + * 供应商编号 + */ + @ExcelRequired + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 采购员ID + */ + @ExcelIgnore + private String purchaserId; + + /** + * 采购员编号 + */ + @ExcelProperty("采购员编号") + private String purchaserCode; + + /** + * 付款日期 + */ + @ExcelRequired + @ExcelProperty("付款日期") + private Date paymentDate; + + /** + * 实际到货日期 + */ + @ExcelRequired + @ExcelProperty("实际到货日期") + private Date receiveDate; + + /** + * 商品ID + */ + @ExcelIgnore + private String productId; + + /** + * 商品编号 + */ + @ExcelRequired + @ExcelProperty("商品编号") + private String productCode; + + /** + * 采购价 + */ + @ExcelRequired + @ExcelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 收货数量 + */ + @ExcelRequired + @ExcelProperty("收货数量") + private Integer receiveNum; + + /** + * 是否赠品 + */ + @ExcelRequired + @ExcelProperty("是否赠品") + private String gift; + + /** + * 单据明细备注 + */ + @ExcelProperty("单据明细备注") + private String detailDescription; + + /** + * 单据备注 + */ + @ExcelProperty("单据备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportListener.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportListener.java new file mode 100644 index 0000000..8535b1e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportListener.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.context.AnalysisContext; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelImportListener; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ReceiveSheetPayTypeImportListener extends + ExcelImportListener { + + @Override + protected void doInvoke(ReceiveSheetPayTypeImportModel data, AnalysisContext context) { + if (StringUtil.isBlank(data.getCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不能为空"); + } + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery(ReceiveSheet.class) + .eq(ReceiveSheet::getCode, data.getCode()); + ReceiveSheet order = receiveSheetService.getOne(queryWrapper); + if (order == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“单据号”不存在"); + } + if (order.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行“单据号”的状态为“" + + ReceiveSheetStatus.APPROVE_PASS.getDesc() + "”,不允许导入支付方式"); + } + data.setId(order.getId()); + data.setTotalAmount(order.getTotalAmount()); + + if (StringUtil.isBlank(data.getPayTypeCode())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不能为空"); + } + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + Wrapper queryPayTypeWrapper = Wrappers.lambdaQuery(PayType.class) + .eq(PayType::getCode, data.getPayTypeCode()); + PayType payType = payTypeService.getOne(queryPayTypeWrapper); + if (payType == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付方式编号”不存在"); + } + + data.setPayTypeId(payType.getId()); + + if (data.getPayAmount() == null) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”不能为空"); + } + + if (NumberUtil.le(data.getPayAmount(), BigDecimal.ZERO)) { + // 如果 <= 0 + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”必须大于0"); + } + + if (!NumberUtil.isNumberPrecision(data.getPayAmount(), 2)) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付金额”最多允许2位小数"); + } + + if (payType.getRecText()) { + if (StringUtil.isBlank(data.getText())) { + throw new DefaultClientException( + "第" + context.readRowHolder().getRowIndex() + "行“支付内容”不能为空"); + } + } else { + data.setText(null); + } + } + + @Override + protected void afterAllAnalysed(AnalysisContext context) { + + // 根据ID 分组 + Map> groupByMap = this.getDatas().stream() + .collect( + Collectors.groupingBy(ReceiveSheetPayTypeImportModel::getId)); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean( + OrderPayTypeService.class); + + int index = 0; + for (Entry> entry : groupByMap.entrySet()) { + List value = entry.getValue(); + String id = entry.getKey(); + + BigDecimal totalAmount = value.stream().map(ReceiveSheetPayTypeImportModel::getPayAmount) + .reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, value.get(0).getTotalAmount())) { + throw new DefaultClientException( + "单据号:" + value.get(0).getCode() + "所有支付方式的支付金额不等于含税总金额,请检查"); + } + + orderPayTypeService.create(id, value.stream().map(t -> { + OrderPayTypeVo orderPayTypeVo = new OrderPayTypeVo(); + orderPayTypeVo.setId(t.getPayTypeId()); + orderPayTypeVo.setPayAmount(t.getPayAmount()); + orderPayTypeVo.setText(t.getText()); + + return orderPayTypeVo; + }).collect(Collectors.toList())); + + index++; + this.setSuccessProcessByIndex(index); + } + } + + @Override + protected void doComplete() { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportModel.java new file mode 100644 index 0000000..12b22aa --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/receive/ReceiveSheetPayTypeImportModel.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.excel.purchase.receive; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.annotations.excel.ExcelRequired; +import com.lframework.starter.web.components.excel.ExcelModel; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class ReceiveSheetPayTypeImportModel implements ExcelModel { + + /** + * ID + */ + @ExcelIgnore + private String id; + + /** + * 单据号 + */ + @ExcelRequired + @ExcelProperty("单据号") + private String code; + + /** + * 支付方式ID + */ + @ExcelIgnore + private String payTypeId; + + /** + * 支付方式编号 + */ + @ExcelRequired + @ExcelProperty("支付方式编号") + private String payTypeCode; + + /** + * 支付金额 + */ + @ExcelRequired + @ExcelProperty("支付金额") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @ExcelProperty("支付内容") + private String text; + + /** + * 单据总金额 + */ + @ExcelIgnore + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportModel.java new file mode 100644 index 0000000..e7ce3bf --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/purchase/returned/PurchaseReturnExportModel.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.sc.excel.purchase.returned; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class PurchaseReturnExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 采购员姓名 + */ + @ExcelProperty("采购员") + private String purchaserName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private Integer receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 采购收货单号 + */ + @ExcelProperty("采购收货单号") + private String receiveSheetCode; + + public PurchaseReturnExportModel() { + + } + + public PurchaseReturnExportModel(PurchaseReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(PurchaseReturn dto) { + + return this; + } + + @Override + protected void afterInit(PurchaseReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto purchaser = null; + if (!StringUtil.isBlank(dto.getPurchaserId())) { + purchaser = userService.findById(dto.getPurchaserId()); + } + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setPurchaserName(purchaser == null ? null : purchaser.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getReceiveSheetId())) { + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + ReceiveSheet receiveSheet = receiveSheetService.getById(dto.getReceiveSheetId()); + this.setReceiveSheetCode(receiveSheet.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportModel.java new file mode 100644 index 0000000..65fdd38 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/out/RetailOutSheetExportModel.java @@ -0,0 +1,202 @@ +package com.lframework.xingyun.sc.excel.retail.out; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class RetailOutSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("会员编号") + private String memberCode; + + /** + * 客户名称 + */ + @ExcelProperty("会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ExcelProperty("支付方式") + private String payTypeStr; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private Integer receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public RetailOutSheetExportModel() { + + } + + public RetailOutSheetExportModel(RetailOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailOutSheet dto) { + + return this; + } + + @Override + protected void afterInit(RetailOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setMemberCode(member.getCode()); + this.setMemberName(member.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportModel.java new file mode 100644 index 0000000..c7cac04 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/retail/returned/RetailReturnExportModel.java @@ -0,0 +1,217 @@ +package com.lframework.xingyun.sc.excel.retail.returned; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class RetailReturnExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 会员编号 + */ + @ExcelProperty("会员编号") + private String memberCode; + + /** + * 会员名称 + */ + @ExcelProperty("会员名称") + private String memberName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 支付方式 + */ + @ExcelProperty("支付方式") + private String payTypeStr; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 零售出库单号 + */ + @ExcelProperty("零售出库单号") + private String outSheetCode; + + public RetailReturnExportModel() { + + } + + public RetailReturnExportModel(RetailReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(RetailReturn dto) { + + return this; + } + + @Override + protected void afterInit(RetailReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + MemberService memberService = ApplicationUtil.getBean(MemberService.class); + Member member = memberService.findById(dto.getMemberId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setMemberCode(member.getCode()); + this.setMemberName(member.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + + if (!StringUtil.isBlank(dto.getOutSheetId())) { + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + RetailOutSheet retailOutSheet = retailOutSheetService.getById(dto.getOutSheetId()); + this.setOutSheetCode(retailOutSheet.getCode()); + } + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java new file mode 100644 index 0000000..bdfd209 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/SaleOrderExportModel.java @@ -0,0 +1,196 @@ +package com.lframework.xingyun.sc.excel.sale; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.PayType; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.paytype.PayTypeService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class SaleOrderExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scOde; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ExcelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 约定支付 + */ + @ExcelProperty("约定支付") + private String payTypeStr; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SaleOrderExportModel() { + + } + + public SaleOrderExportModel(SaleOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOrder dto) { + + return this; + } + + @Override + protected void afterInit(SaleOrder dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = userService.findById(dto.getSalerId()); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScOde(sc.getCode()); + this.setScName(sc.getName()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + if (saler != null) { + this.setSalerName(saler.getName()); + } + this.setTotalNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setTotalAmount(dto.getTotalAmount()); + this.setDescription(dto.getDescription()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + + this.setStatus(dto.getStatus().getDesc()); + + OrderPayTypeService orderPayTypeService = ApplicationUtil.getBean(OrderPayTypeService.class); + List orderPayTypes = orderPayTypeService.findByOrderId(dto.getId()); + + PayTypeService payTypeService = ApplicationUtil.getBean(PayTypeService.class); + + if (CollectionUtil.isNotEmpty(orderPayTypes)) { + this.payTypeStr = orderPayTypes.stream().map(orderPayType -> { + PayType payType = payTypeService.findById(orderPayType.getPayTypeId()); + return StringUtil.format("{}:{}元", payType.getName(), orderPayType.getPayAmount()); + }).collect(Collectors.joining(";")); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportModel.java new file mode 100644 index 0000000..ade9d2e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/out/SaleOutSheetExportModel.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.sc.excel.sale.out; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class SaleOutSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ExcelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private Integer receiveNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 采购订单号 + */ + @ExcelProperty("销售订单号") + private String purchaseOrderCode; + + public SaleOutSheetExportModel() { + + } + + public SaleOutSheetExportModel(SaleOutSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleOutSheet dto) { + + return this; + } + + @Override + protected void afterInit(SaleOutSheet dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setReceiveNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getSaleOrderId())) { + SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class); + SaleOrder saleOrder = saleOrderService.getById(dto.getSaleOrderId()); + this.setPurchaseOrderCode(saleOrder.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportModel.java new file mode 100644 index 0000000..438a2a7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/sale/returned/SaleReturnExportModel.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.sc.excel.sale.returned; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class SaleReturnExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 客户编号 + */ + @ExcelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ExcelProperty("客户名称") + private String customerName; + + /** + * 销售员姓名 + */ + @ExcelProperty("销售员") + private String salerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 商品数量 + */ + @ExcelProperty("商品数量") + private Integer totalNum; + + /** + * 赠品数量 + */ + @ExcelProperty("赠品数量") + private Integer giftNum; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 销售出库单号 + */ + @ExcelProperty("销售出库单号") + private String outSheetCode; + + public SaleReturnExportModel() { + + } + + public SaleReturnExportModel(SaleReturn dto) { + + super(dto); + } + + @Override + public BaseBo convert(SaleReturn dto) { + + return this; + } + + @Override + protected void afterInit(SaleReturn dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto saler = null; + if (!StringUtil.isBlank(dto.getSalerId())) { + saler = userService.findById(dto.getSalerId()); + } + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setSalerName(saler == null ? null : saler.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalNum(dto.getTotalNum()); + this.setGiftNum(dto.getTotalGiftNum()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(dto.getStatus().getDesc()); + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + this.setSettleStatus(dto.getSettleStatus().getDesc()); + this.setDescription(dto.getDescription()); + if (!StringUtil.isBlank(dto.getOutSheetId())) { + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + SaleOutSheet saleOutSheet = saleOutSheetService.getById(dto.getOutSheetId()); + this.setOutSheetCode(saleOutSheet.getCode()); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportModel.java new file mode 100644 index 0000000..08dd55c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockExportModel.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.sc.excel.stock; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStock; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class ProductStockExportModel extends BaseBo implements ExcelModel { + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 商品编号 + */ + @ExcelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ExcelProperty("商品名称") + private String productName; + + /** + * 商品类目 + */ + @ExcelProperty("商品类目") + private String categoryName; + + /** + * 商品品牌 + */ + @ExcelProperty("商品品牌") + private String brandName; + + /** + * 库存数量 + */ + @ExcelProperty("库存数量") + private Integer stockNum; + + /** + * 含税价格 + */ + @ExcelProperty("含税价格") + private BigDecimal taxPrice; + + /** + * 含税金额 + */ + @ExcelProperty("含税金额") + private BigDecimal taxAmount; + + public ProductStockExportModel() { + + } + + public ProductStockExportModel(ProductStock dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductStock dto) { + + return this; + } + + @Override + protected void afterInit(ProductStock dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + + this.setStockNum(dto.getStockNum()); + this.setTaxPrice(NumberUtil.getNumber(dto.getTaxPrice(), 2)); + this.setTaxAmount(NumberUtil.getNumber(dto.getTaxAmount(), 2)); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportModel.java new file mode 100644 index 0000000..d1843c8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/ProductStockLogExportModel.java @@ -0,0 +1,172 @@ +package com.lframework.xingyun.sc.excel.stock; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class ProductStockLogExportModel extends BaseBo implements ExcelModel { + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 商品编号 + */ + @ExcelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ExcelProperty("商品名称") + private String productName; + + /** + * 商品类目 + */ + @ExcelProperty("商品类目") + private String categoryName; + + /** + * 商品品牌 + */ + @ExcelProperty("商品品牌") + private String brandName; + + /** + * 原库存数量 + */ + @ExcelProperty("变动前库存数量") + private Integer oriStockNum; + + /** + * 现库存数量 + */ + @ExcelProperty("变动后库存数量") + private Integer curStockNum; + + /** + * 库存数量 + */ + @ExcelProperty("变动库存数量") + private Integer stockNum; + + /** + * 原含税成本价 + */ + @ExcelProperty("变动前含税成本价") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @ExcelProperty("变动后含税成本价") + private BigDecimal curTaxPrice; + + /** + * 含税金额 + */ + @ExcelProperty("变动含税金额") + private BigDecimal taxAmount; + + /** + * 创建时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 创建人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ExcelProperty("业务类型") + private String bizType; + + public ProductStockLogExportModel() { + + } + + public ProductStockLogExportModel(ProductStockLog dto) { + + super(dto); + } + + @Override + public BaseBo convert(ProductStockLog dto) { + + return this; + } + + @Override + protected void afterInit(ProductStockLog dto) { + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.setScCode(sc.getCode()); + this.setScName(sc.getName()); + + ProductService productService = ApplicationUtil.getBean(ProductService.class); + Product product = productService.findById(dto.getProductId()); + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + ProductCategory productCategory = productCategoryService.findById(product.getCategoryId()); + + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + ProductBrand productBrand = productBrandService.findById(product.getBrandId()); + + this.productCode = product.getCode(); + this.productName = product.getName(); + this.categoryName = productCategory.getName(); + this.brandName = productBrand.getName(); + + this.setOriStockNum(dto.getOriStockNum()); + this.setCurStockNum(dto.getCurStockNum()); + this.setStockNum(dto.getStockNum()); + this.setOriTaxPrice(NumberUtil.getNumber(dto.getOriTaxPrice(), 2)); + this.setCurTaxPrice(NumberUtil.getNumber(dto.getCurTaxPrice(), 2)); + this.setTaxAmount(NumberUtil.getNumber(dto.getTaxAmount(), 2)); + + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setBizCode(dto.getBizCode()); + this.setBizType(dto.getBizType().getDesc()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportModel.java new file mode 100644 index 0000000..ad6dbd5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockAdjustSheetExportModel.java @@ -0,0 +1,128 @@ +package com.lframework.xingyun.sc.excel.stock.adjust; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetDetailService; +import com.lframework.xingyun.template.core.service.UserService; +import java.util.Date; +import java.util.List; +import lombok.Data; + +@Data +public class StockAdjustSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 调整品种数 + */ + @ExcelProperty("调整品种数") + private Integer productNum; + + /** + * 库存调整数量 + */ + @ExcelProperty("库存调整数量") + private Integer diffStockNum; + + /** + * 修改时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("操作时间") + private Date updateTime; + + /** + * 修改人 + */ + @ExcelProperty("操作人") + private String updateBy; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 审核时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("审核时间") + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public StockAdjustSheetExportModel(StockAdjustSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(StockAdjustSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(StockAdjustSheet dto) { + + this.status = dto.getStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + StockAdjustSheetDetailService stockAdjustSheetDetailService = ApplicationUtil.getBean( + StockAdjustSheetDetailService.class); + Wrapper queryWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class).eq(StockAdjustSheetDetail::getSheetId, dto.getId()) + .orderByAsc(StockAdjustSheetDetail::getOrderNo); + List details = stockAdjustSheetDetailService.list(queryWrapper); + this.productNum = details.size(); + this.diffStockNum = details.stream().mapToInt(StockAdjustSheetDetail::getStockNum).sum(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockCostAdjustSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockCostAdjustSheetExportModel.java new file mode 100644 index 0000000..0dd8763 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/adjust/StockCostAdjustSheetExportModel.java @@ -0,0 +1,115 @@ +package com.lframework.xingyun.sc.excel.stock.adjust; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheet; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class StockCostAdjustSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 单号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 调价品种数 + */ + @ExcelProperty("调价品种数") + private Integer productNum; + + /** + * 库存调价差额 + */ + @ExcelProperty("库存调价差额") + private BigDecimal diffAmount; + + /** + * 修改时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("操作时间") + private Date updateTime; + + /** + * 修改人 + */ + @ExcelProperty("操作人") + private String updateBy; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 审核时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("审核时间") + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public StockCostAdjustSheetExportModel(StockCostAdjustSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(StockCostAdjustSheet dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(StockCostAdjustSheet dto) { + + this.status = dto.getStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportModel.java new file mode 100644 index 0000000..476cbf9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/plan/TakeStockPlanExportModel.java @@ -0,0 +1,146 @@ +package com.lframework.xingyun.sc.excel.stock.take.plan; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.ProductBrand; +import com.lframework.xingyun.basedata.entity.ProductCategory; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.product.ProductBrandService; +import com.lframework.xingyun.basedata.service.product.ProductCategoryService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import java.util.Date; +import lombok.Data; + +@Data +public class TakeStockPlanExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 盘点类别 + */ + @ExcelProperty("盘点类别") + private String takeType; + + /** + * 业务名称 + */ + @ExcelProperty("业务名称") + private String bizName; + + /** + * 盘点状态 + */ + @ExcelProperty("盘点状态") + private String takeStatus; + + /** + * 创建时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("创建时间") + private Date createTime; + + /** + * 创建人 + */ + @ExcelProperty("创建人") + private String createBy; + + /** + * 操作时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("操作时间") + private Date updateTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String updateBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public TakeStockPlanExportModel(TakeStockPlan dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockPlan dto) { + + return super.convert(dto, TakeStockPlanExportModel::getTakeStatus, TakeStockPlanExportModel::getTakeType); + } + + @Override + protected void afterInit(TakeStockPlan dto) { + + this.takeType = dto.getTakeType().getDesc(); + this.takeStatus = dto.getTakeStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + String bizId = dto.getBizId(); + if (dto.getTakeType() == TakeStockPlanType.CATEGORY) { + ProductCategoryService productCategoryService = ApplicationUtil.getBean( + ProductCategoryService.class); + String[] categoryIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String categoryId : categoryIds) { + ProductCategory productCategory = productCategoryService.findById(categoryId); + builder.append(productCategory.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } else if (dto.getTakeType() == TakeStockPlanType.BRAND) { + ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class); + String[] brandIds = bizId.split(","); + StringBuilder builder = new StringBuilder(); + for (String brandId : brandIds) { + ProductBrand productBrand = productBrandService.findById(brandId); + builder.append(productBrand.getName()).append(StringPool.STR_SPLIT_CN); + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 1); + } + + this.bizName = builder.toString(); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportModel.java new file mode 100644 index 0000000..1960bac --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/pre/PreTakeStockSheetExportModel.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.sc.excel.stock.take.pre; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.template.core.service.UserService; +import java.util.Date; +import lombok.Data; + +@Data +public class PreTakeStockSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 盘点状态 + */ + @ExcelProperty("盘点状态") + private String takeStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 操作时间 + */ + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + @ExcelProperty("操作时间") + private Date updateTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String updateBy; + + public PreTakeStockSheetExportModel(PreTakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(PreTakeStockSheet dto) { + + return super.convert(dto, PreTakeStockSheetExportModel::getTakeStatus, + PreTakeStockSheetExportModel::getUpdateTime); + } + + @Override + protected void afterInit(PreTakeStockSheet dto) { + + this.takeStatus = dto.getTakeStatus().getDesc(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + this.updateTime = DateUtil.toDate(dto.getUpdateTime()); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportModel.java new file mode 100644 index 0000000..7c29acb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/take/sheet/TakeStockSheetExportModel.java @@ -0,0 +1,136 @@ +package com.lframework.xingyun.sc.excel.stock.take.sheet; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.template.core.service.UserService; +import java.util.Date; +import lombok.Data; + +@Data +public class TakeStockSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 盘点任务号 + */ + @ExcelProperty("关联盘点任务") + private String planCode; + + /** + * 盘点任务-盘点状态 + */ + @ExcelProperty("盘点状态") + private String takeStatus; + + /** + * 仓库编号 + */ + @ExcelProperty("仓库编号") + private String scCode; + + /** + * 仓库名称 + */ + @ExcelProperty("仓库名称") + private String scName; + + /** + * 盘点任务-盘点类别 + */ + @ExcelProperty("盘点类别") + private String takeType; + + /** + * 状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 修改时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date updateTime; + + /** + * 修改人 + */ + @ExcelProperty("操作人") + private String updateBy; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public TakeStockSheetExportModel(TakeStockSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(TakeStockSheet dto) { + + return super.convert(dto, TakeStockSheetExportModel::getTakeStatus, TakeStockSheetExportModel::getStatus, + TakeStockSheetExportModel::getUpdateTime, TakeStockSheetExportModel::getApproveTime); + } + + @Override + protected void afterInit(TakeStockSheet dto) { + + this.status = dto.getStatus().getDesc(); + + TakeStockPlanService takeStockPlanService = ApplicationUtil.getBean(TakeStockPlanService.class); + TakeStockPlan takeStockPlan = takeStockPlanService.getById(dto.getPlanId()); + + this.planCode = takeStockPlan.getCode(); + this.takeStatus = takeStockPlan.getTakeStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sc = storeCenterService.findById(dto.getScId()); + this.scCode = sc.getCode(); + this.scName = sc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.takeType = takeStockPlan.getTakeType().getDesc(); + + this.updateTime = DateUtil.toDate(dto.getUpdateTime()); + this.approveTime = DateUtil.toDate(dto.getApproveTime()); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportModel.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportModel.java new file mode 100644 index 0000000..aade735 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/excel/stock/transfer/ScTransferOrderExportModel.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.sc.excel.stock.transfer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import com.lframework.xingyun.template.core.service.UserService; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class ScTransferOrderExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 转出仓库编号 + */ + @ExcelProperty("转出仓库编号") + private String sourceScCode; + + /** + * 转出仓库名称 + */ + @ExcelProperty("转出仓库名称") + private String sourceScName; + + /** + * 转入仓库编号 + */ + @ExcelProperty("转入仓库编号") + private String targetScCode; + + /** + * 转入仓库名称 + */ + @ExcelProperty("转入仓库名称") + private String targetScName; + + /** + * 调拨数量 + */ + @ExcelProperty("调拨数量") + private Integer totalNum; + + /** + * 调拨成本金额 + */ + @ExcelProperty("调拨成本金额") + private BigDecimal totalAmount; + + /** + * 状态 + */ + @ExcelProperty("状态") + private String status; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + /** + * 修改人 + */ + @ExcelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ExcelProperty("修改时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date updateTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + public ScTransferOrderExportModel(ScTransferOrder dto) { + + super(dto); + } + + @Override + public BaseBo convert(ScTransferOrder dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(ScTransferOrder dto) { + + this.status = dto.getStatus().getDesc(); + + StoreCenterService storeCenterService = ApplicationUtil.getBean(StoreCenterService.class); + StoreCenter sourceSc = storeCenterService.findById(dto.getSourceScId()); + this.sourceScCode = sourceSc.getCode(); + this.sourceScName = sourceSc.getName(); + + StoreCenter targetSc = storeCenterService.findById(dto.getTargetScId()); + this.targetScCode = targetSc.getCode(); + this.targetScName = targetSc.getName(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (dto.getStatus() != ScTransferOrderStatus.APPROVE_PASS + && dto.getStatus() != ScTransferOrderStatus.PART_RECEIVED + && dto.getStatus() != ScTransferOrderStatus.RECEIVED) { + this.totalAmount = null; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/filter/RequestLoggingFilter.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/filter/RequestLoggingFilter.java new file mode 100644 index 0000000..741c86b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/filter/RequestLoggingFilter.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.sc.filter; + +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import javax.servlet.annotation.WebFilter; +import javax.servlet.annotation.WebInitParam; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.ServletException; +import java.io.IOException; + +@WebFilter(urlPatterns = "/*") +public class RequestLoggingFilter implements Filter { + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + // 初始化代码(如果需要) + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + HttpServletRequest httpRequest = (HttpServletRequest) request; + + // 获取请求的协议 + String scheme = httpRequest.getScheme(); + + // 获取请求的URL + String requestURI = httpRequest.getRequestURI(); + + // 获取请求的方法 + String method = httpRequest.getMethod(); + + // 打印信息 + System.out.println("Scheme: " + scheme); + System.out.println("Request URI: " + requestURI); + System.out.println("Method: " + method); + + // 继续执行过滤链 + chain.doFilter(request, response); + } + + @Override + public void destroy() { + // 清理代码(如果需要) + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetDetailServiceImpl.java new file mode 100644 index 0000000..04807f9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetDetailServiceImpl.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.sc.impl.logistics; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.mappers.LogisticsSheetDetailMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class LogisticsSheetDetailServiceImpl extends + BaseMpServiceImpl implements + LogisticsSheetDetailService { + + @Override + public LogisticsSheetDetail getByBizId(String bizId, LogisticsSheetDetailBizType bizType) { + Wrapper queryWrapper = Wrappers.lambdaQuery(LogisticsSheetDetail.class) + .eq(LogisticsSheetDetail::getBizId, bizId).eq(LogisticsSheetDetail::getBizType, bizType); + return this.getOne(queryWrapper); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetServiceImpl.java new file mode 100644 index 0000000..f4e47a3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/logistics/LogisticsSheetServiceImpl.java @@ -0,0 +1,278 @@ +package com.lframework.xingyun.sc.impl.logistics; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.LogisticsSheetMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetService; +import com.lframework.xingyun.sc.vo.logistics.CreateLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.DeliveryLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetSelectorVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetBizOrderVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.UpdateLogisticsSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class LogisticsSheetServiceImpl extends + BaseMpServiceImpl implements LogisticsSheetService { + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private LogisticsSheetDetailService logisticsSheetDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryLogisticsSheetVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryLogisticsSheetVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + LogisticsSheetSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public LogisticsSheetFullDto getDetail(String id) { + LogisticsSheetFullDto sheet = getBaseMapper().getDetail(id); + if (sheet == null) { + throw new InputErrorException("物流单不存在!"); + } + + return sheet; + } + + @Override + public PageResult queryBizOrder(Integer pageIndex, Integer pageSize, + QueryLogisticsSheetBizOrderVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryBizOrder(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = ScOpLogType.LOGISTICS, name = "创建物流单,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateLogisticsSheetVo vo) { + LogisticsSheet sheet = new LogisticsSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.LOGISTICS_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(LogisticsSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = ScOpLogType.LOGISTICS, name = "修改物流单,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateLogisticsSheetVo vo) { + LogisticsSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("物流单不存在!"); + } + + if (sheet.getStatus() != LogisticsSheetStatus.CREATED) { + throw new DefaultClientException("物流单已发货,无法修改!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + LogisticsSheetDetail.class).eq(LogisticsSheetDetail::getSheetId, sheet.getId()); + logisticsSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(LogisticsSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(LogisticsSheetStatus.CREATED); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(LogisticsSheet.class) + .eq(LogisticsSheet::getId, sheet.getId()).in(LogisticsSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("物流单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.LOGISTICS, name = "物流单发货,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public void delivery(DeliveryLogisticsSheetVo vo) { + + LogisticsSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("物流单不存在!"); + } + + if (sheet.getStatus() != LogisticsSheetStatus.CREATED) { + throw new DefaultClientException("物流单已发货,无法重复发货!"); + } + + List statusList = new ArrayList<>(); + statusList.add(LogisticsSheetStatus.CREATED); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(LogisticsSheet.class) + .set(LogisticsSheet::getDeliveryBy, SecurityUtil.getCurrentUser().getId()) + .set(LogisticsSheet::getDeliveryTime, LocalDateTime.now()) + .set(StringUtil.isNotBlank(vo.getLogisticsNo()), LogisticsSheet::getLogisticsNo, + vo.getLogisticsNo()) + .set(vo.getTotalAmount() != null, LogisticsSheet::getTotalAmount, vo.getTotalAmount()) + .set(LogisticsSheet::getStatus, LogisticsSheetStatus.DELIVERY) + .eq(LogisticsSheet::getId, sheet.getId()).in(LogisticsSheet::getStatus, statusList); + if (getBaseMapper().update(updateOrderWrapper) != 1) { + throw new DefaultClientException("物流单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.LOGISTICS, name = "删除物流单,单号:{}", params = "#code") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + LogisticsSheet order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("物流单不存在!"); + } + + if (order.getStatus() != LogisticsSheetStatus.CREATED) { + throw new DefaultClientException("已发货的物流单不允许执行删除操作!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + LogisticsSheetDetail.class).eq(LogisticsSheetDetail::getSheetId, order.getId()); + logisticsSheetDetailService.remove(deleteDetailWrapper); + + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", order.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + LogisticsSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个物流单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + private void create(LogisticsSheet sheet, CreateLogisticsSheetVo vo) { + sheet.setLogisticsNo(vo.getLogisticsNo()); + sheet.setLogisticsCompanyId(vo.getLogisticsCompanyId()); + sheet.setSenderName(vo.getSenderName()); + sheet.setSenderTelephone(vo.getSenderTelephone()); + sheet.setSenderProvinceId(vo.getSenderProvinceId()); + sheet.setSenderCityId(vo.getSenderCityId()); + sheet.setSenderDistrictId(vo.getSenderDistrictId()); + sheet.setSenderAddress(vo.getSenderAddress()); + sheet.setReceiverName(vo.getReceiverName()); + sheet.setReceiverTelephone(vo.getReceiverTelephone()); + sheet.setReceiverProvinceId(vo.getReceiverProvinceId()); + sheet.setReceiverCityId(vo.getReceiverCityId()); + sheet.setReceiverDistrictId(vo.getReceiverDistrictId()); + sheet.setReceiverAddress(vo.getReceiverAddress()); + sheet.setTotalWeight(vo.getTotalWeight()); + sheet.setTotalVolume(vo.getTotalVolume()); + sheet.setTotalAmount(vo.getTotalAmount()); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + List details = vo.getBizOrders().stream().map(t -> { + LogisticsSheetDetail detail = new LogisticsSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(t.getBizId()); + detail.setBizType(EnumUtil.getByCode(LogisticsSheetDetailBizType.class, t.getBizType())); + + return detail; + }).collect(Collectors.toList()); + + logisticsSheetDetailService.saveBatch(details); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/paytype/OrderPayTypeServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/paytype/OrderPayTypeServiceImpl.java new file mode 100644 index 0000000..5f3289c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/paytype/OrderPayTypeServiceImpl.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.sc.impl.paytype; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.mappers.OrderPayTypeMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class OrderPayTypeServiceImpl extends + BaseMpServiceImpl implements OrderPayTypeService { + + @Transactional(rollbackFor = Exception.class) + @Override + public void create(String orderId, List data) { + Wrapper deleteOrderPayTypeWrapper = Wrappers.lambdaQuery(OrderPayType.class) + .eq(OrderPayType::getOrderId, orderId); + this.remove(deleteOrderPayTypeWrapper); + if (CollectionUtil.isNotEmpty(data)) { + List records = data.stream().map(payTypeVo -> { + OrderPayType orderPayType = new OrderPayType(); + orderPayType.setId(IdUtil.getId()); + orderPayType.setOrderId(orderId); + orderPayType.setPayTypeId(payTypeVo.getId()); + orderPayType.setPayAmount(payTypeVo.getPayAmount()); + if (StringUtil.isNotBlank(payTypeVo.getText())) { + orderPayType.setText(payTypeVo.getText()); + } + + return orderPayType; + }).collect(Collectors.toList()); + this.saveBatch(records); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByOrderId(String orderId) { + Wrapper deleteOrderPayTypeWrapper = Wrappers.lambdaQuery(OrderPayType.class) + .eq(OrderPayType::getOrderId, orderId); + this.remove(deleteOrderPayTypeWrapper); + } + + @Override + public List findByOrderId(String orderId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(OrderPayType.class) + .eq(OrderPayType::getOrderId, orderId); + return this.list(queryWrapper); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseConfigServiceImpl.java new file mode 100644 index 0000000..e3ed26d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseConfigServiceImpl.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.PurchaseConfigMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.vo.purchase.config.UpdatePurchaseConfigVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class PurchaseConfigServiceImpl extends + BaseMpServiceImpl + implements PurchaseConfigService { + + @Cacheable(value = PurchaseConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public PurchaseConfig get() { + + PurchaseConfig config = getBaseMapper().selectOne(Wrappers.query()); + + return config; + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "修改采购参数设置") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePurchaseConfigVo vo) { + + PurchaseConfig config = getBaseMapper().selectOne(Wrappers.query()); + config.setReceiveRequirePurchase(vo.getReceiveRequirePurchase()); + config.setReceiveMultipleRelatePurchase(vo.getReceiveMultipleRelatePurchase()); + config.setPurchaseReturnRequireReceive(vo.getPurchaseReturnRequireReceive()); + config.setPurchaseReturnMultipleRelateReceive(vo.getPurchaseReturnMultipleRelateReceive()); + + getBaseMapper().updateById(config); + + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = PurchaseConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailServiceImpl.java new file mode 100644 index 0000000..b561114 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderDetailServiceImpl.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.mappers.PurchaseOrderDetailMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class PurchaseOrderDetailServiceImpl extends + BaseMpServiceImpl + implements PurchaseOrderDetailService { + + @Autowired + private ProductService productService; + + @Override + public List getByOrderId(String orderId) { + + return getBaseMapper().getByOrderId(orderId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReceiveNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + PurchaseOrderDetail orderDetail = getBaseMapper().selectById(id); + + Integer remainNum = NumberUtil.sub(orderDetail.getOrderNum(), orderDetail.getReceiveNum()) + .intValue(); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余收货数量为" + remainNum + + "个,本次收货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReceiveNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余收货数量不足,不允许继续收货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReceiveNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + PurchaseOrderDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReceiveNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已收货数量为" + orderDetail.getReceiveNum() + + "个,本次取消收货数量不允许大于" + orderDetail.getReceiveNum() + "个!"); + } + + if (getBaseMapper().subReceiveNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已收货数量不足,不允许取消收货!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderServiceImpl.java new file mode 100644 index 0000000..db66c33 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseOrderServiceImpl.java @@ -0,0 +1,841 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import cn.hutool.core.lang.Dict; +import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.security.UserDetailsService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.events.order.impl.ApprovePassPurchaseOrderEvent; +import com.lframework.xingyun.core.service.OrderTimeLineService; +import com.lframework.xingyun.sc.bo.purchase.GetPurchaseOrderBo; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.PurchaseOrderMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.utils.WebUtils; +import com.lframework.xingyun.sc.vo.purchase.*; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import net.minidev.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class PurchaseOrderServiceImpl extends BaseMpServiceImpl + implements PurchaseOrderService { + + @Autowired + private PurchaseOrderDetailService purchaseOrderDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private UserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Autowired + private UserDetailsService userDetailsService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryPurchaseOrderVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPurchaseOrderVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + PurchaseOrderSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public PurchaseOrderFullDto getDetail(String id) { + + PurchaseOrderFullDto order = getBaseMapper().getDetail(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + return order; + } + + @Override + public PurchaseOrderWithReceiveDto getWithReceive(String id) { + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + PurchaseOrderWithReceiveDto order = getBaseMapper().getWithReceive(id, + purchaseConfig.getReceiveRequirePurchase()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + return order; + } + + @Override + public PageResult queryWithReceive(Integer pageIndex, Integer pageSize, + QueryPurchaseOrderWithReceiveVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReceive(vo, + purchaseConfig.getReceiveMultipleRelatePurchase()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "创建订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建订单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePurchaseOrderVo vo) { + + PurchaseOrder order = new PurchaseOrder(); + order.setId(IdUtil.getId()); + order.setCode(generateCodeService.generate(GenerateCodeTypePool.PURCHASE_ORDER)); + + this.create(order, vo); + + order.setStatus(PurchaseOrderStatus.CREATED); + + getBaseMapper().insert(order); + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + return order.getId(); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "修改订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改订单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePurchaseOrderVo vo) { + + PurchaseOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED + && order.getStatus() != PurchaseOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,无法修改!"); + } + + throw new DefaultClientException("订单无法修改!"); + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetail.class) + .eq(PurchaseOrderDetail::getOrderId, order.getId()); + purchaseOrderDetailService.remove(deleteDetailWrapper); + + this.create(order, vo); + + order.setStatus(PurchaseOrderStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseOrderStatus.CREATED); + statusList.add(PurchaseOrderStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(PurchaseOrder.class) + .set(PurchaseOrder::getApproveBy, null).set(PurchaseOrder::getApproveTime, null) + .set(PurchaseOrder::getRefuseReason, StringPool.EMPTY_STR) + .eq(PurchaseOrder::getId, order.getId()) + .in(PurchaseOrder::getStatus, statusList); + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "审核通过订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassPurchaseOrderVo vo) { + + PurchaseOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED + && order.getStatus() != PurchaseOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核通过!"); + } + + order.setStatus(PurchaseOrderStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseOrderStatus.CREATED); + statusList.add(PurchaseOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrder.class) + .set(PurchaseOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseOrder::getApproveTime, LocalDateTime.now()) + .eq(PurchaseOrder::getId, order.getId()) + .in(PurchaseOrder::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(PurchaseOrder::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(order.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有约定支付,请检查!"); + } + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + this.sendApprovePassEvent(order); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Override + public void batchApprovePass(BatchApprovePassPurchaseOrderVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassPurchaseOrderVo approvePassPurchaseOrderVo = new ApprovePassPurchaseOrderVo(); + approvePassPurchaseOrderVo.setId(id); + + try { + PurchaseOrderService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassPurchaseOrderVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个采购订单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Override + public String directApprovePass(CreatePurchaseOrderVo vo) { + + PurchaseOrderService thisService = getThis(this.getClass()); + + String orderId = thisService.create(vo); + + ApprovePassPurchaseOrderVo approvePassPurchaseOrderVo = new ApprovePassPurchaseOrderVo(); + approvePassPurchaseOrderVo.setId(orderId); + approvePassPurchaseOrderVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassPurchaseOrderVo); + + return orderId; + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "审核拒绝订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefusePurchaseOrderVo vo) { + + PurchaseOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_REFUSE) { + throw new DefaultClientException("订单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核拒绝!"); + } + + order.setStatus(PurchaseOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrder.class) + .set(PurchaseOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseOrder::getApproveTime, LocalDateTime.now()) + .set(PurchaseOrder::getRefuseReason, vo.getRefuseReason()) + .eq(PurchaseOrder::getId, order.getId()) + .eq(PurchaseOrder::getStatus, PurchaseOrderStatus.CREATED); + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Override + public void batchApproveRefuse(BatchApproveRefusePurchaseOrderVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefusePurchaseOrderVo approveRefusePurchaseOrderVo = new ApproveRefusePurchaseOrderVo(); + approveRefusePurchaseOrderVo.setId(id); + approveRefusePurchaseOrderVo.setRefuseReason(vo.getRefuseReason()); + + try { + PurchaseOrderService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefusePurchaseOrderVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个采购订单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "删除订单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + PurchaseOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED + && order.getStatus() != PurchaseOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的采购单据不允许执行删除操作!"); + } + + throw new DefaultClientException("订单无法删除!"); + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseOrderDetail.class) + .eq(PurchaseOrderDetail::getOrderId, order.getId()); + purchaseOrderDetailService.remove(deleteDetailWrapper); + + // 删除订单 + getBaseMapper().deleteById(id); + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", order.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + PurchaseOrderService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个采购订单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "取消审核订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CANCEL_APPROVE, orderId = "#id", name = "取消审核") + @Transactional(rollbackFor = Exception.class) + @Override + public void cancelApprovePass(String id) { + + Assert.notBlank(id); + + PurchaseOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.APPROVE_PASS) { + + throw new DefaultClientException("订单尚未审核通过,无需取消审核!"); + } + + order.setStatus(PurchaseOrderStatus.CREATED); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(PurchaseOrder.class) + .set(PurchaseOrder::getApproveBy, null).set(PurchaseOrder::getApproveTime, null) + .set(PurchaseOrder::getRefuseReason, StringPool.EMPTY_STR) + .eq(PurchaseOrder::getId, order.getId()) + .eq(PurchaseOrder::getStatus, PurchaseOrderStatus.APPROVE_PASS); + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + } + + private void create(PurchaseOrder order, CreatePurchaseOrderVo vo) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + order.setScId(vo.getScId()); + + Supplier supplier = supplierService.findById(vo.getSupplierId()); + if (supplier == null) { + throw new InputErrorException("供应商不存在!"); + } + order.setSupplierId(vo.getSupplierId()); + + if (!StringUtil.isBlank(vo.getPurchaserId())) { + UserDto purchaser = userService.findById(vo.getPurchaserId()); + if (purchaser == null) { + throw new InputErrorException("采购员不存在!"); + } + + order.setPurchaserId(vo.getPurchaserId()); + } + + order.setExpectArriveDate(vo.getExpectArriveDate()); + + int purchaseNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (PurchaseProductVo productVo : vo.getProducts()) { + + boolean isGift = productVo.getPurchasePrice().doubleValue() == 0D; + + if (isGift) { + giftNum += productVo.getPurchaseNum(); + } else { + purchaseNum += productVo.getPurchaseNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getPurchasePrice(), productVo.getPurchaseNum())); + + PurchaseOrderDetail orderDetail = new PurchaseOrderDetail(); + orderDetail.setId(IdUtil.getId()); + orderDetail.setOrderId(order.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getPurchasePrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许2位小数!"); + } + + orderDetail.setProductId(productVo.getProductId()); + orderDetail.setOrderNum(productVo.getPurchaseNum()); + orderDetail.setTaxPrice(productVo.getPurchasePrice()); + orderDetail.setIsGift(isGift); + orderDetail.setTaxRate(product.getTaxRate()); + orderDetail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + orderDetail.setOrderNo(orderNo); + + purchaseOrderDetailService.save(orderDetail); + orderNo++; + } + order.setTotalNum(purchaseNum); + order.setTotalGiftNum(giftNum); + order.setTotalAmount(totalAmount); + order.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + orderPayTypeService.create(order.getId(), vo.getPayTypes()); + } + + @Override + public PageResult queryPurchaseByCondition(Integer pageIndex, + Integer pageSize, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPurchaseByCondition(condition); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryPurchaseList(Integer pageIndex, Integer pageSize, + QueryPurchaseProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPurchaseList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PurchaseProductDto getPurchaseById(String id) { + + PurchaseProductDto data = getBaseMapper().getPurchaseById(id); + + return data; + } + + private void sendApprovePassEvent(PurchaseOrder order) { + + ApprovePassPurchaseOrderEvent event = new ApprovePassPurchaseOrderEvent(this); + event.setId(order.getId()); + event.setTotalAmount(order.getTotalAmount()); + event.setApproveTime(order.getApproveTime()); + + ApplicationUtil.publishEvent(event); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void approve(YdoolApproveOrderVo vo) { + String status = vo.getStatus(); + if ("y".equals(status)) { + this.approvePass(vo.getId(), vo.getMsg()); + } else { + this.approveRefuse(vo.getId(), vo.getMsg()); + } + } + + + @OpLog(type = ScOpLogType.PURCHASE, name = "发送采购订单审批流程给ydool系统,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_SEND, orderId = "#id", name = "发送采购订单审批流程给ydool系统") + @Transactional(rollbackFor = Exception.class) + @Override + public InvokeResult sendApprove(String id) { + PurchaseOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new DefaultClientException("采购订单不存在!"); + } + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("采购订单已审核通过,无需再次审核!"); + } + if (order.getStatus() == PurchaseOrderStatus.APPROVE_ING) { + throw new DefaultClientException("采购订单正在审核中,请勿重复推送"); + } + //获取订单详情 + PurchaseOrderFullDto data = this.getDetail(id); + GetPurchaseOrderBo bo = new GetPurchaseOrderBo(data); + //获取发起人编号 + String purchaserCode = bo.getPurchaserCode(); + if (StringUtil.isBlank(purchaserCode)) { + throw new DefaultClientException("采购员不存在,无法发起审核!"); + } + //封装参数 + List details = bo.getDetails(); + //将商品编号、商品名称、库存数量、采购数量、采购含税金额从details中提取出来 + List list = details.stream().map(detail -> { + //将商品编号、商品名称、库存数量、采购数量、采购含税金额从detail中提取并返回 + return Dict.create() + .set("goods_number", detail.getProductCode()) + .set("goods_name", detail.getProductName()) + .set("inventory", detail.getStockNum()) + .set("number", detail.getPurchaseNum()) + .set("money", new BigDecimal(detail.getPurchaseNum()).multiply(detail.getPurchasePrice())); + }).collect(Collectors.toList()); + Dict dict = Dict.create(); + dict.set("user_id", purchaserCode) + .set("order_id", id) + .set("all_money", bo.getTotalAmount()) + .set("supplyer", bo.getSupplierName()) + .set("audit_person_ids", "120,262") + .set("push_person_ids", "120,262") + .set("remark", bo.getDescription()) + .set("ghd_goodlist_info", list); + + String jsonString = JSONObject.toJSONString(dict); + String json = HttpUtil.post("https://nb.ydool.com/api/ydoolerp/erp_ajax.ashx/send_gwd", jsonString); + // 修改订单状态 + order.setStatus(PurchaseOrderStatus.APPROVE_ING); + int update = getBaseMapper().updateById(order); + InvokeResult success = InvokeResultBuilder.success(); + success.setMsg(jsonString); + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setVariable("id", id); + OpLogUtil.setExtra(dict); + return update > 0 ? success : InvokeResultBuilder.fail(jsonString); + } + + @Override + public PurchaseProductDto queryPurchaseBySku(String sku) { + return getBaseMapper().queryPurchaseBySku(sku); + } + + @Transactional(rollbackFor = Exception.class) + public void approvePass(String id, String description) { + PurchaseOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != PurchaseOrderStatus.APPROVE_ING) { + throw new DefaultClientException("订单无法审核通过!"); + } + + if (order.getStatus() != PurchaseOrderStatus.CREATED + && order.getStatus() != PurchaseOrderStatus.APPROVE_ING + && order.getStatus() != PurchaseOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核通过!"); + } + + order.setStatus(PurchaseOrderStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseOrderStatus.APPROVE_ING); + + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrder.class) + .set(PurchaseOrder::getApproveBy, user.getId()) + .set(PurchaseOrder::getApproveTime, LocalDateTime.now()) + .eq(PurchaseOrder::getId, order.getId()) + .in(PurchaseOrder::getStatus, statusList); + if (!StringUtil.isBlank(description)) { + updateOrderWrapper.set(PurchaseOrder::getDescription, description); + } + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(order.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有约定支付,请检查!"); + } + } + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApprovePassPurchaseOrderVo vo = new ApprovePassPurchaseOrderVo(); + vo.setId(id); + vo.setDescription(description); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核通过采购订单,单号:%s", order.getCode())); + opLogs.setLogType(ScOpLogType.PURCHASE); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(order.getId()); + orderTimeLine.setContent("审核通过"); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_PASS); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + + + this.sendApprovePassEvent(order); + } + + @Transactional(rollbackFor = Exception.class) + public void approveRefuse(String id, String refuseReason) { + if (StringUtil.isBlank(refuseReason)) { + throw new InputErrorException("请输入拒绝理由!"); + } + PurchaseOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + + if (order.getStatus() != PurchaseOrderStatus.APPROVE_ING) { + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + if (order.getStatus() == PurchaseOrderStatus.APPROVE_REFUSE) { + throw new DefaultClientException("订单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核拒绝!"); + } + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + order.setStatus(PurchaseOrderStatus.APPROVE_REFUSE); + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseOrder.class) + .set(PurchaseOrder::getApproveBy, user.getId()) + .set(PurchaseOrder::getApproveTime, LocalDateTime.now()) + .set(PurchaseOrder::getRefuseReason, refuseReason) + .eq(PurchaseOrder::getId, order.getId()) + .eq(PurchaseOrder::getStatus, PurchaseOrderStatus.APPROVE_ING); + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApproveRefusePurchaseOrderVo vo = new ApproveRefusePurchaseOrderVo(); + vo.setId(id); + vo.setRefuseReason(refuseReason); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核拒绝采购订单,单号:%s", order.getCode())); + opLogs.setLogType(ScOpLogType.PURCHASE); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(order.getId()); + orderTimeLine.setContent(String.format("审核拒绝,拒绝理由:%s", refuseReason)); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_RETURN); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnDetailServiceImpl.java new file mode 100644 index 0000000..76f265d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PurchaseReturnDetail; +import com.lframework.xingyun.sc.mappers.PurchaseReturnDetailMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnDetailService; +import org.springframework.stereotype.Service; + +@Service +public class PurchaseReturnDetailServiceImpl extends + BaseMpServiceImpl + implements PurchaseReturnDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnServiceImpl.java new file mode 100644 index 0000000..9b697d0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/PurchaseReturnServiceImpl.java @@ -0,0 +1,669 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.events.order.impl.ApprovePassPurchaseReturnEvent; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.entity.PurchaseReturnDetail; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.mappers.PurchaseReturnMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnDetailService; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.purchase.returned.ApprovePassPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.ApproveRefusePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.BatchApprovePassPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.BatchApproveRefusePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.CreatePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.QueryPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.ReturnProductVo; +import com.lframework.xingyun.sc.vo.purchase.returned.UpdatePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class PurchaseReturnServiceImpl extends + BaseMpServiceImpl + implements PurchaseReturnService { + + @Autowired + private PurchaseReturnDetailService purchaseReturnDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private UserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + @Autowired + private ReceiveSheetDetailService receiveSheetDetailService; + + @Autowired + private ProductStockService productStockService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryPurchaseReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPurchaseReturnVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PurchaseReturnFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "创建采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建退单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = new PurchaseReturn(); + purchaseReturn.setId(IdUtil.getId()); + purchaseReturn.setCode(generateCodeService.generate(GenerateCodeTypePool.PURCHASE_RETURN)); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + this.create(purchaseReturn, vo, purchaseConfig.getPurchaseReturnRequireReceive()); + + purchaseReturn.setStatus(PurchaseReturnStatus.CREATED); + + getBaseMapper().insert(purchaseReturn); + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + + return purchaseReturn.getId(); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "修改采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改退单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = getBaseMapper().selectById(vo.getId()); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED + && purchaseReturn.getStatus() != PurchaseReturnStatus.APPROVE_REFUSE) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("采购退货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("采购退货单无法修改!"); + } + + boolean requireReceive = !StringUtil.isBlank(purchaseReturn.getReceiveSheetId()); + + if (requireReceive) { + //查询采购退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + List details = purchaseReturnDetailService.list(queryDetailWrapper); + for (PurchaseReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getReceiveSheetDetailId())) { + //先恢复已退货数量 + receiveSheetDetailService.subReturnNum(detail.getReceiveSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除采购退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + purchaseReturnDetailService.remove(deleteDetailWrapper); + + this.create(purchaseReturn, vo, requireReceive); + + purchaseReturn.setStatus(PurchaseReturnStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseReturnStatus.CREATED); + statusList.add(PurchaseReturnStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getApproveBy, null).set(PurchaseReturn::getApproveTime, null) + .set(PurchaseReturn::getRefuseReason, StringPool.EMPTY_STR) + .eq(PurchaseReturn::getId, purchaseReturn.getId()) + .in(PurchaseReturn::getStatus, statusList); + if (getBaseMapper().updateAllColumn(purchaseReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "审核通过采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassPurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = getBaseMapper().selectById(vo.getId()); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED + && purchaseReturn.getStatus() != PurchaseReturnStatus.APPROVE_REFUSE) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("采购退货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购退货单无法审核通过!"); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getPurchaseReturnMultipleRelateReceive()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(PurchaseReturn.class) + .eq(PurchaseReturn::getReceiveSheetId, purchaseReturn.getReceiveSheetId()) + .ne(PurchaseReturn::getId, purchaseReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + ReceiveSheet receiveSheet = receiveSheetService.getById(purchaseReturn.getReceiveSheetId()); + throw new DefaultClientException( + "采购收货单号:" + receiveSheet.getCode() + ",已关联其他采购退货单,不允许关联多个采购退货单!"); + } + } + + purchaseReturn.setStatus(PurchaseReturnStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(PurchaseReturnStatus.CREATED); + statusList.add(PurchaseReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseReturn.class) + .set(PurchaseReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseReturn::getApproveTime, LocalDateTime.now()) + .eq(PurchaseReturn::getId, purchaseReturn.getId()) + .in(PurchaseReturn::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(PurchaseReturn::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(purchaseReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购退货单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()) + .orderByAsc(PurchaseReturnDetail::getOrderNo); + List details = purchaseReturnDetailService.list(queryDetailWrapper); + for (PurchaseReturnDetail detail : details) { + SubProductStockVo subproductStockVo = new SubProductStockVo(); + + subproductStockVo.setProductId(detail.getProductId()); + subproductStockVo.setScId(purchaseReturn.getScId()); + subproductStockVo.setStockNum(detail.getReturnNum()); + subproductStockVo.setTaxAmount(NumberUtil.mul(detail.getTaxPrice(), detail.getReturnNum())); + subproductStockVo.setBizId(purchaseReturn.getId()); + subproductStockVo.setBizDetailId(detail.getId()); + subproductStockVo.setBizCode(purchaseReturn.getCode()); + subproductStockVo.setBizType(ProductStockBizType.PURCHASE_RETURN.getCode()); + + productStockService.subStock(subproductStockVo); + } + + this.sendApprovePassEvent(purchaseReturn); + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassPurchaseReturnVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassPurchaseReturnVo approvePassVo = new ApprovePassPurchaseReturnVo(); + approvePassVo.setId(id); + + try { + PurchaseReturnService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个采购退货单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreatePurchaseReturnVo vo) { + + PurchaseReturnService thisService = getThis(this.getClass()); + + String returnId = thisService.create(vo); + + ApprovePassPurchaseReturnVo approvePassVo = new ApprovePassPurchaseReturnVo(); + approvePassVo.setId(returnId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return returnId; + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "审核拒绝采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefusePurchaseReturnVo vo) { + + PurchaseReturn purchaseReturn = getBaseMapper().selectById(vo.getId()); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("采购退货单已审核通过,不允许继续执行审核!"); + } + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_REFUSE) { + throw new DefaultClientException("采购退货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购退货单无法审核拒绝!"); + } + + purchaseReturn.setStatus(PurchaseReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + PurchaseReturn.class) + .set(PurchaseReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(PurchaseReturn::getApproveTime, LocalDateTime.now()) + .set(PurchaseReturn::getRefuseReason, vo.getRefuseReason()) + .eq(PurchaseReturn::getId, purchaseReturn.getId()) + .eq(PurchaseReturn::getStatus, PurchaseReturnStatus.CREATED); + if (getBaseMapper().updateAllColumn(purchaseReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefusePurchaseReturnVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefusePurchaseReturnVo approveRefuseVo = new ApproveRefusePurchaseReturnVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + PurchaseReturnService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个采购退货单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "删除采购退货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + PurchaseReturn purchaseReturn = getBaseMapper().selectById(id); + if (purchaseReturn == null) { + throw new InputErrorException("采购退货单不存在!"); + } + + if (purchaseReturn.getStatus() != PurchaseReturnStatus.CREATED + && purchaseReturn.getStatus() != PurchaseReturnStatus.APPROVE_REFUSE) { + + if (purchaseReturn.getStatus() == PurchaseReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的采购退货单不允许执行删除操作!"); + } + + throw new DefaultClientException("采购退货单无法删除!"); + } + + if (!StringUtil.isBlank(purchaseReturn.getReceiveSheetId())) { + //查询采购退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + List details = purchaseReturnDetailService.list(queryDetailWrapper); + for (PurchaseReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getReceiveSheetDetailId())) { + //恢复已退货数量 + receiveSheetDetailService.subReturnNum(detail.getReceiveSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PurchaseReturnDetail.class) + .eq(PurchaseReturnDetail::getReturnId, purchaseReturn.getId()); + purchaseReturnDetailService.remove(deleteDetailWrapper); + + // 删除退货单 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", purchaseReturn.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + PurchaseReturnService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个采购退货单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getSettleStatus, SettleStatus.UN_SETTLE).eq(PurchaseReturn::getId, id) + .eq(PurchaseReturn::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(PurchaseReturn::getId, id) + .in(PurchaseReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(PurchaseReturn.class) + .set(PurchaseReturn::getSettleStatus, SettleStatus.SETTLED).eq(PurchaseReturn::getId, id) + .in(PurchaseReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(PurchaseReturn purchaseReturn, CreatePurchaseReturnVo vo, + boolean requireReceive) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + purchaseReturn.setScId(vo.getScId()); + + Supplier supplier = supplierService.findById(vo.getSupplierId()); + if (supplier == null) { + throw new InputErrorException("供应商不存在!"); + } + purchaseReturn.setSupplierId(vo.getSupplierId()); + + if (!StringUtil.isBlank(vo.getPurchaserId())) { + UserDto purchaser = userService.findById(vo.getPurchaserId()); + if (purchaser == null) { + throw new InputErrorException("采购员不存在!"); + } + + purchaseReturn.setPurchaserId(vo.getPurchaserId()); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + GetPaymentDateDto paymentDate = receiveSheetService.getPaymentDate(supplier.getId()); + + purchaseReturn.setPaymentDate( + paymentDate.getAllowModify() ? vo.getPaymentDate() : paymentDate.getPaymentDate()); + + if (requireReceive) { + + ReceiveSheet receiveSheet = receiveSheetService.getById(vo.getReceiveSheetId()); + if (receiveSheet == null) { + throw new DefaultClientException("采购收货单不存在!"); + } + + purchaseReturn.setScId(receiveSheet.getScId()); + purchaseReturn.setSupplierId(receiveSheet.getSupplierId()); + purchaseReturn.setReceiveSheetId(receiveSheet.getId()); + + if (!purchaseConfig.getPurchaseReturnMultipleRelateReceive()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(PurchaseReturn.class) + .eq(PurchaseReturn::getReceiveSheetId, receiveSheet.getId()) + .ne(PurchaseReturn::getId, purchaseReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException( + "采购收货单号:" + receiveSheet.getCode() + ",已关联其他采购退货单,不允许关联多个采购退货单!"); + } + } + } + + int returnNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (ReturnProductVo productVo : vo.getProducts()) { + if (requireReceive) { + if (!StringUtil.isBlank(productVo.getReceiveSheetDetailId())) { + ReceiveSheetDetail detail = receiveSheetDetailService.getById( + productVo.getReceiveSheetDetailId()); + productVo.setPurchasePrice(detail.getTaxPrice()); + } else { + productVo.setPurchasePrice(BigDecimal.ZERO); + } + } + + boolean isGift = productVo.getPurchasePrice().doubleValue() == 0D; + + if (requireReceive) { + if (StringUtil.isBlank(productVo.getReceiveSheetDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum += productVo.getReturnNum(); + } else { + returnNum += productVo.getReturnNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getPurchasePrice(), productVo.getReturnNum())); + + PurchaseReturnDetail detail = new PurchaseReturnDetail(); + detail.setId(IdUtil.getId()); + detail.setReturnId(purchaseReturn.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getPurchasePrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许2位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setReturnNum(productVo.getReturnNum()); + detail.setTaxPrice(productVo.getPurchasePrice()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getTaxRate()); + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + if (requireReceive && !StringUtil.isBlank(productVo.getReceiveSheetDetailId())) { + detail.setReceiveSheetDetailId(productVo.getReceiveSheetDetailId()); + receiveSheetDetailService.addReturnNum(productVo.getReceiveSheetDetailId(), + detail.getReturnNum()); + } + + purchaseReturnDetailService.save(detail); + orderNo++; + } + purchaseReturn.setTotalNum(returnNum); + purchaseReturn.setTotalGiftNum(giftNum); + purchaseReturn.setTotalAmount(totalAmount); + purchaseReturn.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + purchaseReturn.setSettleStatus(this.getInitSettleStatus(supplier)); + } + + /** + * 根据供应商获取初始结算状态 + * + * @param supplier + * @return + */ + private SettleStatus getInitSettleStatus(Supplier supplier) { + + if (supplier.getManageType() == ManageType.DISTRIBUTION) { + return SettleStatus.UN_SETTLE; + } else { + return SettleStatus.UN_REQUIRE; + } + } + + private void sendApprovePassEvent(PurchaseReturn r) { + + ApprovePassPurchaseReturnEvent event = new ApprovePassPurchaseReturnEvent(this); + event.setId(r.getId()); + event.setTotalAmount(r.getTotalAmount()); + event.setApproveTime(r.getApproveTime()); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailServiceImpl.java new file mode 100644 index 0000000..2f934bb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetDetailServiceImpl.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.mappers.ReceiveSheetDetailMapper; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ReceiveSheetDetailServiceImpl extends + BaseMpServiceImpl + implements ReceiveSheetDetailService { + + @Autowired + private ProductService productService; + + @Override + public List getBySheetId(String sheetId) { + + return getBaseMapper().getBySheetId(sheetId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + ReceiveSheetDetail detail = getBaseMapper().selectById(id); + + Integer remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()).intValue(); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + ReceiveSheetDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReturnNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + orderDetail.getReturnNum() + + "个,本次取消退货数量不允许大于" + orderDetail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetServiceImpl.java new file mode 100644 index 0000000..0aa2e72 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/purchase/ReceiveSheetServiceImpl.java @@ -0,0 +1,725 @@ +package com.lframework.xingyun.sc.impl.purchase; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.enums.ManageType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.mappers.ReceiveSheetMapper; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.purchase.receive.ApprovePassReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ApproveRefuseReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.BatchApprovePassReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.BatchApproveRefuseReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.CreateReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveProductVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveSheetSelectorVo; +import com.lframework.xingyun.sc.vo.purchase.receive.UpdateReceiveSheetVo; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ReceiveSheetServiceImpl extends BaseMpServiceImpl + implements ReceiveSheetService { + + @Autowired + private ReceiveSheetDetailService receiveSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private SupplierService supplierService; + + @Autowired + private UserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private PurchaseOrderService purchaseOrderService; + + @Autowired + private PurchaseConfigService purchaseConfigService; + + @Autowired + private PurchaseOrderDetailService purchaseOrderDetailService; + + @Autowired + private ProductStockService productStockService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryReceiveSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryReceiveSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + ReceiveSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public GetPaymentDateDto getPaymentDate(String supplierId) { + + // 付款日期默认为当前日期的30天后,如当天为2021-10-01,则付款日期默认为2021-11-01 + //(1)供应商的经营方式为“经销”,且结账方式为“任意指定”,则付款日期按照以上规则展示默认值,允许用户更改,但仅能选择当天及当天之后的日期。 + //(2)供应商的经营方式为“经销”,且结账方式为“货到付款”,则付款日期默认为此刻,即收货单的创建时间,可能会遇到跨日的问题,但付款日期,均赋值为收货单的创建日期。 + //(3)供应商的经营方式为非经销模式时,收货单、退货单不涉及付款,则付款日期字段置灰,为空,且不可点击。 + + Supplier supplier = supplierService.findById(supplierId); + + GetPaymentDateDto result = new GetPaymentDateDto(); + + result.setAllowModify(supplier.getManageType() == ManageType.DISTRIBUTION + && supplier.getSettleType() == SettleType.ARBITRARILY); + if (supplier.getManageType() == ManageType.DISTRIBUTION + && supplier.getSettleType() == SettleType.ARBITRARILY) { + result.setPaymentDate(LocalDate.now().plusMonths(1)); + } else if (supplier.getManageType() == ManageType.DISTRIBUTION + && supplier.getSettleType() == SettleType.CASH_ON_DELIVERY) { + result.setPaymentDate(LocalDate.now()); + } + + return result; + } + + @Override + public ReceiveSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @Override + public ReceiveSheetWithReturnDto getWithReturn(String id) { + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + ReceiveSheetWithReturnDto sheet = getBaseMapper().getWithReturn(id, + purchaseConfig.getPurchaseReturnRequireReceive()); + if (sheet == null) { + throw new InputErrorException("收货单不存在!"); + } + return sheet; + } + + @Override + public PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryReceiveSheetWithReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReturn(vo, + purchaseConfig.getPurchaseReturnMultipleRelateReceive()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "创建采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建收货单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateReceiveSheetVo vo) { + + ReceiveSheet sheet = new ReceiveSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.RECEIVE_SHEET)); + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + this.create(sheet, vo, purchaseConfig.getReceiveRequirePurchase()); + + sheet.setStatus(ReceiveSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "修改采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改收货单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateReceiveSheetVo vo) { + + ReceiveSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED + && sheet.getStatus() != ReceiveSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("采购收货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("采购收货单无法修改!"); + } + + boolean requirePurchase = !StringUtil.isBlank(sheet.getPurchaseOrderId()); + + if (requirePurchase) { + //查询采购收货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + List details = receiveSheetDetailService.list(queryDetailWrapper); + for (ReceiveSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getPurchaseOrderDetailId())) { + //先恢复已收货数量 + purchaseOrderDetailService.subReceiveNum(detail.getPurchaseOrderDetailId(), + detail.getOrderNum()); + } + } + } + + // 删除采购收货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + receiveSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo, requirePurchase); + + sheet.setStatus(ReceiveSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(ReceiveSheetStatus.CREATED); + statusList.add(ReceiveSheetStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getApproveBy, null).set(ReceiveSheet::getApproveTime, null) + .set(ReceiveSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(ReceiveSheet::getId, sheet.getId()) + .in(ReceiveSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购收货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "审核通过采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassReceiveSheetVo vo) { + + ReceiveSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED + && sheet.getStatus() != ReceiveSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("采购收货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购收货单无法审核通过!"); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getReceiveMultipleRelatePurchase()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(ReceiveSheet.class) + .eq(ReceiveSheet::getPurchaseOrderId, sheet.getPurchaseOrderId()) + .ne(ReceiveSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + PurchaseOrder purchaseOrder = purchaseOrderService.getById(sheet.getPurchaseOrderId()); + throw new DefaultClientException( + "采购订单号:" + purchaseOrder.getCode() + + ",已关联其他采购收货单,不允许关联多个采购收货单!"); + } + } + + sheet.setStatus(ReceiveSheetStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(ReceiveSheetStatus.CREATED); + statusList.add(ReceiveSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ReceiveSheet::getApproveTime, LocalDateTime.now()) + .eq(ReceiveSheet::getId, sheet.getId()) + .in(ReceiveSheet::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(ReceiveSheet::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购收货单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(ReceiveSheetDetail::getOrderNo); + List details = receiveSheetDetailService.list(queryDetailWrapper); + for (ReceiveSheetDetail detail : details) { + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(sheet.getScId()); + addProductStockVo.setStockNum(detail.getOrderNum()); + addProductStockVo.setTaxPrice(detail.getTaxPrice()); + addProductStockVo.setBizId(sheet.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(sheet.getCode()); + addProductStockVo.setBizType(ProductStockBizType.PURCHASE.getCode()); + + productStockService.addStock(addProductStockVo); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Override + public void batchApprovePass(BatchApprovePassReceiveSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassReceiveSheetVo approvePassVo = new ApprovePassReceiveSheetVo(); + approvePassVo.setId(id); + + try { + ReceiveSheetService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个采购收货单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Override + public String directApprovePass(CreateReceiveSheetVo vo) { + + ReceiveSheetService thisService = getThis(this.getClass()); + + String sheetId = thisService.create(vo); + + ApprovePassReceiveSheetVo approvePassVo = new ApprovePassReceiveSheetVo(); + approvePassVo.setId(sheetId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return sheetId; + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "审核拒绝采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseReceiveSheetVo vo) { + + ReceiveSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("采购收货单已审核通过,不允许继续执行审核!"); + } + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("采购收货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("采购收货单无法审核拒绝!"); + } + + sheet.setStatus(ReceiveSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ReceiveSheet::getApproveTime, LocalDateTime.now()) + .set(ReceiveSheet::getRefuseReason, vo.getRefuseReason()) + .eq(ReceiveSheet::getId, sheet.getId()) + .eq(ReceiveSheet::getStatus, ReceiveSheetStatus.CREATED); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("采购收货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Override + public void batchApproveRefuse(BatchApproveRefuseReceiveSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseReceiveSheetVo approveRefuseVo = new ApproveRefuseReceiveSheetVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + ReceiveSheetService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个采购收货单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.PURCHASE, name = "删除采购收货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + ReceiveSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("采购收货单不存在!"); + } + + if (sheet.getStatus() != ReceiveSheetStatus.CREATED + && sheet.getStatus() != ReceiveSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == ReceiveSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的采购收货单不允许执行删除操作!"); + } + + throw new DefaultClientException("采购收货单无法删除!"); + } + + if (!StringUtil.isBlank(sheet.getPurchaseOrderId())) { + //查询采购收货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + List details = receiveSheetDetailService.list(queryDetailWrapper); + for (ReceiveSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getPurchaseOrderDetailId())) { + //恢复已收货数量 + purchaseOrderDetailService.subReceiveNum(detail.getPurchaseOrderDetailId(), + detail.getOrderNum()); + } + } + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(ReceiveSheetDetail.class) + .eq(ReceiveSheetDetail::getSheetId, sheet.getId()); + receiveSheetDetailService.remove(deleteDetailWrapper); + + // 删除订单 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + ReceiveSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个采购收货单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(ReceiveSheet::getId, id) + .eq(ReceiveSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getSettleStatus, SettleStatus.PART_SETTLE).eq(ReceiveSheet::getId, id) + .in(ReceiveSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ReceiveSheet.class) + .set(ReceiveSheet::getSettleStatus, SettleStatus.SETTLED).eq(ReceiveSheet::getId, id) + .in(ReceiveSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(ReceiveSheet sheet, CreateReceiveSheetVo vo, boolean receiveRequirePurchase) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + sheet.setScId(vo.getScId()); + + Supplier supplier = supplierService.findById(vo.getSupplierId()); + if (supplier == null) { + throw new InputErrorException("供应商不存在!"); + } + sheet.setSupplierId(vo.getSupplierId()); + + if (!StringUtil.isBlank(vo.getPurchaserId())) { + UserDto purchaser = userService.findById(vo.getPurchaserId()); + if (purchaser == null) { + throw new InputErrorException("采购员不存在!"); + } + + sheet.setPurchaserId(vo.getPurchaserId()); + } + + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + GetPaymentDateDto paymentDate = this.getPaymentDate(supplier.getId()); + + sheet.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + sheet.setReceiveDate(vo.getReceiveDate()); + + if (receiveRequirePurchase) { + + PurchaseOrder purchaseOrder = purchaseOrderService.getById(vo.getPurchaseOrderId()); + if (purchaseOrder == null) { + throw new DefaultClientException("采购订单不存在!"); + } + + sheet.setScId(purchaseOrder.getScId()); + sheet.setSupplierId(purchaseOrder.getSupplierId()); + sheet.setPurchaseOrderId(purchaseOrder.getId()); + + if (!purchaseConfig.getReceiveMultipleRelatePurchase()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(ReceiveSheet.class) + .eq(ReceiveSheet::getPurchaseOrderId, purchaseOrder.getId()) + .ne(ReceiveSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException( + "采购订单号:" + purchaseOrder.getCode() + + ",已关联其他采购收货单,不允许关联多个采购收货单!"); + } + } + } + + int purchaseNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (ReceiveProductVo productVo : vo.getProducts()) { + if (receiveRequirePurchase) { + if (!StringUtil.isBlank(productVo.getPurchaseOrderDetailId())) { + PurchaseOrderDetail orderDetail = purchaseOrderDetailService.getById( + productVo.getPurchaseOrderDetailId()); + productVo.setPurchasePrice(orderDetail.getTaxPrice()); + } else { + productVo.setPurchasePrice(BigDecimal.ZERO); + } + } + + boolean isGift = productVo.getPurchasePrice().doubleValue() == 0D; + + if (receiveRequirePurchase) { + if (StringUtil.isBlank(productVo.getPurchaseOrderDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum += productVo.getReceiveNum(); + } else { + purchaseNum += productVo.getReceiveNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getPurchasePrice(), productVo.getReceiveNum())); + + ReceiveSheetDetail detail = new ReceiveSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getPurchasePrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许2位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setOrderNum(productVo.getReceiveNum()); + detail.setTaxPrice(productVo.getPurchasePrice()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getTaxRate()); + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + if (receiveRequirePurchase && !StringUtil.isBlank(productVo.getPurchaseOrderDetailId())) { + detail.setPurchaseOrderDetailId(productVo.getPurchaseOrderDetailId()); + purchaseOrderDetailService.addReceiveNum(productVo.getPurchaseOrderDetailId(), + detail.getOrderNum()); + } + + receiveSheetDetailService.save(detail); + orderNo++; + } + sheet.setTotalNum(purchaseNum); + sheet.setTotalGiftNum(giftNum); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setSettleStatus(this.getInitSettleStatus(supplier)); + } + + /** + * 根据供应商获取初始结算状态 + * + * @param supplier + * @return + */ + private SettleStatus getInitSettleStatus(Supplier supplier) { + + if (supplier.getManageType() == ManageType.DISTRIBUTION) { + return SettleStatus.UN_SETTLE; + } else { + return SettleStatus.UN_REQUIRE; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailConfigServiceImpl.java new file mode 100644 index 0000000..c53c269 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailConfigServiceImpl.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.RetailConfigMapper; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.vo.retail.config.UpdateRetailConfigVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class RetailConfigServiceImpl extends BaseMpServiceImpl + implements RetailConfigService { + + @Cacheable(value = RetailConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public RetailConfig get() { + + RetailConfig config = getBaseMapper().selectOne(Wrappers.query()); + + return config; + } + + @OpLog(type = ScOpLogType.RETAIL, name = "修改零售参数设置") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateRetailConfigVo vo) { + + RetailConfig config = getBaseMapper().selectOne(Wrappers.query()); + config.setRetailReturnRequireOutStock(vo.getRetailReturnRequireOutStock()); + config.setRetailReturnMultipleRelateOutStock(vo.getRetailReturnMultipleRelateOutStock()); + config.setRetailOutSheetRequireMember(vo.getRetailOutSheetRequireMember()); + config.setRetailReturnRequireMember(vo.getRetailReturnRequireMember()); + config.setRetailOutSheetRequireLogistics(vo.getRetailOutSheetRequireLogistics()); + + getBaseMapper().updateById(config); + + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = RetailConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailBundleServiceImpl.java new file mode 100644 index 0000000..1604fa6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.RetailOutSheetDetailBundleMapper; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class RetailOutSheetDetailBundleServiceImpl extends + BaseMpServiceImpl + implements RetailOutSheetDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailLotServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailLotServiceImpl.java new file mode 100644 index 0000000..602b799 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailLotServiceImpl.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailLot; +import com.lframework.xingyun.sc.mappers.RetailOutSheetDetailLotMapper; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class RetailOutSheetDetailLotServiceImpl + extends BaseMpServiceImpl + implements RetailOutSheetDetailLotService { + + @Autowired + private ProductService productService; + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + @Override + public RetailOutSheetDetailLotDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetailLot detail = getBaseMapper().selectById(id); + + Integer remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()).intValue(); + if (NumberUtil.lt(remainNum, num)) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + + retailOutSheetDetailService.addReturnNum(detail.getDetailId(), num); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetailLot detail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(detail.getReturnNum(), num)) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + detail.getReturnNum() + + "个,本次取消退货数量不允许大于" + detail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(detail.getId(), num) != 1) { + RetailOutSheetDetail sheetDetail = retailOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + + retailOutSheetDetailService.subReturnNum(detail.getDetailId(), num); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailServiceImpl.java new file mode 100644 index 0000000..ec4754f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetDetailServiceImpl.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.RetailOutSheetDetailMapper; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailBundleService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import java.math.BigDecimal; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class RetailOutSheetDetailServiceImpl extends + BaseMpServiceImpl implements + RetailOutSheetDetailService { + + @Autowired + private ProductService productService; + + @Autowired + private RetailOutSheetDetailBundleService retailOutSheetDetailBundleService; + + @Override + public List getBySheetId(String sheetId) { + + return getBaseMapper().getBySheetId(sheetId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetail detail = getBaseMapper().selectById(id); + + Integer remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()).intValue(); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + RetailOutSheetDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReturnNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException("(" + product.getCode() + ")" + product.getName() + "已退货数量为" + + orderDetail.getReturnNum() + "个,本次取消退货数量不允许大于" + + orderDetail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + } + + @Override + public BigDecimal getTotalWeightBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(RetailOutSheetDetail.class) + .in(RetailOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumWeight = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class) + .eq(RetailOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = retailOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getWeight() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置重量,请检查!"); + } + + return NumberUtil.mul(targetProduct.getWeight(), b.getProductOrderNum()); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getWeight() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置重量,请检查!"); + } + return NumberUtil.mul(t.getOrderNum(), product.getWeight()); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumWeight; + } + + @Override + public BigDecimal getTotalVolumeBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(RetailOutSheetDetail.class) + .in(RetailOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumVolume = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class) + .eq(RetailOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = retailOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getVolume() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置体积,请检查!"); + } + + return NumberUtil.mul(targetProduct.getVolume(), b.getProductOrderNum()); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getVolume() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置体积,请检查!"); + } + return NumberUtil.mul(t.getOrderNum(), product.getVolume()); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumVolume; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetServiceImpl.java new file mode 100644 index 0000000..2f31725 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailOutSheetServiceImpl.java @@ -0,0 +1,1178 @@ +package com.lframework.xingyun.sc.impl.retail; + +import cn.hutool.core.lang.Dict; +import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.security.UserDetailsService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.events.order.impl.ApprovePassRetailOutSheetEvent; +import com.lframework.xingyun.core.service.OrderTimeLineService; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.bo.purchase.GetPurchaseOrderBo; +import com.lframework.xingyun.sc.bo.retail.out.GetRetailOutSheetBo; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.*; +import com.lframework.xingyun.sc.enums.*; +import com.lframework.xingyun.sc.mappers.RetailOutSheetMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailBundleService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.utils.WebUtils; +import com.lframework.xingyun.sc.vo.purchase.ApproveRefusePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.retail.out.ApprovePassRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.ApproveRefuseRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.BatchApprovePassRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.BatchApproveRefuseRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.CreateRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailProductVo; +import com.lframework.xingyun.sc.vo.retail.out.RetailOutProductVo; +import com.lframework.xingyun.sc.vo.retail.out.RetailOutSheetSelectorVo; +import com.lframework.xingyun.sc.vo.retail.out.UpdateRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.ApprovePassSaleOrderVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +import net.minidev.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class RetailOutSheetServiceImpl extends + BaseMpServiceImpl + implements RetailOutSheetService { + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + @Autowired + private RetailOutSheetDetailLotService retailOutSheetDetailLotService; + + @Autowired + private RetailOutSheetDetailBundleService retailOutSheetDetailBundleService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private MemberService memberService; + + @Autowired + private UserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private RetailConfigService retailConfigService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Autowired + private LogisticsSheetDetailService logisticsSheetDetailService; + + @Autowired + private UserDetailsService userDetailsService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryRetailOutSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryRetailOutSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + RetailOutSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public GetPaymentDateDto getPaymentDate(String memberId) { + + GetPaymentDateDto result = new GetPaymentDateDto(); + result.setAllowModify(Boolean.TRUE); + result.setPaymentDate(LocalDate.now()); + + return result; + } + + @Override + public RetailOutSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @Override + public RetailOutSheetWithReturnDto getWithReturn(String id) { + + RetailConfig retailConfig = retailConfigService.get(); + + RetailOutSheetWithReturnDto sheet = getBaseMapper().getWithReturn(id, + retailConfig.getRetailReturnRequireOutStock()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + return sheet; + } + + @Override + public PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryRetailOutSheetWithReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + RetailConfig retailConfig = retailConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReturn(vo, + retailConfig.getRetailReturnMultipleRelateOutStock()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = ScOpLogType.RETAIL, name = "创建零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateRetailOutSheetVo vo) { + + RetailOutSheet sheet = new RetailOutSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.RETAIL_OUT_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(RetailOutSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = ScOpLogType.RETAIL, name = "修改零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateRetailOutSheetVo vo) { + + RetailOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,无法修改!"); + } + + throw new DefaultClientException("零售出库单无法修改!"); + } + + // 删除出库单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetail.class) + .eq(RetailOutSheetDetail::getSheetId, sheet.getId()); + retailOutSheetDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class).eq(RetailOutSheetDetailBundle::getSheetId, sheet.getId()); + retailOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + this.create(sheet, vo); + + sheet.setStatus(RetailOutSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(RetailOutSheetStatus.CREATED); + statusList.add(RetailOutSheetStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, null).set(RetailOutSheet::getApproveTime, null) + .set(RetailOutSheet::getRefuseReason, StringPool.EMPTY_STR) + .set(RetailOutSheet::getMemberId, sheet.getMemberId()) + .eq(RetailOutSheet::getId, sheet.getId()) + .in(RetailOutSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.RETAIL, name = "审核通过零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassRetailOutSheetVo vo) { + + RetailOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售出库单无法审核通过!"); + } + + RetailConfig retailConfig = retailConfigService.get(); + if (retailConfig.getRetailOutSheetRequireLogistics()) { + // 关联物流单 + LogisticsSheetDetail logisticsSheetDetail = logisticsSheetDetailService.getByBizId( + sheet.getId(), LogisticsSheetDetailBizType.RETAIL_OUT_SHEET); + if (logisticsSheetDetail == null) { + throw new DefaultClientException("零售出库单尚未发货,无法审核通过!"); + } + } + + sheet.setStatus(RetailOutSheetStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(RetailOutSheetStatus.CREATED); + statusList.add(RetailOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailOutSheet::getApproveTime, LocalDateTime.now()) + .eq(RetailOutSheet::getId, sheet.getId()) + .in(RetailOutSheet::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(RetailOutSheet::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(sheet.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(sheet.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有支付方式,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetail.class) + .eq(RetailOutSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(RetailOutSheetDetail::getOrderNo); + List details = retailOutSheetDetailService.list(queryDetailWrapper); + + int totalNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (RetailOutSheetDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum())); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(detail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(detail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.RETAIL.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + RetailOutSheetDetailLot detailLot = new RetailOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(detail.getId()); + detailLot.setOrderNum(detail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(detail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + retailOutSheetDetailLotService.save(detailLot); + + if (isGift) { + giftNum += detail.getOrderNum(); + } else { + totalNum += detail.getOrderNum(); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class) + .eq(RetailOutSheetDetailBundle::getSheetId, sheet.getId()) + .eq(RetailOutSheetDetailBundle::getDetailId, detail.getId()); + List retailOutSheetDetailBundles = retailOutSheetDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(retailOutSheetDetailBundles); + + for (RetailOutSheetDetailBundle retailOutSheetDetailBundle : retailOutSheetDetailBundles) { + RetailOutSheetDetail newDetail = new RetailOutSheetDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setSheetId(sheet.getId()); + newDetail.setProductId(retailOutSheetDetailBundle.getProductId()); + newDetail.setOrderNum(retailOutSheetDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(retailOutSheetDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(retailOutSheetDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(retailOutSheetDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(orderNo++); + newDetail.setSettleStatus(detail.getSettleStatus()); + newDetail.setOriBundleDetailId(detail.getId()); + + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(newDetail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(newDetail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(newDetail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.RETAIL.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + RetailOutSheetDetailLot detailLot = new RetailOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(newDetail.getId()); + detailLot.setOrderNum(newDetail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(newDetail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + retailOutSheetDetailLotService.save(detailLot); + + retailOutSheetDetailService.save(newDetail); + retailOutSheetDetailService.removeById(detail.getId()); + + retailOutSheetDetailBundle.setProductDetailId(newDetail.getId()); + retailOutSheetDetailBundleService.updateById(retailOutSheetDetailBundle); + + if (isGift) { + giftNum += newDetail.getOrderNum(); + } else { + totalNum += newDetail.getOrderNum(); + } + } + } + orderNo++; + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(RetailOutSheet.class) + .set(RetailOutSheet::getTotalNum, totalNum).set(RetailOutSheet::getTotalGiftNum, giftNum) + .set(RetailOutSheet::getTotalAmount, totalAmount).eq(RetailOutSheet::getId, sheet.getId()); + this.update(updateWrapper); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassRetailOutSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassRetailOutSheetVo approvePassVo = new ApprovePassRetailOutSheetVo(); + approvePassVo.setId(id); + + try { + RetailOutSheetService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个零售出库单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateRetailOutSheetVo vo) { + + RetailOutSheetService thisService = getThis(this.getClass()); + + String sheetId = thisService.create(vo); + + ApprovePassRetailOutSheetVo approvePassVo = new ApprovePassRetailOutSheetVo(); + approvePassVo.setId(sheetId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return sheetId; + } + + @OpLog(type = ScOpLogType.RETAIL, name = "审核拒绝零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseRetailOutSheetVo vo) { + + RetailOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,不允许继续执行审核!"); + } + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("零售出库单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售出库单无法审核拒绝!"); + } + + sheet.setStatus(RetailOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailOutSheet::getApproveTime, LocalDateTime.now()) + .set(RetailOutSheet::getRefuseReason, vo.getRefuseReason()) + .eq(RetailOutSheet::getId, sheet.getId()) + .eq(RetailOutSheet::getStatus, RetailOutSheetStatus.CREATED); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseRetailOutSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseRetailOutSheetVo approveRefuseVo = new ApproveRefuseRetailOutSheetVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + RetailOutSheetService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个零售出库单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.RETAIL, name = "删除零售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + RetailOutSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的零售出库单不允许执行删除操作!"); + } + + throw new DefaultClientException("零售出库单无法删除!"); + } + + if (logisticsSheetDetailService.getByBizId(sheet.getId(), + LogisticsSheetDetailBizType.RETAIL_OUT_SHEET) != null) { + throw new DefaultClientException("零售出库单已关联物流单,请先删除物流单!"); + } + + // 删除订单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetail.class) + .eq(RetailOutSheetDetail::getSheetId, sheet.getId()); + List details = retailOutSheetDetailService.list(queryDetailWrapper); + retailOutSheetDetailService.remove(queryDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class).eq(RetailOutSheetDetailBundle::getSheetId, sheet.getId()); + retailOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + Wrapper deleteDetailLotWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailLot.class).in(RetailOutSheetDetailLot::getDetailId, + details.stream().map(RetailOutSheetDetail::getId).collect( + Collectors.toList())); + retailOutSheetDetailLotService.remove(deleteDetailLotWrapper); + + // 删除订单 + getBaseMapper().deleteById(id); + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + RetailOutSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个零售出库单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Override + public PageResult queryRetailByCondition(Integer pageIndex, Integer pageSize, + String condition, Boolean isReturn) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryRetailByCondition(condition, isReturn); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryRetailList(Integer pageIndex, Integer pageSize, + QueryRetailProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryRetailList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public RetailProductDto getRetailById(String id) { + + RetailProductDto data = getBaseMapper().getRetailById(id); + return data; + } + + @OpLog(type = ScOpLogType.RETAIL, name = "发送零售出库单审批流程给ydool系统,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_SEND, orderId = "#id", name = "发送零售出库单审批流程给ydool系统") + @Transactional(rollbackFor = Exception.class) + @Override + public InvokeResult sendApprove(String id) { + RetailOutSheet order = getBaseMapper().selectById(id); + if (order == null) { + throw new DefaultClientException("零售出库单不存在!"); + } + if (order.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,无需再次审核!"); + } + if (order.getStatus() == RetailOutSheetStatus.APPROVE_ING) { + throw new DefaultClientException("零售出库单正在审核中,请勿重复推送"); + } + //获取订单详情 + RetailOutSheetFullDto data = this.getDetail(id); + + GetRetailOutSheetBo bo = new GetRetailOutSheetBo(data); + //获取发起人编号 + String salerCode = bo.getSalerCode(); + if (StringUtil.isBlank(salerCode)) { + throw new DefaultClientException("销售员不存在,无法发起审核!"); + } + //封装参数 + List details = bo.getDetails(); + //将商品编号、商品名称、库存数量、采购数量、采购含税金额从details中提取出来 + List list = details.stream().map(detail -> { + //将商品编号、商品名称、库存数量、采购数量、采购含税金额从detail中提取并返回 + return Dict.create() + .set("goods_number", detail.getProductCode()) + .set("goods_name", detail.getProductName()) + .set("number", detail.getOutNum()) + .set("money", new BigDecimal(detail.getOutNum()).multiply(detail.getTaxPrice())); + }).collect(Collectors.toList()); + Dict dict = Dict.create(); + dict.set("user_id", salerCode) + .set("order_id", id) + .set("all_money", bo.getTotalAmount()) + .set("audit_person_ids", "120,262") + .set("push_person_ids", "120,262") + .set("remark", bo.getDescription()) + .set("ghd_goodlist_info", list); + + String jsonString = JSONObject.toJSONString(dict); + String json = HttpUtil.post("https://nb.ydool.com/api/ydoolerp/erp_ajax.ashx/send_ls", jsonString); + // 修改订单状态 + order.setStatus(RetailOutSheetStatus.APPROVE_ING); + int update = getBaseMapper().updateById(order); + InvokeResult success = InvokeResultBuilder.success(); + success.setMsg(jsonString); + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setVariable("id", id); + OpLogUtil.setExtra(dict); + return update > 0 ? success : InvokeResultBuilder.fail(jsonString); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void approve(YdoolApproveOrderVo vo) { + String status = vo.getStatus(); + if ("y".equals(status)) { + this.approvePass(vo.getId(), vo.getMsg()); + } else { + this.approveRefuse(vo.getId(), vo.getMsg()); + } + } + + + + @Transactional(rollbackFor = Exception.class) + public void approvePass(String id, String description) { + RetailOutSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.APPROVE_ING) { + throw new DefaultClientException("零售出库单无法审核通过!"); + } + + if (sheet.getStatus() != RetailOutSheetStatus.CREATED + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_ING + && sheet.getStatus() != RetailOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售出库单无法审核通过!"); + } + + RetailConfig retailConfig = retailConfigService.get(); + if (retailConfig.getRetailOutSheetRequireLogistics()) { + // 关联物流单 + LogisticsSheetDetail logisticsSheetDetail = logisticsSheetDetailService.getByBizId( + sheet.getId(), LogisticsSheetDetailBizType.RETAIL_OUT_SHEET); + if (logisticsSheetDetail == null) { + throw new DefaultClientException("零售出库单尚未发货,无法审核通过!"); + } + } + + sheet.setStatus(RetailOutSheetStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(RetailOutSheetStatus.APPROVE_ING); + + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, user.getId()) + .set(RetailOutSheet::getApproveTime, LocalDateTime.now()) + .eq(RetailOutSheet::getId, sheet.getId()) + .in(RetailOutSheet::getStatus, statusList); + if (!StringUtil.isBlank(description)) { + updateOrderWrapper.set(RetailOutSheet::getDescription, description); + } + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(sheet.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(sheet.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有支付方式,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetail.class) + .eq(RetailOutSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(RetailOutSheetDetail::getOrderNo); + List details = retailOutSheetDetailService.list(queryDetailWrapper); + + int totalNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (RetailOutSheetDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum())); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(detail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(detail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.RETAIL.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + RetailOutSheetDetailLot detailLot = new RetailOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(detail.getId()); + detailLot.setOrderNum(detail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(detail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + retailOutSheetDetailLotService.save(detailLot); + + if (isGift) { + giftNum += detail.getOrderNum(); + } else { + totalNum += detail.getOrderNum(); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + RetailOutSheetDetailBundle.class) + .eq(RetailOutSheetDetailBundle::getSheetId, sheet.getId()) + .eq(RetailOutSheetDetailBundle::getDetailId, detail.getId()); + List retailOutSheetDetailBundles = retailOutSheetDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(retailOutSheetDetailBundles); + + for (RetailOutSheetDetailBundle retailOutSheetDetailBundle : retailOutSheetDetailBundles) { + RetailOutSheetDetail newDetail = new RetailOutSheetDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setSheetId(sheet.getId()); + newDetail.setProductId(retailOutSheetDetailBundle.getProductId()); + newDetail.setOrderNum(retailOutSheetDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(retailOutSheetDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(retailOutSheetDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(retailOutSheetDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(orderNo++); + newDetail.setSettleStatus(detail.getSettleStatus()); + newDetail.setOriBundleDetailId(detail.getId()); + + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(newDetail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(newDetail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(newDetail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.RETAIL.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + RetailOutSheetDetailLot detailLot = new RetailOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(newDetail.getId()); + detailLot.setOrderNum(newDetail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(newDetail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + retailOutSheetDetailLotService.save(detailLot); + + retailOutSheetDetailService.save(newDetail); + retailOutSheetDetailService.removeById(detail.getId()); + + retailOutSheetDetailBundle.setProductDetailId(newDetail.getId()); + retailOutSheetDetailBundleService.updateById(retailOutSheetDetailBundle); + + if (isGift) { + giftNum += newDetail.getOrderNum(); + } else { + totalNum += newDetail.getOrderNum(); + } + } + } + orderNo++; + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(RetailOutSheet.class) + .set(RetailOutSheet::getTotalNum, totalNum).set(RetailOutSheet::getTotalGiftNum, giftNum) + .set(RetailOutSheet::getTotalAmount, totalAmount).eq(RetailOutSheet::getId, sheet.getId()); + this.update(updateWrapper); + + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApprovePassRetailOutSheetVo vo = new ApprovePassRetailOutSheetVo(); + vo.setId(id); + vo.setDescription(description); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核通过零售出库单,单号:%s", sheet.getCode())); + opLogs.setLogType(ScOpLogType.RETAIL); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(sheet.getId()); + orderTimeLine.setContent("审核通过"); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_PASS); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + + this.sendApprovePassEvent(sheet); + } + + @Transactional(rollbackFor = Exception.class) + public void approveRefuse(String id, String refuseReason) { + if (StringUtil.isBlank(refuseReason)) { + throw new InputErrorException("请输入拒绝理由!"); + } + + RetailOutSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("零售出库单不存在!"); + } + + + if (sheet.getStatus() != RetailOutSheetStatus.APPROVE_ING) { + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("零售出库单已审核通过,不允许继续执行审核!"); + } + + if (sheet.getStatus() == RetailOutSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("零售出库单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售出库单无法审核拒绝!"); + } + + sheet.setStatus(RetailOutSheetStatus.APPROVE_REFUSE); + + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate( + RetailOutSheet.class) + .set(RetailOutSheet::getApproveBy, user.getId()) + .set(RetailOutSheet::getApproveTime, LocalDateTime.now()) + .set(RetailOutSheet::getRefuseReason, refuseReason) + .eq(RetailOutSheet::getId, sheet.getId()) + .eq(RetailOutSheet::getStatus, RetailOutSheetStatus.APPROVE_ING); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售出库单信息已过期,请刷新重试!"); + } + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApproveRefuseRetailOutSheetVo vo = new ApproveRefuseRetailOutSheetVo(); + vo.setId(id); + vo.setRefuseReason(refuseReason); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核拒绝零售出库单,单号:%s", sheet.getCode())); + opLogs.setLogType(ScOpLogType.RETAIL); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(sheet.getId()); + orderTimeLine.setContent(String.format("审核拒绝,拒绝理由:%s", refuseReason)); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_RETURN); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + + } + + private void create(RetailOutSheet sheet, CreateRetailOutSheetVo vo) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + sheet.setScId(vo.getScId()); + + Member member = null; + if (!StringUtil.isBlank(vo.getMemberId())) { + member = memberService.findById(vo.getMemberId()); + if (member == null) { + throw new InputErrorException("会员不存在!"); + } + sheet.setMemberId(vo.getMemberId()); + } else { + sheet.setMemberId(null); + } + + if (!StringUtil.isBlank(vo.getSalerId())) { + UserDto saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + sheet.setSalerId(vo.getSalerId()); + } + + GetPaymentDateDto paymentDate = this.getPaymentDate(member == null ? null : member.getId()); + + sheet.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + + int purchaseNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (RetailOutProductVo productVo : vo.getProducts()) { + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (isGift) { + giftNum += productVo.getOrderNum(); + } else { + purchaseNum += productVo.getOrderNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getTaxPrice(), productVo.getOrderNum())); + + RetailOutSheetDetail detail = new RetailOutSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getTaxPrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许2位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setOrderNum(productVo.getOrderNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(member)); + + retailOutSheetDetailService.save(detail); + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getRetailPrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(detail.getTaxPrice(), + bundleWeight, 2); + List retailOutSheetDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + RetailOutSheetDetailBundle retailOutSheetDetailBundle = new RetailOutSheetDetailBundle(); + retailOutSheetDetailBundle.setId(IdUtil.getId()); + retailOutSheetDetailBundle.setSheetId(sheet.getId()); + retailOutSheetDetailBundle.setDetailId(detail.getId()); + retailOutSheetDetailBundle.setMainProductId(product.getId()); + retailOutSheetDetailBundle.setOrderNum(detail.getOrderNum()); + retailOutSheetDetailBundle.setProductId(productBundle.getProductId()); + retailOutSheetDetailBundle.setProductOrderNum( + NumberUtil.mul(detail.getOrderNum(), productBundle.getBundleNum()).intValue()); + retailOutSheetDetailBundle.setProductOriPrice(productBundle.getRetailPrice()); + // 这里会有尾差 + retailOutSheetDetailBundle.setProductTaxPrice( + NumberUtil.getNumber(NumberUtil.div(BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue()), + productBundle.getBundleNum()), 2)); + retailOutSheetDetailBundle.setProductTaxRate(bundle.getSaleTaxRate()); + + return retailOutSheetDetailBundle; + }).collect(Collectors.toList()); + + retailOutSheetDetailBundleService.saveBatch(retailOutSheetDetailBundles); + } + orderNo++; + } + sheet.setTotalNum(purchaseNum); + sheet.setTotalGiftNum(giftNum); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setSettleStatus(this.getInitSettleStatus(member)); + + orderPayTypeService.create(sheet.getId(), vo.getPayTypes()); + } + + /** + * 根据会员获取初始结算状态 + * + * @param member + * @return + */ + private SettleStatus getInitSettleStatus(Member member) { + + return SettleStatus.UN_SETTLE; + } + + private void sendApprovePassEvent(RetailOutSheet sheet) { + + ApprovePassRetailOutSheetEvent event = new ApprovePassRetailOutSheetEvent(this); + event.setId(sheet.getId()); + event.setTotalAmount(sheet.getTotalAmount()); + event.setApproveTime(sheet.getApproveTime()); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnDetailServiceImpl.java new file mode 100644 index 0000000..8e5ec0b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.RetailReturnDetail; +import com.lframework.xingyun.sc.mappers.RetailReturnDetailMapper; +import com.lframework.xingyun.sc.service.retail.RetailReturnDetailService; +import org.springframework.stereotype.Service; + +@Service +public class RetailReturnDetailServiceImpl extends + BaseMpServiceImpl + implements RetailReturnDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnServiceImpl.java new file mode 100644 index 0000000..cd6b80e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/retail/RetailReturnServiceImpl.java @@ -0,0 +1,654 @@ +package com.lframework.xingyun.sc.impl.retail; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Member; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.member.MemberService; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.events.order.impl.ApprovePassRetailReturnEvent; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.entity.RetailReturnDetail; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.mappers.RetailReturnMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.service.retail.RetailReturnDetailService; +import com.lframework.xingyun.sc.service.retail.RetailReturnService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.retail.returned.ApprovePassRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.ApproveRefuseRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.BatchApprovePassRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.BatchApproveRefuseRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.CreateRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.QueryRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.RetailReturnProductVo; +import com.lframework.xingyun.sc.vo.retail.returned.UpdateRetailReturnVo; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class RetailReturnServiceImpl extends BaseMpServiceImpl + implements RetailReturnService { + + @Autowired + private RetailReturnDetailService retailReturnDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private MemberService memberService; + + @Autowired + private UserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private RetailOutSheetService retailOutSheetService; + + @Autowired + private RetailConfigService retailConfigService; + + @Autowired + private RetailOutSheetDetailService retailOutSheetDetailService; + + @Autowired + private RetailOutSheetDetailLotService retailOutSheetDetailLotService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryRetailReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryRetailReturnVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public RetailReturnFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScOpLogType.RETAIL, name = "创建零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建退单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateRetailReturnVo vo) { + + RetailReturn retailReturn = new RetailReturn(); + retailReturn.setId(IdUtil.getId()); + retailReturn.setCode(generateCodeService.generate(GenerateCodeTypePool.RETAIL_RETURN)); + + RetailConfig retailConfig = retailConfigService.get(); + + this.create(retailReturn, vo, retailConfig.getRetailReturnRequireOutStock()); + + retailReturn.setStatus(RetailReturnStatus.CREATED); + + getBaseMapper().insert(retailReturn); + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + + return retailReturn.getId(); + } + + @OpLog(type = ScOpLogType.RETAIL, name = "修改零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改退单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateRetailReturnVo vo) { + + RetailReturn retailReturn = getBaseMapper().selectById(vo.getId()); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED + && retailReturn.getStatus() != RetailReturnStatus.APPROVE_REFUSE) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("零售退货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("零售退货单无法修改!"); + } + + boolean requireOut = !StringUtil.isBlank(retailReturn.getOutSheetId()); + + if (requireOut) { + //查询零售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + List details = retailReturnDetailService.list(queryDetailWrapper); + for (RetailReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //先恢复已退货数量 + retailOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除零售退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + retailReturnDetailService.remove(deleteDetailWrapper); + + this.create(retailReturn, vo, requireOut); + + retailReturn.setStatus(RetailReturnStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(RetailReturnStatus.CREATED); + statusList.add(RetailReturnStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailReturn.class) + .set(RetailReturn::getApproveBy, null).set(RetailReturn::getApproveTime, null) + .set(RetailReturn::getRefuseReason, StringPool.EMPTY_STR) + .set(RetailReturn::getMemberId, retailReturn.getMemberId()) + .eq(RetailReturn::getId, retailReturn.getId()) + .in(RetailReturn::getStatus, statusList); + if (getBaseMapper().updateAllColumn(retailReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.RETAIL, name = "审核通过零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassRetailReturnVo vo) { + + RetailReturn retailReturn = getBaseMapper().selectById(vo.getId()); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED + && retailReturn.getStatus() != RetailReturnStatus.APPROVE_REFUSE) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("零售退货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售退货单无法审核通过!"); + } + + RetailConfig retailConfig = retailConfigService.get(); + + if (!retailConfig.getRetailReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(RetailReturn.class) + .eq(RetailReturn::getOutSheetId, retailReturn.getOutSheetId()) + .ne(RetailReturn::getId, retailReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + RetailOutSheet retailOutSheet = retailOutSheetService.getById(retailReturn.getOutSheetId()); + throw new DefaultClientException( + "零售出库单号:" + retailOutSheet.getCode() + ",已关联其他零售退货单,不允许关联多个零售退货单!"); + } + } + + retailReturn.setStatus(RetailReturnStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(RetailReturnStatus.CREATED); + statusList.add(RetailReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailReturn.class) + .set(RetailReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailReturn::getApproveTime, LocalDateTime.now()) + .eq(RetailReturn::getId, retailReturn.getId()) + .in(RetailReturn::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(RetailReturn::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(retailReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售退货单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(retailReturn.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(retailReturn.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有支付方式,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()) + .orderByAsc(RetailReturnDetail::getOrderNo); + List details = retailReturnDetailService.list(queryDetailWrapper); + for (RetailReturnDetail detail : details) { + ProductPurchase productPurchase = productPurchaseService.getById(detail.getProductId()); + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(retailReturn.getScId()); + addProductStockVo.setStockNum(detail.getReturnNum()); + addProductStockVo.setDefaultTaxPrice(productPurchase.getPrice()); + addProductStockVo.setBizId(retailReturn.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(retailReturn.getCode()); + addProductStockVo.setBizType(ProductStockBizType.RETAIL_RETURN.getCode()); + + productStockService.addStock(addProductStockVo); + } + + this.sendApprovePassEvent(retailReturn); + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassRetailReturnVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassRetailReturnVo approvePassVo = new ApprovePassRetailReturnVo(); + approvePassVo.setId(id); + + try { + RetailReturnService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个零售退货单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateRetailReturnVo vo) { + + RetailReturnService thisService = getThis(this.getClass()); + + String returnId = thisService.create(vo); + + ApprovePassRetailReturnVo approvePassVo = new ApprovePassRetailReturnVo(); + approvePassVo.setId(returnId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return returnId; + } + + @OpLog(type = ScOpLogType.RETAIL, name = "审核拒绝零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseRetailReturnVo vo) { + + RetailReturn retailReturn = getBaseMapper().selectById(vo.getId()); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("零售退货单已审核通过,不允许继续执行审核!"); + } + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_REFUSE) { + throw new DefaultClientException("零售退货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("零售退货单无法审核拒绝!"); + } + + retailReturn.setStatus(RetailReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(RetailReturn.class) + .set(RetailReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(RetailReturn::getApproveTime, LocalDateTime.now()) + .set(RetailReturn::getRefuseReason, vo.getRefuseReason()) + .eq(RetailReturn::getId, retailReturn.getId()) + .eq(RetailReturn::getStatus, RetailReturnStatus.CREATED); + if (getBaseMapper().updateAllColumn(retailReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("零售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", retailReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseRetailReturnVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseRetailReturnVo approveRefuseVo = new ApproveRefuseRetailReturnVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + RetailReturnService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个零售退货单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.RETAIL, name = "删除零售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + RetailReturn retailReturn = getBaseMapper().selectById(id); + if (retailReturn == null) { + throw new InputErrorException("零售退货单不存在!"); + } + + if (retailReturn.getStatus() != RetailReturnStatus.CREATED + && retailReturn.getStatus() != RetailReturnStatus.APPROVE_REFUSE) { + + if (retailReturn.getStatus() == RetailReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的零售退货单不允许执行删除操作!"); + } + + throw new DefaultClientException("零售退货单无法删除!"); + } + + if (!StringUtil.isBlank(retailReturn.getOutSheetId())) { + //查询零售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + List details = retailReturnDetailService.list(queryDetailWrapper); + for (RetailReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //恢复已退货数量 + retailOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(RetailReturnDetail.class) + .eq(RetailReturnDetail::getReturnId, retailReturn.getId()); + retailReturnDetailService.remove(deleteDetailWrapper); + + // 删除退货单 + getBaseMapper().deleteById(id); + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", retailReturn.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + RetailReturnService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个零售退货单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + private void create(RetailReturn retailReturn, CreateRetailReturnVo vo, boolean requireOut) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + retailReturn.setScId(vo.getScId()); + + Member member = null; + if (!StringUtil.isBlank(vo.getMemberId())) { + member = memberService.findById(vo.getMemberId()); + if (member == null) { + throw new InputErrorException("客户不存在!"); + } + retailReturn.setMemberId(vo.getMemberId()); + } else { + retailReturn.setMemberId(null); + } + + if (!StringUtil.isBlank(vo.getSalerId())) { + UserDto saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("零售员不存在!"); + } + + retailReturn.setSalerId(vo.getSalerId()); + } + + RetailConfig retailConfig = retailConfigService.get(); + + GetPaymentDateDto paymentDate = retailOutSheetService.getPaymentDate( + member == null ? null : member.getId()); + + retailReturn.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + + if (requireOut) { + + RetailOutSheet retailOutSheet = retailOutSheetService.getById(vo.getOutSheetId()); + if (retailOutSheet == null) { + throw new DefaultClientException("零售出库单不存在!"); + } + + retailReturn.setScId(retailOutSheet.getScId()); + retailReturn.setMemberId(retailOutSheet.getMemberId()); + retailReturn.setOutSheetId(retailOutSheet.getId()); + + if (!retailConfig.getRetailReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(RetailReturn.class) + .eq(RetailReturn::getOutSheetId, retailOutSheet.getId()) + .ne(RetailReturn::getId, retailReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException( + "零售出库单号:" + retailOutSheet.getCode() + ",已关联其他零售退货单,不允许关联多个零售退货单!"); + } + } + } + + int returnNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (RetailReturnProductVo productVo : vo.getProducts()) { + if (requireOut) { + if (!StringUtil.isBlank(productVo.getOutSheetDetailId())) { + RetailOutSheetDetailLotDto detailLot = retailOutSheetDetailLotService.findById( + productVo.getOutSheetDetailId()); + RetailOutSheetDetail detail = retailOutSheetDetailService.getById( + detailLot.getDetailId()); + productVo.setOriPrice(detail.getOriPrice()); + productVo.setTaxPrice(detail.getTaxPrice()); + productVo.setDiscountRate(detail.getDiscountRate()); + } else { + productVo.setTaxPrice(BigDecimal.ZERO); + productVo.setDiscountRate(BigDecimal.valueOf(100)); + } + } + + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (requireOut) { + if (StringUtil.isBlank(productVo.getOutSheetDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum += productVo.getReturnNum(); + } else { + returnNum += productVo.getReturnNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getTaxPrice(), productVo.getReturnNum())); + + RetailReturnDetail detail = new RetailReturnDetail(); + detail.setId(IdUtil.getId()); + detail.setReturnId(retailReturn.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getTaxPrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许2位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setReturnNum(productVo.getReturnNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(member)); + if (requireOut && !StringUtil.isBlank(productVo.getOutSheetDetailId())) { + detail.setOutSheetDetailId(productVo.getOutSheetDetailId()); + retailOutSheetDetailLotService.addReturnNum(productVo.getOutSheetDetailId(), + detail.getReturnNum()); + } + + retailReturnDetailService.save(detail); + orderNo++; + } + retailReturn.setTotalNum(returnNum); + retailReturn.setTotalGiftNum(giftNum); + retailReturn.setTotalAmount(totalAmount); + retailReturn.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + retailReturn.setSettleStatus(this.getInitSettleStatus(member)); + + orderPayTypeService.create(retailReturn.getId(), vo.getPayTypes()); + } + + /** + * 根据客户获取初始结算状态 + * + * @param member + * @return + */ + private SettleStatus getInitSettleStatus(Member member) { + + return SettleStatus.UN_SETTLE; + } + + private void sendApprovePassEvent(RetailReturn r) { + + ApprovePassRetailReturnEvent event = new ApprovePassRetailReturnEvent(this); + event.setId(r.getId()); + event.setTotalAmount(r.getTotalAmount()); + event.setApproveTime(r.getApproveTime()); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleConfigServiceImpl.java new file mode 100644 index 0000000..8b2b730 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleConfigServiceImpl.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.SaleConfigMapper; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.vo.sale.config.UpdateSaleConfigVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SaleConfigServiceImpl extends BaseMpServiceImpl + implements SaleConfigService { + + @Cacheable(value = SaleConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public SaleConfig get() { + + SaleConfig config = getBaseMapper().selectOne(Wrappers.query()); + + return config; + } + + @OpLog(type = ScOpLogType.SALE, name = "修改销售参数设置") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleConfigVo vo) { + + SaleConfig config = getBaseMapper().selectOne(Wrappers.query()); + config.setOutStockRequireSale(vo.getOutStockRequireSale()); + config.setOutStockMultipleRelateSale(vo.getOutStockMultipleRelateSale()); + config.setSaleReturnRequireOutStock(vo.getSaleReturnRequireOutStock()); + config.setSaleReturnMultipleRelateOutStock(vo.getSaleReturnMultipleRelateOutStock()); + config.setOutStockRequireLogistics(vo.getOutStockRequireLogistics()); + + getBaseMapper().updateById(config); + + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = SaleConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailBundleServiceImpl.java new file mode 100644 index 0000000..d07fac9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; +import com.lframework.xingyun.sc.mappers.SaleOrderDetailBundleMapper; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class SaleOrderDetailBundleServiceImpl extends + BaseMpServiceImpl + implements SaleOrderDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailServiceImpl.java new file mode 100644 index 0000000..2d1b25a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderDetailServiceImpl.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.mappers.SaleOrderDetailMapper; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SaleOrderDetailServiceImpl extends + BaseMpServiceImpl + implements SaleOrderDetailService { + + @Autowired + private ProductService productService; + + @Override + public List getByOrderId(String orderId) { + + return getBaseMapper().getByOrderId(orderId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addOutNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOrderDetail orderDetail = getBaseMapper().selectById(id); + + Integer remainNum = NumberUtil.sub(orderDetail.getOrderNum(), orderDetail.getOutNum()) + .intValue(); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余出库数量为" + remainNum + + "个,本次出库数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addOutNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余出库数量不足,不允许继续出库!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subOutNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOrderDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getOutNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已出库数量为" + orderDetail.getOutNum() + + "个,本次取消出库数量不允许大于" + orderDetail.getOutNum() + "个!"); + } + + if (getBaseMapper().subOutNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已出库数量不足,不允许取消出库!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java new file mode 100644 index 0000000..4c29c6b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOrderServiceImpl.java @@ -0,0 +1,997 @@ +package com.lframework.xingyun.sc.impl.sale; + +import cn.hutool.core.lang.Dict; +import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.security.UserDetailsService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.events.order.impl.ApprovePassSaleOrderEvent; +import com.lframework.xingyun.core.service.OrderTimeLineService; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.bo.sale.GetSaleOrderBo; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.SaleOrderMapper; +import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailBundleService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.utils.WebUtils; +import com.lframework.xingyun.sc.vo.purchase.ApprovePassPurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.ApproveRefusePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.sale.ApprovePassSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.ApproveRefuseSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.BatchApprovePassSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.BatchApproveRefuseSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.CreateSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderWithOutVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleProductVo; +import com.lframework.xingyun.sc.vo.sale.SaleOrderSelectorVo; +import com.lframework.xingyun.sc.vo.sale.SaleProductVo; +import com.lframework.xingyun.sc.vo.sale.UpdateSaleOrderVo; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import net.minidev.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SaleOrderServiceImpl extends BaseMpServiceImpl implements + SaleOrderService { + + @Autowired + private SaleOrderDetailService saleOrderDetailService; + + @Autowired + private SaleOrderDetailBundleService saleOrderDetailBundleService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private CustomerService customerService; + + @Autowired + private UserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private SaleConfigService saleConfigService; + + @Autowired + private OrderPayTypeService orderPayTypeService; + + @Autowired + private UserDetailsService userDetailsService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySaleOrderVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySaleOrderVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SaleOrderSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public SaleOrderFullDto getDetail(String id) { + + SaleOrderFullDto order = getBaseMapper().getDetail(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + return order; + } + + @Override + public SaleOrderWithOutDto getWithOut(String id) { + + SaleConfig saleConfig = saleConfigService.get(); + + SaleOrderWithOutDto order = getBaseMapper().getWithOut(id, saleConfig.getOutStockRequireSale()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + return order; + } + + @Override + public PageResult queryWithOut(Integer pageIndex, Integer pageSize, + QuerySaleOrderWithOutVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + SaleConfig saleConfig = saleConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithOut(vo, + saleConfig.getOutStockMultipleRelateSale()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = ScOpLogType.SALE, name = "创建销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建订单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSaleOrderVo vo) { + + SaleOrder order = new SaleOrder(); + order.setId(IdUtil.getId()); + order.setCode(generateCodeService.generate(GenerateCodeTypePool.SALE_ORDER)); + + this.create(order, vo); + + order.setStatus(SaleOrderStatus.CREATED); + + getBaseMapper().insert(order); + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + return order.getId(); + } + + @OpLog(type = ScOpLogType.SALE, name = "修改销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改订单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleOrderVo vo) { + + SaleOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED + && order.getStatus() != SaleOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,无法修改!"); + } + + throw new DefaultClientException("订单无法修改!"); + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOrderDetail.class) + .eq(SaleOrderDetail::getOrderId, order.getId()); + saleOrderDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class).eq(SaleOrderDetailBundle::getOrderId, order.getId()); + saleOrderDetailBundleService.remove(deleteDetailBundleWrapper); + + this.create(order, vo); + + order.setStatus(SaleOrderStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SaleOrderStatus.CREATED); + statusList.add(SaleOrderStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, null).set(SaleOrder::getApproveTime, null) + .set(SaleOrder::getRefuseReason, StringPool.EMPTY_STR).eq(SaleOrder::getId, order.getId()) + .in(SaleOrder::getStatus, statusList); + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.SALE, name = "审核通过销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSaleOrderVo vo) { + + SaleOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED + && order.getStatus() != SaleOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核通过!"); + } + + order.setStatus(SaleOrderStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(SaleOrderStatus.CREATED); + statusList.add(SaleOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOrder::getApproveTime, LocalDateTime.now()).eq(SaleOrder::getId, order.getId()) + .in(SaleOrder::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(SaleOrder::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(order.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有约定支付,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleOrderDetail.class) + .eq(SaleOrderDetail::getOrderId, order.getId()) + .orderByAsc(SaleOrderDetail::getOrderNo); + List details = saleOrderDetailService.list(queryDetailWrapper); + + int totalNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + + for (SaleOrderDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum())); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + if (isGift) { + giftNum += detail.getOrderNum(); + } else { + totalNum += detail.getOrderNum(); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class).eq(SaleOrderDetailBundle::getOrderId, order.getId()) + .eq(SaleOrderDetailBundle::getDetailId, detail.getId()); + List saleOrderDetailBundles = saleOrderDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(saleOrderDetailBundles); + + for (SaleOrderDetailBundle saleOrderDetailBundle : saleOrderDetailBundles) { + SaleOrderDetail newDetail = new SaleOrderDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setOrderId(order.getId()); + newDetail.setProductId(saleOrderDetailBundle.getProductId()); + newDetail.setOrderNum(saleOrderDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(saleOrderDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(saleOrderDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(saleOrderDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(detail.getOrderNo()); + newDetail.setOriBundleDetailId(detail.getId()); + + saleOrderDetailService.save(newDetail); + saleOrderDetailService.removeById(detail.getId()); + + saleOrderDetailBundle.setProductDetailId(newDetail.getId()); + saleOrderDetailBundleService.updateById(saleOrderDetailBundle); + + if (isGift) { + giftNum += newDetail.getOrderNum(); + } else { + totalNum += newDetail.getOrderNum(); + } + } + } + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getTotalNum, totalNum).set(SaleOrder::getTotalGiftNum, giftNum) + .set(SaleOrder::getTotalAmount, totalAmount).eq(SaleOrder::getId, order.getId()); + this.update(updateWrapper); + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + + this.sendApprovePassEvent(order); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassSaleOrderVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassSaleOrderVo approvePassSaleOrderVo = new ApprovePassSaleOrderVo(); + approvePassSaleOrderVo.setId(id); + + try { + SaleOrderService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassSaleOrderVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售订单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSaleOrderVo vo) { + + SaleOrderService thisService = getThis(this.getClass()); + + String orderId = thisService.create(vo); + + ApprovePassSaleOrderVo approvePassSaleOrderVo = new ApprovePassSaleOrderVo(); + approvePassSaleOrderVo.setId(orderId); + approvePassSaleOrderVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassSaleOrderVo); + + return orderId; + } + + @OpLog(type = ScOpLogType.SALE, name = "审核拒绝销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSaleOrderVo vo) { + + SaleOrder order = getBaseMapper().selectById(vo.getId()); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + if (order.getStatus() == SaleOrderStatus.APPROVE_REFUSE) { + throw new DefaultClientException("订单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核拒绝!"); + } + + order.setStatus(SaleOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOrder::getApproveTime, LocalDateTime.now()) + .set(SaleOrder::getRefuseReason, vo.getRefuseReason()).eq(SaleOrder::getId, order.getId()) + .eq(SaleOrder::getStatus, SaleOrderStatus.CREATED); + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseSaleOrderVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseSaleOrderVo approveRefuseSaleOrderVo = new ApproveRefuseSaleOrderVo(); + approveRefuseSaleOrderVo.setId(id); + approveRefuseSaleOrderVo.setRefuseReason(vo.getRefuseReason()); + + try { + SaleOrderService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseSaleOrderVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售订单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.SALE, name = "删除销售订单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SaleOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED + && order.getStatus() != SaleOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的销售单据不允许执行删除操作!"); + } + + throw new DefaultClientException("订单无法删除!"); + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOrderDetail.class) + .eq(SaleOrderDetail::getOrderId, order.getId()); + saleOrderDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class).eq(SaleOrderDetailBundle::getOrderId, order.getId()); + saleOrderDetailBundleService.remove(deleteDetailBundleWrapper); + + // 删除订单 + getBaseMapper().deleteById(id); + + orderPayTypeService.deleteByOrderId(id); + + OpLogUtil.setVariable("code", order.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + SaleOrderService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售订单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Override + public PageResult querySaleByCondition(Integer pageIndex, Integer pageSize, + String condition, Boolean isReturn) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().querySaleByCondition(condition, + isReturn); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult querySaleList(Integer pageIndex, Integer pageSize, + QuerySaleProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().querySaleList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public SaleProductDto getSaleById(String id) { + + SaleProductDto data = getBaseMapper().getSaleById(id); + + return data; + } + @OpLog(type = ScOpLogType.SALE, name = "发送销售订单审批流程给ydool系统,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_SEND, orderId = "#id", name = "发送销售订单审批流程给ydool系统") + @Transactional(rollbackFor = Exception.class) + @Override + public InvokeResult sendApprove(String id) { + SaleOrderFullDto order = getBaseMapper().getDetail(id); + if (order == null) { + throw new InputErrorException("销售订单不存在!"); + } + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("销售订单已审核通过,无需再次审核!"); + } + if (order.getStatus() == SaleOrderStatus.APPROVE_ING) { + throw new DefaultClientException("销售订单正在审核中,请勿重复推送"); + } + + GetSaleOrderBo result = new GetSaleOrderBo(order); + + String salerCode = result.getSalerCode(); + + if (StringUtil.isBlank(salerCode)) { + throw new DefaultClientException("销售员不存在,无法发起审核!"); + } + + List details = result.getDetails(); + + List list = details.stream().map(detail -> { + return Dict.create() + .set("goods_number", detail.getProductCode()) + .set("goods_name", detail.getProductName()) + .set("number", detail.getOrderNum()) + .set("money", new BigDecimal(detail.getOrderNum()).multiply(detail.getTaxPrice())); + }).collect(Collectors.toList()); + Dict dict = Dict.create(); + dict.set("user_id", salerCode) + .set("order_id", id) + .set("all_money", result.getTotalAmount()) + .set("customer", result.getCustomerName()) + .set("audit_person_ids", "120,262") + .set("push_person_ids", "120,262") + .set("remark", result.getDescription()) + .set("ghd_goodlist_info", list); + String jsonString = JSONObject.toJSONString(dict); + String json = HttpUtil.post("https://nb.ydool.com/api/ydoolerp/erp_ajax.ashx/send_xs", jsonString); + // 修改订单状态 + SaleOrder saleOrder = getById(id); + saleOrder.setStatus(SaleOrderStatus.APPROVE_ING); + int update = getBaseMapper().updateById(saleOrder); + InvokeResult success = InvokeResultBuilder.success(); + success.setMsg(jsonString); + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setVariable("id", id); + OpLogUtil.setExtra(dict); + return update > 0 ? success : InvokeResultBuilder.fail(jsonString); + } + @Transactional(rollbackFor = Exception.class) + @Override + public void approve(YdoolApproveOrderVo vo) { + String status = vo.getStatus(); + if ("y".equals(status)) { + this.approvePass(vo.getId(), vo.getMsg()); + } else { + this.approveRefuse(vo.getId(), vo.getMsg()); + } + } + + private void create(SaleOrder order, CreateSaleOrderVo vo) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + order.setScId(vo.getScId()); + + Customer customer = customerService.findById(vo.getCustomerId()); + if (customer == null) { + throw new InputErrorException("客户不存在!"); + } + order.setCustomerId(vo.getCustomerId()); + + if (!StringUtil.isBlank(vo.getSalerId())) { + UserDto saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + order.setSalerId(vo.getSalerId()); + } + + int totalNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (SaleProductVo productVo : vo.getProducts()) { + + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (isGift) { + giftNum += productVo.getOrderNum(); + } else { + totalNum += productVo.getOrderNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getTaxPrice(), productVo.getOrderNum())); + + SaleOrderDetail orderDetail = new SaleOrderDetail(); + orderDetail.setId(IdUtil.getId()); + orderDetail.setOrderId(order.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getTaxPrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许2位小数!"); + } + + orderDetail.setProductId(productVo.getProductId()); + orderDetail.setOrderNum(productVo.getOrderNum()); + orderDetail.setOriPrice(productVo.getOriPrice()); + orderDetail.setDiscountRate(productVo.getDiscountRate()); + orderDetail.setTaxPrice(productVo.getTaxPrice()); + orderDetail.setIsGift(isGift); + orderDetail.setTaxRate(product.getSaleTaxRate()); + orderDetail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + orderDetail.setOrderNo(orderNo); + + saleOrderDetailService.save(orderDetail); + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getSalePrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(orderDetail.getTaxPrice(), + bundleWeight, 2); + List saleOrderDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + SaleOrderDetailBundle saleOrderDetailBundle = new SaleOrderDetailBundle(); + saleOrderDetailBundle.setId(IdUtil.getId()); + saleOrderDetailBundle.setOrderId(order.getId()); + saleOrderDetailBundle.setDetailId(orderDetail.getId()); + saleOrderDetailBundle.setMainProductId(product.getId()); + saleOrderDetailBundle.setOrderNum(orderDetail.getOrderNum()); + saleOrderDetailBundle.setProductId(productBundle.getProductId()); + saleOrderDetailBundle.setProductOrderNum( + NumberUtil.mul(orderDetail.getOrderNum(), productBundle.getBundleNum()) + .intValue()); + saleOrderDetailBundle.setProductOriPrice(productBundle.getSalePrice()); + // 这里会有尾差 + saleOrderDetailBundle.setProductTaxPrice(NumberUtil.getNumber(NumberUtil.div( + BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue()), productBundle.getBundleNum()), 2)); + saleOrderDetailBundle.setProductTaxRate(bundle.getSaleTaxRate()); + + return saleOrderDetailBundle; + }).collect(Collectors.toList()); + + saleOrderDetailBundleService.saveBatch(saleOrderDetailBundles); + } + orderNo++; + } + order.setTotalNum(totalNum); + order.setTotalGiftNum(giftNum); + order.setTotalAmount(totalAmount); + order.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + orderPayTypeService.create(order.getId(), vo.getPayTypes()); + } + + private void sendApprovePassEvent(SaleOrder order) { + + ApprovePassSaleOrderEvent event = new ApprovePassSaleOrderEvent(this); + event.setId(order.getId()); + event.setTotalAmount(order.getTotalAmount()); + event.setApproveTime(order.getApproveTime()); + + ApplicationUtil.publishEvent(event); + } + + + @Transactional(rollbackFor = Exception.class) + public void approvePass(String id, String description) { + + SaleOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + if (order.getStatus() != SaleOrderStatus.APPROVE_ING) { + throw new DefaultClientException("订单无法审核通过!"); + } + + if (order.getStatus() != SaleOrderStatus.CREATED + && order.getStatus() != SaleOrderStatus.APPROVE_ING + && order.getStatus() != SaleOrderStatus.APPROVE_REFUSE) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核通过!"); + } + + order.setStatus(SaleOrderStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(SaleOrderStatus.APPROVE_ING); + + + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, user.getId()) + .set(SaleOrder::getApproveTime, LocalDateTime.now()).eq(SaleOrder::getId, order.getId()) + .in(SaleOrder::getStatus, statusList); + if (!StringUtil.isBlank(description)) { + updateOrderWrapper.set(SaleOrder::getDescription, description); + } + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + if (NumberUtil.gt(order.getTotalAmount(), BigDecimal.ZERO)) { + List orderPayTypes = orderPayTypeService.findByOrderId(order.getId()); + if (CollectionUtil.isEmpty(orderPayTypes)) { + throw new DefaultClientException("单据没有约定支付,请检查!"); + } + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleOrderDetail.class) + .eq(SaleOrderDetail::getOrderId, order.getId()) + .orderByAsc(SaleOrderDetail::getOrderNo); + List details = saleOrderDetailService.list(queryDetailWrapper); + + int totalNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + + for (SaleOrderDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum())); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + if (isGift) { + giftNum += detail.getOrderNum(); + } else { + totalNum += detail.getOrderNum(); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class).eq(SaleOrderDetailBundle::getOrderId, order.getId()) + .eq(SaleOrderDetailBundle::getDetailId, detail.getId()); + List saleOrderDetailBundles = saleOrderDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(saleOrderDetailBundles); + + for (SaleOrderDetailBundle saleOrderDetailBundle : saleOrderDetailBundles) { + SaleOrderDetail newDetail = new SaleOrderDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setOrderId(order.getId()); + newDetail.setProductId(saleOrderDetailBundle.getProductId()); + newDetail.setOrderNum(saleOrderDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(saleOrderDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(saleOrderDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(saleOrderDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(detail.getOrderNo()); + newDetail.setOriBundleDetailId(detail.getId()); + + saleOrderDetailService.save(newDetail); + saleOrderDetailService.removeById(detail.getId()); + + saleOrderDetailBundle.setProductDetailId(newDetail.getId()); + saleOrderDetailBundleService.updateById(saleOrderDetailBundle); + + if (isGift) { + giftNum += newDetail.getOrderNum(); + } else { + totalNum += newDetail.getOrderNum(); + } + } + } + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getTotalNum, totalNum).set(SaleOrder::getTotalGiftNum, giftNum) + .set(SaleOrder::getTotalAmount, totalAmount).eq(SaleOrder::getId, order.getId()); + this.update(updateWrapper); + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApprovePassSaleOrderVo vo = new ApprovePassSaleOrderVo(); + vo.setId(id); + vo.setDescription(description); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核通过销售订单,单号:%s", order.getCode())); + opLogs.setLogType(ScOpLogType.SALE); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(order.getId()); + orderTimeLine.setContent("审核通过"); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_PASS); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + + this.sendApprovePassEvent(order); + } + + + @Transactional(rollbackFor = Exception.class) + public void approveRefuse(String id, String refuseReason) { + + if (StringUtil.isBlank(refuseReason)) { + throw new InputErrorException("请输入拒绝理由!"); + } + + SaleOrder order = getBaseMapper().selectById(id); + if (order == null) { + throw new InputErrorException("订单不存在!"); + } + + if (order.getStatus() != SaleOrderStatus.APPROVE_ING) { + + if (order.getStatus() == SaleOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("订单已审核通过,不允许继续执行审核!"); + } + + if (order.getStatus() == SaleOrderStatus.APPROVE_REFUSE) { + throw new DefaultClientException("订单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("订单无法审核拒绝!"); + } + + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + order.setStatus(SaleOrderStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOrder.class) + .set(SaleOrder::getApproveBy, user.getId()) + .set(SaleOrder::getApproveTime, LocalDateTime.now()) + .set(SaleOrder::getRefuseReason, refuseReason).eq(SaleOrder::getId, order.getId()) + .eq(SaleOrder::getStatus, SaleOrderStatus.APPROVE_ING); + if (getBaseMapper().updateAllColumn(order, updateOrderWrapper) != 1) { + throw new DefaultClientException("订单信息已过期,请刷新重试!"); + } + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApproveRefusePurchaseOrderVo vo = new ApproveRefusePurchaseOrderVo(); + vo.setId(id); + vo.setRefuseReason(refuseReason); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核拒绝销售订单,单号:%s", order.getCode())); + opLogs.setLogType(ScOpLogType.SALE); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(order.getId()); + orderTimeLine.setContent(String.format("审核拒绝,拒绝理由:%s", refuseReason)); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_RETURN); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailBundleServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailBundleServiceImpl.java new file mode 100644 index 0000000..a0f74d2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailBundleServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.SaleOutSheetDetailBundleMapper; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailBundleService; +import org.springframework.stereotype.Service; + +@Service +public class SaleOutSheetDetailBundleServiceImpl extends + BaseMpServiceImpl + implements SaleOutSheetDetailBundleService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailLotServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailLotServiceImpl.java new file mode 100644 index 0000000..5789e95 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailLotServiceImpl.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; +import com.lframework.xingyun.sc.mappers.SaleOutSheetDetailLotMapper; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SaleOutSheetDetailLotServiceImpl + extends BaseMpServiceImpl + implements SaleOutSheetDetailLotService { + + @Autowired + private ProductService productService; + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Override + public SaleOutSheetDetailLotDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetailLot detail = getBaseMapper().selectById(id); + + Integer remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()).intValue(); + if (NumberUtil.lt(remainNum, num)) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + + saleOutSheetDetailService.addReturnNum(detail.getDetailId(), num); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetailLot detail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(detail.getReturnNum(), num)) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + detail.getReturnNum() + + "个,本次取消退货数量不允许大于" + detail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(detail.getId(), num) != 1) { + SaleOutSheetDetail sheetDetail = saleOutSheetDetailService.getById(detail.getDetailId()); + + Product product = productService.findById(sheetDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + + saleOutSheetDetailService.subReturnNum(detail.getDetailId(), num); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailServiceImpl.java new file mode 100644 index 0000000..8a257f0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetDetailServiceImpl.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; +import com.lframework.xingyun.sc.mappers.SaleOutSheetDetailMapper; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailBundleService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import java.math.BigDecimal; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SaleOutSheetDetailServiceImpl extends + BaseMpServiceImpl + implements SaleOutSheetDetailService { + + @Autowired + private ProductService productService; + + @Autowired + private SaleOutSheetDetailBundleService saleOutSheetDetailBundleService; + + @Override + public List getBySheetId(String sheetId) { + + return getBaseMapper().getBySheetId(sheetId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetail detail = getBaseMapper().selectById(id); + + Integer remainNum = NumberUtil.sub(detail.getOrderNum(), detail.getReturnNum()).intValue(); + if (NumberUtil.lt(remainNum, num)) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量为" + remainNum + + "个,本次退货数量不允许大于" + + remainNum + "个!"); + } + + if (getBaseMapper().addReturnNum(detail.getId(), num) != 1) { + Product product = productService.findById(detail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "剩余退货数量不足,不允许继续退货!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void subReturnNum(String id, Integer num) { + + Assert.notBlank(id); + Assert.greaterThanZero(num); + + SaleOutSheetDetail orderDetail = getBaseMapper().selectById(id); + + if (NumberUtil.lt(orderDetail.getReturnNum(), num)) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量为" + + orderDetail.getReturnNum() + + "个,本次取消退货数量不允许大于" + orderDetail.getReturnNum() + "个!"); + } + + if (getBaseMapper().subReturnNum(orderDetail.getId(), num) != 1) { + Product product = productService.findById(orderDetail.getProductId()); + + throw new DefaultClientException( + "(" + product.getCode() + ")" + product.getName() + "已退货数量不足,不允许取消退货!"); + } + } + + @Override + public BigDecimal getTotalWeightBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .in(SaleOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumWeight = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = saleOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getWeight() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置重量,请检查!"); + } + + return NumberUtil.mul(targetProduct.getWeight(), b.getProductOrderNum()); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getWeight() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置重量,请检查!"); + } + return NumberUtil.mul(t.getOrderNum(), product.getWeight()); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumWeight; + } + + @Override + public BigDecimal getTotalVolumeBySheetIds(List sheetIds) { + if (CollectionUtil.isEmpty(sheetIds)) { + return BigDecimal.ZERO; + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .in(SaleOutSheetDetail::getSheetId, sheetIds); + List details = this.list(queryWrapper); + BigDecimal sumVolume = details.stream().map(t -> { + Product product = productService.findById(t.getProductId()); + if (product.getProductType() == ProductType.BUNDLE) { + Wrapper detailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getDetailId, t.getId()); + List detailBundles = saleOutSheetDetailBundleService.list( + detailBundleWrapper); + return detailBundles.stream().map(b -> { + Product targetProduct = productService.findById(b.getProductId()); + if (targetProduct.getVolume() == null) { + throw new DefaultClientException( + "商品(" + targetProduct.getCode() + ")" + targetProduct.getName() + + "尚未设置体积,请检查!"); + } + + return NumberUtil.mul(targetProduct.getVolume(), b.getProductOrderNum()); + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + } else { + if (product.getVolume() == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "尚未设置体积,请检查!"); + } + return NumberUtil.mul(t.getOrderNum(), product.getVolume()); + } + }).reduce(NumberUtil::add).orElse(BigDecimal.ZERO); + + return sumVolume; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetServiceImpl.java new file mode 100644 index 0000000..3b2b1c3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleOutSheetServiceImpl.java @@ -0,0 +1,939 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.enums.SettleType; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.utils.SplitNumberUtil; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.mappers.SaleOutSheetMapper; +import com.lframework.xingyun.sc.service.logistics.LogisticsSheetDetailService; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailBundleService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOrderService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailBundleService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.sale.out.ApprovePassSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.ApproveRefuseSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.BatchApprovePassSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.BatchApproveRefuseSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.CreateSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.sale.out.SaleOutProductVo; +import com.lframework.xingyun.sc.vo.sale.out.SaleOutSheetSelectorVo; +import com.lframework.xingyun.sc.vo.sale.out.UpdateSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SaleOutSheetServiceImpl extends BaseMpServiceImpl + implements SaleOutSheetService { + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Autowired + private SaleOutSheetDetailLotService saleOutSheetDetailLotService; + + @Autowired + private SaleOutSheetDetailBundleService saleOutSheetDetailBundleService; + + @Autowired + private SaleOrderDetailBundleService saleOrderDetailBundleService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private CustomerService customerService; + + @Autowired + private UserService userService; + + @Autowired + private SaleOrderService saleOrderService; + + @Autowired + private ProductService productService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private SaleConfigService saleConfigService; + + @Autowired + private SaleOrderDetailService saleOrderDetailService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private LogisticsSheetDetailService logisticsSheetDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySaleOutSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySaleOutSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SaleOutSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public GetPaymentDateDto getPaymentDate(String customerId) { + + //默认为当前日期的30天后,如当天为2021-10-01,则付款日期默认为2021-11-01 + //(1)客户的结账方式为“任意指定”,则付款日期按照以上规则展示默认值,允许用户更改,但仅能选择当天及当天之后的日期。 + //(2)客户的结账方式为“货到付款”(这个参数的名字后期会改,如“货销付款”),则付款日期默认为此刻,且不允许修改,即出库单的创建时间,可能会遇到跨日的问题,但付款日期,均赋值为出库单的创建日期。 + + Customer customer = customerService.findById(customerId); + + GetPaymentDateDto result = new GetPaymentDateDto(); + result.setAllowModify(customer.getSettleType() == SettleType.ARBITRARILY); + + if (customer.getSettleType() == SettleType.ARBITRARILY) { + result.setPaymentDate(LocalDate.now().plusMonths(1)); + } else if (customer.getSettleType() == SettleType.CASH_ON_DELIVERY) { + result.setPaymentDate(LocalDate.now()); + } + + return result; + } + + @Override + public SaleOutSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @Override + public SaleOutSheetWithReturnDto getWithReturn(String id) { + + SaleConfig saleConfig = saleConfigService.get(); + + SaleOutSheetWithReturnDto sheet = getBaseMapper().getWithReturn(id, + saleConfig.getSaleReturnRequireOutStock()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + return sheet; + } + + @Override + public PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QuerySaleOutSheetWithReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + SaleConfig saleConfig = saleConfigService.get(); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryWithReturn(vo, + saleConfig.getSaleReturnMultipleRelateOutStock()); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = ScOpLogType.SALE, name = "创建销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSaleOutSheetVo vo) { + + SaleOutSheet sheet = new SaleOutSheet(); + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SALE_OUT_SHEET)); + + SaleConfig saleConfig = saleConfigService.get(); + + this.create(sheet, vo, saleConfig.getOutStockRequireSale()); + + sheet.setStatus(SaleOutSheetStatus.CREATED); + + getBaseMapper().insert(sheet); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + return sheet.getId(); + } + + @OpLog(type = ScOpLogType.SALE, name = "修改销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改出库单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleOutSheetVo vo) { + + SaleOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED + && sheet.getStatus() != SaleOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("销售出库单已审核通过,无法修改!"); + } + + throw new DefaultClientException("销售出库单无法修改!"); + } + + boolean requireSale = !StringUtil.isBlank(sheet.getSaleOrderId()); + + if (requireSale) { + //查询出库单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + List details = saleOutSheetDetailService.list(queryDetailWrapper); + for (SaleOutSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getSaleOrderDetailId())) { + //先恢复已出库数量 + saleOrderDetailService.subOutNum(detail.getSaleOrderDetailId(), detail.getOrderNum()); + } + } + } + + // 删除出库单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + saleOutSheetDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getSheetId, sheet.getId()); + saleOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + this.create(sheet, vo, requireSale); + + sheet.setStatus(SaleOutSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SaleOutSheetStatus.CREATED); + statusList.add(SaleOutSheetStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getApproveBy, null).set(SaleOutSheet::getApproveTime, null) + .set(SaleOutSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(SaleOutSheet::getId, sheet.getId()) + .in(SaleOutSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.SALE, name = "审核通过销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSaleOutSheetVo vo) { + + SaleOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED + && sheet.getStatus() != SaleOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("销售出库单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售出库单无法审核通过!"); + } + + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getOutStockMultipleRelateSale()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleOutSheet.class) + .eq(SaleOutSheet::getSaleOrderId, sheet.getSaleOrderId()) + .ne(SaleOutSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + SaleOrder purchaseOrder = saleOrderService.getById(sheet.getSaleOrderId()); + throw new DefaultClientException( + "销售订单号:" + purchaseOrder.getCode() + + ",已关联其他销售出库单,不允许关联多个销售出库单!"); + } + } + + if (saleConfig.getOutStockRequireLogistics()) { + // 关联物流单 + LogisticsSheetDetail logisticsSheetDetail = logisticsSheetDetailService.getByBizId( + sheet.getId(), LogisticsSheetDetailBizType.SALE_OUT_SHEET); + if (logisticsSheetDetail == null) { + throw new DefaultClientException("销售出库单尚未发货,无法审核通过!"); + } + } + + sheet.setStatus(SaleOutSheetStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(SaleOutSheetStatus.CREATED); + statusList.add(SaleOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOutSheet::getApproveTime, LocalDateTime.now()) + .eq(SaleOutSheet::getId, sheet.getId()) + .in(SaleOutSheet::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(SaleOutSheet::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售出库单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(SaleOutSheetDetail::getOrderNo); + List details = saleOutSheetDetailService.list(queryDetailWrapper); + + int totalNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SaleOutSheetDetail detail : details) { + boolean isGift = detail.getIsGift(); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getOrderNum())); + + Product product = productService.findById(detail.getProductId()); + if (product.getProductType() == ProductType.NORMAL) { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(detail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(detail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.SALE.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + SaleOutSheetDetailLot detailLot = new SaleOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(detail.getId()); + detailLot.setOrderNum(detail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(detail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + saleOutSheetDetailLotService.save(detailLot); + + if (isGift) { + giftNum += detail.getOrderNum(); + } else { + totalNum += detail.getOrderNum(); + } + } else { + Wrapper queryBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getSheetId, sheet.getId()) + .eq(SaleOutSheetDetailBundle::getDetailId, detail.getId()); + List saleOutSheetDetailBundles = saleOutSheetDetailBundleService.list( + queryBundleWrapper); + Assert.notEmpty(saleOutSheetDetailBundles); + + for (SaleOutSheetDetailBundle saleOutSheetDetailBundle : saleOutSheetDetailBundles) { + SaleOutSheetDetail newDetail = new SaleOutSheetDetail(); + newDetail.setId(IdUtil.getId()); + newDetail.setSheetId(sheet.getId()); + newDetail.setProductId(saleOutSheetDetailBundle.getProductId()); + newDetail.setOrderNum(saleOutSheetDetailBundle.getProductOrderNum()); + newDetail.setOriPrice(saleOutSheetDetailBundle.getProductOriPrice()); + newDetail.setTaxPrice(saleOutSheetDetailBundle.getProductTaxPrice()); + newDetail.setDiscountRate(detail.getDiscountRate()); + newDetail.setIsGift(detail.getIsGift()); + newDetail.setTaxRate(saleOutSheetDetailBundle.getProductTaxRate()); + newDetail.setDescription(detail.getDescription()); + newDetail.setOrderNo(orderNo++); + newDetail.setSettleStatus(detail.getSettleStatus()); + newDetail.setSaleOrderDetailId(detail.getSaleOrderDetailId()); + newDetail.setOriBundleDetailId(detail.getId()); + + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(newDetail.getProductId()); + subProductStockVo.setScId(sheet.getScId()); + subProductStockVo.setStockNum(newDetail.getOrderNum()); + subProductStockVo.setBizId(sheet.getId()); + subProductStockVo.setBizDetailId(newDetail.getId()); + subProductStockVo.setBizCode(sheet.getCode()); + subProductStockVo.setBizType(ProductStockBizType.SALE.getCode()); + + ProductStockChangeDto stockChange = productStockService.subStock(subProductStockVo); + + SaleOutSheetDetailLot detailLot = new SaleOutSheetDetailLot(); + + detailLot.setId(IdUtil.getId()); + detailLot.setDetailId(newDetail.getId()); + detailLot.setOrderNum(newDetail.getOrderNum()); + detailLot.setCostTaxAmount(stockChange.getTaxAmount()); + detailLot.setSettleStatus(newDetail.getSettleStatus()); + detailLot.setOrderNo(orderNo); + saleOutSheetDetailLotService.save(detailLot); + + saleOutSheetDetailService.save(newDetail); + saleOutSheetDetailService.removeById(detail.getId()); + + saleOutSheetDetailBundle.setProductDetailId(newDetail.getId()); + saleOutSheetDetailBundleService.updateById(saleOutSheetDetailBundle); + + if (isGift) { + giftNum += newDetail.getOrderNum(); + } else { + totalNum += newDetail.getOrderNum(); + } + } + } + orderNo++; + } + + // 这里需要重新统计明细信息,因为明细发生变动了 + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getTotalNum, totalNum).set(SaleOutSheet::getTotalGiftNum, giftNum) + .set(SaleOutSheet::getTotalAmount, totalAmount).eq(SaleOutSheet::getId, sheet.getId()); + this.update(updateWrapper); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassSaleOutSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassSaleOutSheetVo approvePassVo = new ApprovePassSaleOutSheetVo(); + approvePassVo.setId(id); + + try { + SaleOutSheetService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售出库单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSaleOutSheetVo vo) { + + SaleOutSheetService thisService = getThis(this.getClass()); + + String sheetId = thisService.create(vo); + + ApprovePassSaleOutSheetVo approvePassVo = new ApprovePassSaleOutSheetVo(); + approvePassVo.setId(sheetId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return sheetId; + } + + @OpLog(type = ScOpLogType.SALE, name = "审核拒绝销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSaleOutSheetVo vo) { + + SaleOutSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("销售出库单已审核通过,不允许继续执行审核!"); + } + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("销售出库单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售出库单无法审核拒绝!"); + } + + sheet.setStatus(SaleOutSheetStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleOutSheet::getApproveTime, LocalDateTime.now()) + .set(SaleOutSheet::getRefuseReason, vo.getRefuseReason()) + .eq(SaleOutSheet::getId, sheet.getId()) + .eq(SaleOutSheet::getStatus, SaleOutSheetStatus.CREATED); + if (getBaseMapper().updateAllColumn(sheet, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售出库单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseSaleOutSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseSaleOutSheetVo approveRefuseVo = new ApproveRefuseSaleOutSheetVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + SaleOutSheetService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售出库单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.SALE, name = "删除销售出库单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SaleOutSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("销售出库单不存在!"); + } + + if (sheet.getStatus() != SaleOutSheetStatus.CREATED + && sheet.getStatus() != SaleOutSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SaleOutSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的销售出库单不允许执行删除操作!"); + } + + throw new DefaultClientException("销售出库单无法删除!"); + } + + if (logisticsSheetDetailService.getByBizId(sheet.getId(), + LogisticsSheetDetailBizType.SALE_OUT_SHEET) != null) { + throw new DefaultClientException("销售出库单已关联物流单,请先删除物流单!"); + } + + //查询销售出库单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + List details = saleOutSheetDetailService.list(queryDetailWrapper); + + if (!StringUtil.isBlank(sheet.getSaleOrderId())) { + for (SaleOutSheetDetail detail : details) { + if (!StringUtil.isBlank(detail.getSaleOrderDetailId())) { + //恢复已出库数量 + saleOrderDetailService.subOutNum(detail.getSaleOrderDetailId(), detail.getOrderNum()); + } + } + } + + // 删除订单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleOutSheetDetail.class) + .eq(SaleOutSheetDetail::getSheetId, sheet.getId()); + saleOutSheetDetailService.remove(deleteDetailWrapper); + + // 删除组合商品信息 + Wrapper deleteDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailBundle.class).eq(SaleOutSheetDetailBundle::getSheetId, sheet.getId()); + saleOutSheetDetailBundleService.remove(deleteDetailBundleWrapper); + + Wrapper deleteDetailLotWrapper = Wrappers.lambdaQuery( + SaleOutSheetDetailLot.class) + .in(SaleOutSheetDetailLot::getDetailId, + details.stream().map(SaleOutSheetDetail::getId).collect( + Collectors.toList())); + saleOutSheetDetailLotService.remove(deleteDetailLotWrapper); + + // 删除订单 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + SaleOutSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售出库单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(SaleOutSheet::getId, id) + .eq(SaleOutSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getSettleStatus, SettleStatus.PART_SETTLE).eq(SaleOutSheet::getId, id) + .in(SaleOutSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleOutSheet.class) + .set(SaleOutSheet::getSettleStatus, SettleStatus.SETTLED).eq(SaleOutSheet::getId, id) + .in(SaleOutSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(SaleOutSheet sheet, CreateSaleOutSheetVo vo, boolean requireSale) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + sheet.setScId(vo.getScId()); + + Customer customer = customerService.findById(vo.getCustomerId()); + if (customer == null) { + throw new InputErrorException("客户不存在!"); + } + sheet.setCustomerId(vo.getCustomerId()); + + if (!StringUtil.isBlank(vo.getSalerId())) { + UserDto saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + sheet.setSalerId(vo.getSalerId()); + } + + SaleConfig saleConfig = saleConfigService.get(); + + GetPaymentDateDto paymentDate = this.getPaymentDate(customer.getId()); + + sheet.setPaymentDate( + vo.getAllowModifyPaymentDate() || paymentDate.getAllowModify() ? vo.getPaymentDate() + : paymentDate.getPaymentDate()); + + if (requireSale) { + + SaleOrder saleOrder = saleOrderService.getById(vo.getSaleOrderId()); + if (saleOrder == null) { + throw new DefaultClientException("销售订单不存在!"); + } + + sheet.setScId(saleOrder.getScId()); + sheet.setCustomerId(saleOrder.getCustomerId()); + sheet.setSaleOrderId(saleOrder.getId()); + + if (!saleConfig.getOutStockMultipleRelateSale()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleOutSheet.class) + .eq(SaleOutSheet::getSaleOrderId, saleOrder.getId()) + .ne(SaleOutSheet::getId, sheet.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException( + "销售订单号:" + saleOrder.getCode() + + ",已关联其他销售出库单,不允许关联多个销售出库单!"); + } + } + } + + int purchaseNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (SaleOutProductVo productVo : vo.getProducts()) { + if (requireSale) { + if (!StringUtil.isBlank(productVo.getSaleOrderDetailId())) { + SaleOrderDetail orderDetail = saleOrderDetailService.getById( + productVo.getSaleOrderDetailId()); + productVo.setOriPrice(orderDetail.getOriPrice()); + productVo.setTaxPrice(orderDetail.getTaxPrice()); + productVo.setDiscountRate(orderDetail.getDiscountRate()); + } else { + productVo.setTaxPrice(BigDecimal.ZERO); + productVo.setDiscountRate(BigDecimal.valueOf(100)); + } + } + + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (requireSale) { + if (StringUtil.isBlank(productVo.getSaleOrderDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum += productVo.getOrderNum(); + } else { + purchaseNum += productVo.getOrderNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getTaxPrice(), productVo.getOrderNum())); + + SaleOutSheetDetail detail = new SaleOutSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getTaxPrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许2位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setOrderNum(productVo.getOrderNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(customer)); + if (requireSale && !StringUtil.isBlank(productVo.getSaleOrderDetailId())) { + detail.setSaleOrderDetailId(productVo.getSaleOrderDetailId()); + saleOrderDetailService.addOutNum(productVo.getSaleOrderDetailId(), detail.getOrderNum()); + } + + saleOutSheetDetailService.save(detail); + + // 这里处理组合商品 + if (product.getProductType() == ProductType.BUNDLE) { + List productBundles = productBundleService.getByMainProductId( + product.getId()); + // 构建指标项 + Map bundleWeight = new HashMap<>(productBundles.size()); + for (ProductBundle productBundle : productBundles) { + bundleWeight.put(productBundle.getProductId(), + NumberUtil.mul(productBundle.getSalePrice(), productBundle.getBundleNum())); + } + Map splitPriceMap = SplitNumberUtil.split(detail.getTaxPrice(), + bundleWeight, 2); + List saleOutSheetDetailBundles = productBundles.stream() + .map(productBundle -> { + Product bundle = productService.findById(productBundle.getProductId()); + SaleOutSheetDetailBundle saleOutSheetDetailBundle = new SaleOutSheetDetailBundle(); + saleOutSheetDetailBundle.setId(IdUtil.getId()); + saleOutSheetDetailBundle.setSheetId(sheet.getId()); + saleOutSheetDetailBundle.setDetailId(detail.getId()); + saleOutSheetDetailBundle.setMainProductId(product.getId()); + saleOutSheetDetailBundle.setOrderNum(detail.getOrderNum()); + saleOutSheetDetailBundle.setProductId(productBundle.getProductId()); + saleOutSheetDetailBundle.setProductOrderNum( + NumberUtil.mul(detail.getOrderNum(), productBundle.getBundleNum()).intValue()); + saleOutSheetDetailBundle.setProductOriPrice(productBundle.getSalePrice()); + // 这里会有尾差 + saleOutSheetDetailBundle.setProductTaxPrice( + NumberUtil.getNumber(NumberUtil.div(BigDecimal.valueOf( + splitPriceMap.get(productBundle.getProductId()).doubleValue()), + productBundle.getBundleNum()), 2)); + saleOutSheetDetailBundle.setProductTaxRate(bundle.getSaleTaxRate()); + + return saleOutSheetDetailBundle; + }).collect(Collectors.toList()); + + saleOutSheetDetailBundleService.saveBatch(saleOutSheetDetailBundles); + } else { + if (requireSale && !StringUtil.isBlank(detail.getSaleOrderDetailId())) { + // 这里如果是关联销售单的话,需要把组合商品信息拿过来,价格不用重新算,因为关联销售单的话,价格不允许修改 + Wrapper querySaleOrderDetailBundleWrapper = Wrappers.lambdaQuery( + SaleOrderDetailBundle.class) + .eq(SaleOrderDetailBundle::getOrderId, sheet.getSaleOrderId()) + .eq(SaleOrderDetailBundle::getProductDetailId, detail.getSaleOrderDetailId()); + SaleOrderDetailBundle saleOrderDetailBundle = saleOrderDetailBundleService.getOne( + querySaleOrderDetailBundleWrapper); + if (saleOrderDetailBundle != null) { + SaleOutSheetDetailBundle saleOutSheetDetailBundle = new SaleOutSheetDetailBundle(); + saleOutSheetDetailBundle.setId(IdUtil.getId()); + saleOutSheetDetailBundle.setSheetId(sheet.getId()); + saleOutSheetDetailBundle.setDetailId(detail.getId()); + saleOutSheetDetailBundle.setMainProductId(saleOrderDetailBundle.getMainProductId()); + saleOutSheetDetailBundle.setOrderNum(detail.getOrderNum()); + saleOutSheetDetailBundle.setProductId(saleOrderDetailBundle.getProductId()); + saleOutSheetDetailBundle.setProductOrderNum(saleOrderDetailBundle.getProductOrderNum()); + saleOutSheetDetailBundle.setProductOriPrice(saleOrderDetailBundle.getProductOriPrice()); + saleOutSheetDetailBundle.setProductTaxPrice(saleOrderDetailBundle.getProductTaxPrice()); + saleOutSheetDetailBundle.setProductTaxRate(saleOrderDetailBundle.getProductTaxRate()); + saleOutSheetDetailBundle.setProductDetailId(detail.getId()); + saleOutSheetDetailBundleService.save(saleOutSheetDetailBundle); + } + } + } + orderNo++; + } + sheet.setTotalNum(purchaseNum); + sheet.setTotalGiftNum(giftNum); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setSettleStatus(this.getInitSettleStatus(customer)); + } + + /** + * 根据客户获取初始结算状态 + * + * @param customer + * @return + */ + private SettleStatus getInitSettleStatus(Customer customer) { + + return SettleStatus.UN_SETTLE; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnDetailServiceImpl.java new file mode 100644 index 0000000..a07fee8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.SaleReturnDetail; +import com.lframework.xingyun.sc.mappers.SaleReturnDetailMapper; +import com.lframework.xingyun.sc.service.sale.SaleReturnDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SaleReturnDetailServiceImpl extends + BaseMpServiceImpl + implements SaleReturnDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnServiceImpl.java new file mode 100644 index 0000000..eb5cbee --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/sale/SaleReturnServiceImpl.java @@ -0,0 +1,675 @@ +package com.lframework.xingyun.sc.impl.sale; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.events.order.impl.ApprovePassSaleReturnEvent; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.entity.SaleReturnDetail; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.mappers.SaleReturnMapper; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.service.sale.SaleReturnDetailService; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.sale.returned.ApprovePassSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.ApproveRefuseSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.BatchApprovePassSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.BatchApproveRefuseSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.CreateSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.QuerySaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.SaleReturnProductVo; +import com.lframework.xingyun.sc.vo.sale.returned.UpdateSaleReturnVo; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SaleReturnServiceImpl extends BaseMpServiceImpl + implements SaleReturnService { + + @Autowired + private SaleReturnDetailService saleReturnDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private StoreCenterService storeCenterService; + + @Autowired + private CustomerService customerService; + + @Autowired + private UserService userService; + + @Autowired + private ProductService productService; + + @Autowired + private SaleOutSheetService saleOutSheetService; + + @Autowired + private SaleConfigService saleConfigService; + + @Autowired + private SaleOutSheetDetailService saleOutSheetDetailService; + + @Autowired + private SaleOutSheetDetailLotService saleOutSheetDetailLotService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySaleReturnVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySaleReturnVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SaleReturnFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScOpLogType.SALE, name = "创建销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建退货单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSaleReturnVo vo) { + + SaleReturn saleReturn = new SaleReturn(); + saleReturn.setId(IdUtil.getId()); + saleReturn.setCode(generateCodeService.generate(GenerateCodeTypePool.SALE_RETURN)); + + SaleConfig saleConfig = saleConfigService.get(); + + this.create(saleReturn, vo, saleConfig.getSaleReturnRequireOutStock()); + + saleReturn.setStatus(SaleReturnStatus.CREATED); + + getBaseMapper().insert(saleReturn); + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + + return saleReturn.getId(); + } + + @OpLog(type = ScOpLogType.SALE, name = "修改销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改退货单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSaleReturnVo vo) { + + SaleReturn saleReturn = getBaseMapper().selectById(vo.getId()); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED + && saleReturn.getStatus() != SaleReturnStatus.APPROVE_REFUSE) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("销售退货单已审核通过,无法修改!"); + } + + throw new DefaultClientException("销售退货单无法修改!"); + } + + boolean requireOut = !StringUtil.isBlank(saleReturn.getOutSheetId()); + + if (requireOut) { + //查询销售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + List details = saleReturnDetailService.list(queryDetailWrapper); + for (SaleReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //先恢复已退货数量 + saleOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除销售退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + saleReturnDetailService.remove(deleteDetailWrapper); + + this.create(saleReturn, vo, requireOut); + + saleReturn.setStatus(SaleReturnStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SaleReturnStatus.CREATED); + statusList.add(SaleReturnStatus.APPROVE_REFUSE); + + Wrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getApproveBy, null).set(SaleReturn::getApproveTime, null) + .set(SaleReturn::getRefuseReason, StringPool.EMPTY_STR) + .eq(SaleReturn::getId, saleReturn.getId()) + .in(SaleReturn::getStatus, statusList); + if (getBaseMapper().updateAllColumn(saleReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.SALE, name = "审核通过销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSaleReturnVo vo) { + + SaleReturn saleReturn = getBaseMapper().selectById(vo.getId()); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED + && saleReturn.getStatus() != SaleReturnStatus.APPROVE_REFUSE) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("销售退货单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售退货单无法审核通过!"); + } + + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getSaleReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleReturn.class) + .eq(SaleReturn::getOutSheetId, saleReturn.getOutSheetId()) + .ne(SaleReturn::getId, saleReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + SaleOutSheet saleOutSheet = saleOutSheetService.getById(saleReturn.getOutSheetId()); + throw new DefaultClientException( + "销售出库单号:" + saleOutSheet.getCode() + + ",已关联其他销售退货单,不允许关联多个销售退货单!"); + } + } + + saleReturn.setStatus(SaleReturnStatus.APPROVE_PASS); + + List statusList = new ArrayList<>(); + statusList.add(SaleReturnStatus.CREATED); + statusList.add(SaleReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleReturn::getApproveTime, LocalDateTime.now()) + .eq(SaleReturn::getId, saleReturn.getId()) + .in(SaleReturn::getStatus, statusList); + if (!StringUtil.isBlank(vo.getDescription())) { + updateOrderWrapper.set(SaleReturn::getDescription, vo.getDescription()); + } + if (getBaseMapper().updateAllColumn(saleReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售退货单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()) + .orderByAsc(SaleReturnDetail::getOrderNo); + List details = saleReturnDetailService.list(queryDetailWrapper); + for (SaleReturnDetail detail : details) { + ProductPurchase productPurchase = productPurchaseService.getById(detail.getProductId()); + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(saleReturn.getScId()); + addProductStockVo.setStockNum(detail.getReturnNum()); + addProductStockVo.setDefaultTaxPrice(productPurchase.getPrice()); + addProductStockVo.setBizId(saleReturn.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(saleReturn.getCode()); + addProductStockVo.setBizType(ProductStockBizType.SALE_RETURN.getCode()); + + productStockService.addStock(addProductStockVo); + } + + this.sendApprovePassEvent(saleReturn); + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassSaleReturnVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassSaleReturnVo approvePassVo = new ApprovePassSaleReturnVo(); + approvePassVo.setId(id); + + try { + SaleReturnService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售退货单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSaleReturnVo vo) { + + SaleReturnService thisService = getThis(this.getClass()); + + String returnId = thisService.create(vo); + + ApprovePassSaleReturnVo approvePassVo = new ApprovePassSaleReturnVo(); + approvePassVo.setId(returnId); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return returnId; + } + + @OpLog(type = ScOpLogType.SALE, name = "审核拒绝销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSaleReturnVo vo) { + + SaleReturn saleReturn = getBaseMapper().selectById(vo.getId()); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("销售退货单已审核通过,不允许继续执行审核!"); + } + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_REFUSE) { + throw new DefaultClientException("销售退货单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("销售退货单无法审核拒绝!"); + } + + saleReturn.setStatus(SaleReturnStatus.APPROVE_REFUSE); + + LambdaUpdateWrapper updateOrderWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(SaleReturn::getApproveTime, LocalDateTime.now()) + .set(SaleReturn::getRefuseReason, vo.getRefuseReason()) + .eq(SaleReturn::getId, saleReturn.getId()) + .eq(SaleReturn::getStatus, SaleReturnStatus.CREATED); + if (getBaseMapper().updateAllColumn(saleReturn, updateOrderWrapper) != 1) { + throw new DefaultClientException("销售退货单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", saleReturn.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseSaleReturnVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseSaleReturnVo approveRefuseVo = new ApproveRefuseSaleReturnVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + SaleReturnService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售退货单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OpLog(type = ScOpLogType.SALE, name = "删除销售退货单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SaleReturn saleReturn = getBaseMapper().selectById(id); + if (saleReturn == null) { + throw new InputErrorException("销售退货单不存在!"); + } + + if (saleReturn.getStatus() != SaleReturnStatus.CREATED + && saleReturn.getStatus() != SaleReturnStatus.APPROVE_REFUSE) { + + if (saleReturn.getStatus() == SaleReturnStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的销售退货单不允许执行删除操作!"); + } + + throw new DefaultClientException("销售退货单无法删除!"); + } + + if (!StringUtil.isBlank(saleReturn.getOutSheetId())) { + //查询销售退货单明细 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + List details = saleReturnDetailService.list(queryDetailWrapper); + for (SaleReturnDetail detail : details) { + if (!StringUtil.isBlank(detail.getOutSheetDetailId())) { + //恢复已退货数量 + saleOutSheetDetailLotService.subReturnNum(detail.getOutSheetDetailId(), + detail.getReturnNum()); + } + } + } + + // 删除退货单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SaleReturnDetail.class) + .eq(SaleReturnDetail::getReturnId, saleReturn.getId()); + saleReturnDetailService.remove(deleteDetailWrapper); + + // 删除退货单 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", saleReturn.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + SaleReturnService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个销售退货单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getSettleStatus, SettleStatus.UN_SETTLE).eq(SaleReturn::getId, id) + .eq(SaleReturn::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getSettleStatus, SettleStatus.PART_SETTLE).eq(SaleReturn::getId, id) + .in(SaleReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SaleReturn.class) + .set(SaleReturn::getSettleStatus, SettleStatus.SETTLED).eq(SaleReturn::getId, id) + .in(SaleReturn::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(SaleReturn saleReturn, CreateSaleReturnVo vo, boolean requireOut) { + + StoreCenter sc = storeCenterService.findById(vo.getScId()); + if (sc == null) { + throw new InputErrorException("仓库不存在!"); + } + + saleReturn.setScId(vo.getScId()); + + Customer customer = customerService.findById(vo.getCustomerId()); + if (customer == null) { + throw new InputErrorException("客户不存在!"); + } + saleReturn.setCustomerId(vo.getCustomerId()); + + if (!StringUtil.isBlank(vo.getSalerId())) { + UserDto saler = userService.findById(vo.getSalerId()); + if (saler == null) { + throw new InputErrorException("销售员不存在!"); + } + + saleReturn.setSalerId(vo.getSalerId()); + } + + SaleConfig saleConfig = saleConfigService.get(); + + GetPaymentDateDto paymentDate = saleOutSheetService.getPaymentDate(customer.getId()); + + saleReturn.setPaymentDate( + paymentDate.getAllowModify() ? vo.getPaymentDate() : paymentDate.getPaymentDate()); + + if (requireOut) { + + SaleOutSheet saleOutSheet = saleOutSheetService.getById(vo.getOutSheetId()); + if (saleOutSheet == null) { + throw new DefaultClientException("销售出库单不存在!"); + } + + saleReturn.setScId(saleOutSheet.getScId()); + saleReturn.setCustomerId(saleOutSheet.getCustomerId()); + saleReturn.setOutSheetId(saleOutSheet.getId()); + + if (!saleConfig.getSaleReturnMultipleRelateOutStock()) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SaleReturn.class) + .eq(SaleReturn::getOutSheetId, saleOutSheet.getId()) + .ne(SaleReturn::getId, saleReturn.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException( + "销售出库单号:" + saleOutSheet.getCode() + + ",已关联其他销售退货单,不允许关联多个销售退货单!"); + } + } + } + + int returnNum = 0; + int giftNum = 0; + BigDecimal totalAmount = BigDecimal.ZERO; + int orderNo = 1; + for (SaleReturnProductVo productVo : vo.getProducts()) { + if (requireOut) { + if (!StringUtil.isBlank(productVo.getOutSheetDetailId())) { + SaleOutSheetDetailLotDto detailLot = saleOutSheetDetailLotService.findById( + productVo.getOutSheetDetailId()); + SaleOutSheetDetail detail = saleOutSheetDetailService.getById(detailLot.getDetailId()); + productVo.setOriPrice(detail.getOriPrice()); + productVo.setTaxPrice(detail.getTaxPrice()); + productVo.setDiscountRate(detail.getDiscountRate()); + } else { + productVo.setTaxPrice(BigDecimal.ZERO); + productVo.setDiscountRate(BigDecimal.valueOf(100)); + } + } + + boolean isGift = productVo.getTaxPrice().doubleValue() == 0D; + + if (requireOut) { + if (StringUtil.isBlank(productVo.getOutSheetDetailId())) { + if (!isGift) { + throw new InputErrorException("第" + orderNo + "行商品必须为“赠品”!"); + } + } + } + + if (isGift) { + giftNum += productVo.getReturnNum(); + } else { + returnNum += productVo.getReturnNum(); + } + + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(productVo.getTaxPrice(), productVo.getReturnNum())); + + SaleReturnDetail detail = new SaleReturnDetail(); + detail.setId(IdUtil.getId()); + detail.setReturnId(saleReturn.getId()); + + Product product = productService.findById(productVo.getProductId()); + if (product == null) { + throw new InputErrorException("第" + orderNo + "行商品不存在!"); + } + + if (!NumberUtil.isNumberPrecision(productVo.getTaxPrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品价格最多允许2位小数!"); + } + + detail.setProductId(productVo.getProductId()); + detail.setReturnNum(productVo.getReturnNum()); + detail.setOriPrice(productVo.getOriPrice()); + detail.setTaxPrice(productVo.getTaxPrice()); + detail.setDiscountRate(productVo.getDiscountRate()); + detail.setIsGift(isGift); + detail.setTaxRate(product.getSaleTaxRate()); + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + detail.setOrderNo(orderNo); + detail.setSettleStatus(this.getInitSettleStatus(customer)); + if (requireOut && !StringUtil.isBlank(productVo.getOutSheetDetailId())) { + detail.setOutSheetDetailId(productVo.getOutSheetDetailId()); + saleOutSheetDetailLotService.addReturnNum(productVo.getOutSheetDetailId(), + detail.getReturnNum()); + } + + saleReturnDetailService.save(detail); + orderNo++; + } + saleReturn.setTotalNum(returnNum); + saleReturn.setTotalGiftNum(giftNum); + saleReturn.setTotalAmount(totalAmount); + saleReturn.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + saleReturn.setSettleStatus(this.getInitSettleStatus(customer)); + } + + /** + * 根据客户获取初始结算状态 + * + * @param customer + * @return + */ + private SettleStatus getInitSettleStatus(Customer customer) { + + return SettleStatus.UN_SETTLE; + } + + private void sendApprovePassEvent(SaleReturn r) { + + ApprovePassSaleReturnEvent event = new ApprovePassSaleReturnEvent(this); + event.setId(r.getId()); + event.setTotalAmount(r.getTotalAmount()); + event.setApproveTime(r.getApproveTime()); + + ApplicationUtil.publishEvent(event); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockLogServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockLogServiceImpl.java new file mode 100644 index 0000000..64314ea --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockLogServiceImpl.java @@ -0,0 +1,152 @@ +package com.lframework.xingyun.sc.impl.stock; + +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.mappers.ProductStockLogMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockLogService; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithAddStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithStockCostAdjustVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithSubStockVo; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductStockLogServiceImpl extends + BaseMpServiceImpl + implements ProductStockLogService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductStockLogVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductStockLogVo vo) { + + return getBaseMapper().query(vo); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addLogWithAddStock(AddLogWithAddStockVo vo) { + + ProductStockLog record = new ProductStockLog(); + record.setId(IdUtil.getId()); + record.setScId(vo.getScId()); + record.setProductId(vo.getProductId()); + record.setOriStockNum(vo.getOriStockNum()); + record.setCurStockNum(vo.getCurStockNum()); + record.setOriTaxPrice(vo.getOriTaxPrice()); + record.setCurTaxPrice(vo.getCurTaxPrice()); + record.setStockNum(vo.getStockNum()); + record.setTaxAmount(vo.getTaxAmount()); + if (!StringUtil.isBlank(vo.getCreateBy())) { + record.setCreateBy(vo.getCreateBy()); + } + if (!StringUtil.isBlank(vo.getCreateById())) { + record.setCreateById(vo.getCreateById()); + } + record.setCreateTime(vo.getCreateTime()); + if (!StringUtil.isBlank(vo.getBizId())) { + record.setBizId(vo.getBizId()); + } + if (!StringUtil.isBlank(vo.getBizDetailId())) { + record.setBizDetailId(vo.getBizDetailId()); + } + if (!StringUtil.isBlank(vo.getBizCode())) { + record.setBizCode(vo.getBizCode()); + } + record.setBizType(EnumUtil.getByCode(ProductStockBizType.class, vo.getBizType())); + + getBaseMapper().insert(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addLogWithSubStock(AddLogWithSubStockVo vo) { + + ProductStockLog record = new ProductStockLog(); + record.setId(IdUtil.getId()); + record.setScId(vo.getScId()); + record.setProductId(vo.getProductId()); + record.setOriStockNum(vo.getOriStockNum()); + record.setCurStockNum(vo.getCurStockNum()); + record.setOriTaxPrice(vo.getOriTaxPrice()); + record.setCurTaxPrice(vo.getCurTaxPrice()); + record.setStockNum(-Math.abs(vo.getStockNum())); + record.setTaxAmount(vo.getTaxAmount().abs().negate()); + if (!StringUtil.isBlank(vo.getCreateBy())) { + record.setCreateBy(vo.getCreateBy()); + } + if (!StringUtil.isBlank(vo.getCreateById())) { + record.setCreateById(vo.getCreateById()); + } + record.setCreateTime(vo.getCreateTime()); + if (!StringUtil.isBlank(vo.getBizId())) { + record.setBizId(vo.getBizId()); + } + if (!StringUtil.isBlank(vo.getBizDetailId())) { + record.setBizDetailId(vo.getBizDetailId()); + } + if (!StringUtil.isBlank(vo.getBizCode())) { + record.setBizCode(vo.getBizCode()); + } + record.setBizType(EnumUtil.getByCode(ProductStockBizType.class, vo.getBizType())); + + getBaseMapper().insert(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void addLogWithStockCostAdjust(AddLogWithStockCostAdjustVo vo) { + + ProductStockLog record = new ProductStockLog(); + record.setId(IdUtil.getId()); + record.setScId(vo.getScId()); + record.setProductId(vo.getProductId()); + record.setOriStockNum(vo.getOriStockNum()); + record.setCurStockNum(vo.getOriStockNum()); + record.setOriTaxPrice(vo.getOriTaxPrice()); + record.setCurTaxPrice(vo.getCurTaxPrice()); + record.setStockNum(0); + record.setTaxAmount(vo.getTaxAmount()); + if (!StringUtil.isBlank(vo.getCreateBy())) { + record.setCreateBy(vo.getCreateBy()); + } + if (!StringUtil.isBlank(vo.getCreateById())) { + record.setCreateById(vo.getCreateById()); + } + record.setCreateTime(vo.getCreateTime()); + if (!StringUtil.isBlank(vo.getBizId())) { + record.setBizId(vo.getBizId()); + } + if (!StringUtil.isBlank(vo.getBizDetailId())) { + record.setBizDetailId(vo.getBizDetailId()); + } + if (!StringUtil.isBlank(vo.getBizCode())) { + record.setBizCode(vo.getBizCode()); + } + record.setBizType(ProductStockBizType.STOCK_COST_ADJUST); + + getBaseMapper().insert(record); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockServiceImpl.java new file mode 100644 index 0000000..fd612e5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/ProductStockServiceImpl.java @@ -0,0 +1,358 @@ +package com.lframework.xingyun.sc.impl.stock; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductBundle; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductBundleService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.core.events.stock.AddStockEvent; +import com.lframework.xingyun.core.events.stock.SubStockEvent; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustDiffDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.mappers.ProductStockMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockLogService; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import com.lframework.xingyun.sc.vo.stock.StockCostAdjustVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithAddStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithStockCostAdjustVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithSubStockVo; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ProductStockServiceImpl extends BaseMpServiceImpl + implements ProductStockService { + + @Autowired + private ProductService productService; + + @Autowired + private ProductBundleService productBundleService; + + @Autowired + private ProductStockLogService productStockLogService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryProductStockVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryProductStockVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public ProductStock getByProductIdAndScId(String productId, String scId) { + + Product product = productService.findById(productId); + if (product == null) { + return null; + } + + if (product.getProductType() == ProductType.NORMAL) { + return getBaseMapper().getByProductIdAndScId(productId, scId); + } else { + List productBundles = productBundleService.getByMainProductId(productId); + if (CollectionUtil.isEmpty(productBundles)) { + return null; + } + + List productIds = productBundles.stream().map(ProductBundle::getProductId).collect( + Collectors.toList()); + List productStocks = this.getByProductIdsAndScId(productIds, scId, + ProductType.NORMAL.getCode()); + + int stockNum = Integer.MAX_VALUE; + for (ProductBundle productBundle : productBundles) { + String id = productBundle.getProductId(); + ProductStock productStock = productStocks.stream().filter(t -> t.getProductId().equals(id)) + .findFirst().orElse(null); + if (productStock == null || productStock.getStockNum() <= 0) { + // 此处说明有单品没有库存 + return null; + } + + stockNum = Math.min(productStock.getStockNum() / productBundle.getBundleNum(), stockNum); + } + + ProductStock productStock = new ProductStock(); + productStock.setId(IdUtil.getId()); + productStock.setScId(scId); + productStock.setProductId(productId); + productStock.setStockNum(stockNum); + productStock.setTaxPrice(BigDecimal.ZERO); + productStock.setTaxAmount(BigDecimal.ZERO); + + return productStock; + } + } + + @Override + public List getByProductIdsAndScId(List productIds, String scId, + Integer productType) { + + if (CollectionUtil.isEmpty(productIds)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByProductIdsAndScId(productIds, scId, productType); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public ProductStockChangeDto addStock(AddProductStockVo vo) { + + Product product = productService.findById(vo.getProductId()); + if (product.getProductType() != ProductType.NORMAL) { + throw new DefaultClientException( + "只有商品类型为【" + ProductType.NORMAL.getDesc() + "】的商品支持入库!"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductStock.class) + .eq(ProductStock::getProductId, vo.getProductId()).eq(ProductStock::getScId, vo.getScId()); + + ProductStock productStock = getBaseMapper().selectOne(queryWrapper); + + boolean isStockEmpty = false; + if (productStock == null) { + //首次入库,先新增 + productStock = new ProductStock(); + productStock.setId(IdUtil.getId()); + productStock.setScId(vo.getScId()); + productStock.setProductId(vo.getProductId()); + productStock.setStockNum(0); + productStock.setTaxPrice(BigDecimal.ZERO); + productStock.setTaxAmount(BigDecimal.ZERO); + + getBaseMapper().insert(productStock); + + isStockEmpty = true; + } + + // 如果taxAmount为null,代表不重算均价,即:按当前均价直接入库 + boolean reCalcCostPrice = vo.getTaxPrice() != null; + + if (vo.getTaxPrice() == null) { + vo.setTaxPrice(isStockEmpty ? + vo.getDefaultTaxPrice() : + productStock.getTaxPrice()); + } + if (vo.getTaxPrice() == null) { + // 如果此时taxPrice还是null,则代表taxPrice和defaultTaxPrice均为null + throw new DefaultSysException( + "商品ID:" + vo.getProductId() + ",没有库存,taxPrice和defaultTaxPrice不能同时为null!"); + } + + if (isStockEmpty) { + // 如果之前没有库存,那么均价必须重算 + reCalcCostPrice = true; + } + + vo.setTaxPrice(NumberUtil.getNumber(vo.getTaxPrice(), 2)); + int count = getBaseMapper().addStock(vo.getProductId(), vo.getScId(), vo.getStockNum(), + NumberUtil.mul(vo.getTaxPrice(), vo.getStockNum()), productStock.getStockNum(), + productStock.getTaxAmount(), reCalcCostPrice); + if (count != 1) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "入库失败,请稍后重试!"); + } + + AddLogWithAddStockVo addLogWithAddStockVo = new AddLogWithAddStockVo(); + addLogWithAddStockVo.setProductId(vo.getProductId()); + addLogWithAddStockVo.setScId(vo.getScId()); + addLogWithAddStockVo.setStockNum(vo.getStockNum()); + addLogWithAddStockVo.setTaxAmount(NumberUtil.mul(vo.getTaxPrice(), vo.getStockNum())); + addLogWithAddStockVo.setOriStockNum(productStock.getStockNum()); + addLogWithAddStockVo.setCurStockNum( + NumberUtil.add(productStock.getStockNum(), vo.getStockNum()).intValue()); + addLogWithAddStockVo.setOriTaxPrice(productStock.getTaxPrice()); + addLogWithAddStockVo.setCurTaxPrice(!reCalcCostPrice ? + productStock.getTaxPrice() : + addLogWithAddStockVo.getCurStockNum() == 0 ? + BigDecimal.ZERO : + NumberUtil.getNumber( + NumberUtil.div(NumberUtil.add(productStock.getTaxAmount(), + NumberUtil.mul(vo.getTaxPrice(), vo.getStockNum())), + addLogWithAddStockVo.getCurStockNum()), 6)); + addLogWithAddStockVo.setCreateTime(vo.getCreateTime()); + addLogWithAddStockVo.setBizId(vo.getBizId()); + addLogWithAddStockVo.setBizDetailId(vo.getBizDetailId()); + addLogWithAddStockVo.setBizCode(vo.getBizCode()); + addLogWithAddStockVo.setBizType(vo.getBizType()); + + productStockLogService.addLogWithAddStock(addLogWithAddStockVo); + + ProductStockChangeDto stockChange = new ProductStockChangeDto(); + stockChange.setScId(vo.getScId()); + stockChange.setProductId(vo.getProductId()); + stockChange.setNum(vo.getStockNum()); + stockChange.setTaxAmount(addLogWithAddStockVo.getTaxAmount()); + stockChange.setCurTaxPrice(addLogWithAddStockVo.getCurTaxPrice()); + + AddStockEvent addStockEvent = new AddStockEvent(this, stockChange); + ApplicationUtil.publishEvent(addStockEvent); + + return stockChange; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public ProductStockChangeDto subStock(SubProductStockVo vo) { + + Product product = productService.findById(vo.getProductId()); + if (product.getProductType() != ProductType.NORMAL) { + throw new DefaultClientException( + "只有商品类型为【" + ProductType.NORMAL.getDesc() + "】的商品支持出库!"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductStock.class) + .eq(ProductStock::getProductId, vo.getProductId()).eq(ProductStock::getScId, vo.getScId()); + + ProductStock productStock = getBaseMapper().selectOne(queryWrapper); + if (productStock == null) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "当前库存为0,无法出库!"); + } + + if (NumberUtil.lt(productStock.getStockNum(), vo.getStockNum())) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "当前库存为" + + productStock.getStockNum() + + ",库存不足,无法出库!"); + } + + // 如果taxAmount为null,代表不重算均价,即:按当前均价直接出库 + boolean reCalcCostPrice = vo.getTaxAmount() != null; + if (vo.getTaxAmount() == null) { + vo.setTaxAmount(NumberUtil.mul(productStock.getTaxPrice(), vo.getStockNum())); + } + + vo.setTaxAmount(NumberUtil.getNumber(vo.getTaxAmount(), 2)); + + BigDecimal subTaxAmount = vo.getTaxAmount(); + + int count = getBaseMapper().subStock(vo.getProductId(), vo.getScId(), vo.getStockNum(), + subTaxAmount, + productStock.getStockNum(), productStock.getTaxAmount(), reCalcCostPrice); + if (count != 1) { + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "出库失败,请稍后重试!"); + } + + AddLogWithSubStockVo addLogWithAddStockVo = new AddLogWithSubStockVo(); + addLogWithAddStockVo.setProductId(vo.getProductId()); + addLogWithAddStockVo.setScId(vo.getScId()); + addLogWithAddStockVo.setStockNum(vo.getStockNum()); + addLogWithAddStockVo.setTaxAmount(subTaxAmount); + addLogWithAddStockVo.setOriStockNum(productStock.getStockNum()); + addLogWithAddStockVo.setCurStockNum( + NumberUtil.sub(productStock.getStockNum(), vo.getStockNum()).intValue()); + addLogWithAddStockVo.setOriTaxPrice(productStock.getTaxPrice()); + addLogWithAddStockVo.setCurTaxPrice(!reCalcCostPrice ? + productStock.getTaxPrice() : + addLogWithAddStockVo.getCurStockNum() == 0 ? + BigDecimal.ZERO : + NumberUtil.getNumber( + NumberUtil.div(NumberUtil.sub(productStock.getTaxAmount(), subTaxAmount), + addLogWithAddStockVo.getCurStockNum()), 6)); + addLogWithAddStockVo.setCreateTime(vo.getCreateTime()); + addLogWithAddStockVo.setBizId(vo.getBizId()); + addLogWithAddStockVo.setBizDetailId(vo.getBizDetailId()); + addLogWithAddStockVo.setBizCode(vo.getBizCode()); + addLogWithAddStockVo.setBizType(vo.getBizType()); + + productStockLogService.addLogWithSubStock(addLogWithAddStockVo); + + ProductStockChangeDto stockChange = new ProductStockChangeDto(); + stockChange.setScId(vo.getScId()); + stockChange.setProductId(vo.getProductId()); + stockChange.setNum(vo.getStockNum()); + stockChange.setTaxAmount(subTaxAmount); + stockChange.setCurTaxPrice(addLogWithAddStockVo.getCurTaxPrice()); + + SubStockEvent subStockEvent = new SubStockEvent(this, stockChange); + ApplicationUtil.publishEvent(subStockEvent); + + return stockChange; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public StockCostAdjustDiffDto stockCostAdjust(StockCostAdjustVo vo) { + + Product product = productService.findById(vo.getProductId()); + if (product.getProductType() != ProductType.NORMAL) { + throw new DefaultClientException( + "只有商品类型为【" + ProductType.NORMAL.getDesc() + "】的商品支持库存成本调整!"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(ProductStock.class) + .eq(ProductStock::getProductId, vo.getProductId()).eq(ProductStock::getScId, vo.getScId()); + + ProductStock productStock = getBaseMapper().selectOne(queryWrapper); + + if (productStock == null) { + // 没有库存,跳过 + return new StockCostAdjustDiffDto(); + } + + BigDecimal taxPrice = NumberUtil.getNumber(vo.getTaxPrice(), 6); + + StockCostAdjustDiffDto result = new StockCostAdjustDiffDto(); + result.setStockNum(productStock.getStockNum()); + result.setOriPrice(NumberUtil.getNumber(productStock.getTaxPrice(), 2)); + result.setDiffAmount(NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.sub(taxPrice, productStock.getTaxPrice()), + productStock.getStockNum()), 2)); + + getBaseMapper().stockCostAdjust(vo.getProductId(), vo.getScId(), taxPrice); + + AddLogWithStockCostAdjustVo logVo = new AddLogWithStockCostAdjustVo(); + logVo.setProductId(vo.getProductId()); + logVo.setScId(vo.getScId()); + logVo.setTaxAmount(result.getDiffAmount()); + logVo.setOriStockNum(productStock.getStockNum()); + logVo.setOriTaxPrice(productStock.getTaxPrice()); + logVo.setCurTaxPrice(taxPrice); + logVo.setCreateTime(vo.getCreateTime()); + logVo.setBizId(vo.getBizId()); + logVo.setBizDetailId(vo.getBizDetailId()); + logVo.setBizCode(vo.getBizCode()); + + productStockLogService.addLogWithStockCostAdjust(logVo); + + return result; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustReasonServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustReasonServiceImpl.java new file mode 100644 index 0000000..a5e81b0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustReasonServiceImpl.java @@ -0,0 +1,174 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.StockAdjustReasonMapper; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.CreateStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.UpdateStockAdjustReasonVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class StockAdjustReasonServiceImpl extends + BaseMpServiceImpl + implements StockAdjustReasonService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustReasonVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryStockAdjustReasonVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + StockAdjustReasonSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = StockAdjustReason.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public StockAdjustReason findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "停用库存调整原因,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustReason.class) + .set(StockAdjustReason::getAvailable, Boolean.FALSE).in(StockAdjustReason::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "启用库存调整原因,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustReason.class) + .set(StockAdjustReason::getAvailable, Boolean.TRUE).in(StockAdjustReason::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "新增库存调整原因,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateStockAdjustReasonVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(StockAdjustReason.class) + .eq(StockAdjustReason::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + StockAdjustReason data = new StockAdjustReason(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "修改库存调整原因,ID:{}, 编号:{}", params = {"#id", + "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateStockAdjustReasonVo vo) { + + StockAdjustReason data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整原因不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(StockAdjustReason.class) + .eq(StockAdjustReason::getCode, vo.getCode()).ne(StockAdjustReason::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + StockAdjustReason.class) + .set(StockAdjustReason::getCode, vo.getCode()).set(StockAdjustReason::getName, vo.getName()) + .set(StockAdjustReason::getAvailable, vo.getAvailable()) + .set(StockAdjustReason::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(StockAdjustReason::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = StockAdjustReason.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetDetailServiceImpl.java new file mode 100644 index 0000000..d11b1d2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; +import com.lframework.xingyun.sc.mappers.StockAdjustSheetDetailMapper; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class StockAdjustSheetDetailServiceImpl + extends BaseMpServiceImpl + implements StockAdjustSheetDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetServiceImpl.java new file mode 100644 index 0000000..53ec0fc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockAdjustSheetServiceImpl.java @@ -0,0 +1,738 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import cn.hutool.core.lang.Dict; +import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.components.security.UserDetailsService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.entity.OrderTimeLine; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.service.OrderTimeLineService; +import com.lframework.xingyun.sc.bo.stock.adjust.stock.StockAdjustSheetFullBo; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; +import com.lframework.xingyun.sc.enums.*; +import com.lframework.xingyun.sc.mappers.StockAdjustSheetMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetDetailService; +import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustSheetService; +import com.lframework.xingyun.sc.utils.WebUtils; +import com.lframework.xingyun.sc.vo.retail.out.ApprovePassRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.ApproveRefuseRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.ApprovePassStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.ApproveRefuseStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.BatchApprovePassStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.BatchApproveRefuseStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.CreateStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.StockAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.UpdateStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +import net.minidev.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class StockAdjustSheetServiceImpl extends + BaseMpServiceImpl + implements StockAdjustSheetService { + + @Autowired + private StockAdjustSheetDetailService stockCostAdjustSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Autowired + private ProductService productService; + + @Autowired + private UserDetailsService userDetailsService; + + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryStockAdjustSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public StockAdjustSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "新增库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建调整单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateStockAdjustSheetVo vo) { + + StockAdjustSheet data = new StockAdjustSheet(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.STOCK_ADJUST_SHEET)); + + this.create(data, vo); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "修改库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改调整单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateStockAdjustSheetVo vo) { + + StockAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.CREATED + && data.getStatus() != StockAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,无法修改!"); + } + + throw new DefaultClientException("库存调整单无法修改!"); + } + + // 删除出库单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class) + .eq(StockAdjustSheetDetail::getSheetId, data.getId()); + stockCostAdjustSheetDetailService.remove(deleteDetailWrapper); + + this.create(data, vo); + + data.setStatus(StockAdjustSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(StockAdjustSheetStatus.CREATED); + statusList.add(StockAdjustSheetStatus.APPROVE_REFUSE); + + Wrapper updateSheetWrapper = Wrappers.lambdaUpdate( + StockAdjustSheet.class) + .set(StockAdjustSheet::getApproveBy, null) + .set(StockAdjustSheet::getApproveTime, null) + .set(StockAdjustSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(StockAdjustSheet::getId, data.getId()) + .in(StockAdjustSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(data, updateSheetWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "删除库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + StockAdjustSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的库存调整单不允许执行删除操作!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, id) + .in(StockAdjustSheet::getStatus, StockAdjustSheetStatus.CREATED, + StockAdjustSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class) + .eq(StockAdjustSheetDetail::getSheetId, id); + stockCostAdjustSheetDetailService.remove(deleteDetailWrapper); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + StockAdjustSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个库存调整单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "审核通过库存调整单,ID:{}", params = {"#vo.id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassStockAdjustSheetVo vo) { + + StockAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.CREATED + && data.getStatus() != StockAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存调整单无法审核通过!"); + } + + LocalDateTime now = LocalDateTime.now(); + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, data.getId()) + .in(StockAdjustSheet::getStatus, StockAdjustSheetStatus.CREATED, + StockAdjustSheetStatus.APPROVE_REFUSE) + .set(StockAdjustSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(StockAdjustSheet::getApproveTime, now) + .set(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_PASS) + .set(StockAdjustSheet::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class) + .eq(StockAdjustSheetDetail::getSheetId, data.getId()) + .orderByAsc(StockAdjustSheetDetail::getOrderNo); + List details = stockCostAdjustSheetDetailService.list( + queryDetailWrapper); + + for (StockAdjustSheetDetail detail : details) { + Product product = productService.findById(detail.getProductId()); + ProductPurchase productPurchase = productPurchaseService.getById(product.getId()); + if (data.getBizType() == StockAdjustSheetBizType.IN) { + // 入库 + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(product.getId()); + addProductStockVo.setScId(data.getScId()); + addProductStockVo.setStockNum(detail.getStockNum()); + addProductStockVo.setDefaultTaxPrice(productPurchase.getPrice()); + addProductStockVo.setCreateTime(now); + addProductStockVo.setBizId(data.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(data.getCode()); + addProductStockVo.setBizType(ProductStockBizType.STOCK_ADJUST.getCode()); + + productStockService.addStock(addProductStockVo); + } else { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(product.getId()); + subProductStockVo.setScId(data.getScId()); + subProductStockVo.setStockNum(detail.getStockNum()); + subProductStockVo.setCreateTime(now); + subProductStockVo.setBizId(data.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(data.getCode()); + subProductStockVo.setBizType(ProductStockBizType.STOCK_ADJUST.getCode()); + + productStockService.subStock(subProductStockVo); + } + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassStockAdjustSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassStockAdjustSheetVo approvePassVo = new ApprovePassStockAdjustSheetVo(); + approvePassVo.setId(id); + + try { + StockAdjustSheetService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个库存调整单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateStockAdjustSheetVo vo) { + + StockAdjustSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassStockAdjustSheetVo approvePassVo = new ApprovePassStockAdjustSheetVo(); + approvePassVo.setId(id); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return id; + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "审核拒绝库存调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseStockAdjustSheetVo vo) { + + StockAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.CREATED + && data.getStatus() != StockAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存调整单无法审核通过!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, data.getId()) + .in(StockAdjustSheet::getStatus, StockAdjustSheetStatus.CREATED, + StockAdjustSheetStatus.APPROVE_REFUSE) + .set(StockAdjustSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(StockAdjustSheet::getApproveTime, LocalDateTime.now()) + .set(StockAdjustSheet::getRefuseReason, vo.getRefuseReason()) + .set(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseStockAdjustSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseStockAdjustSheetVo approveRefuseVo = new ApproveRefuseStockAdjustSheetVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + StockAdjustSheetService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个库存调整单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + + @Override + public PageResult queryStockAdjustByCondition(Integer pageIndex, + Integer pageSize, String scId, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryStockAdjustByCondition(scId, + condition); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryStockAdjustList(Integer pageIndex, + Integer pageSize, QueryStockAdjustProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryStockAdjustList(vo); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + private void create(StockAdjustSheet data, CreateStockAdjustSheetVo vo) { + + data.setScId(vo.getScId()); + data.setStatus(StockAdjustSheetStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + data.setBizType(EnumUtil.getByCode(StockAdjustSheetBizType.class, vo.getBizType())); + data.setReasonId(vo.getReasonId()); + + int productNum = 0; + BigDecimal diffAmount = BigDecimal.ZERO; + int orderNo = 1; + for (StockAdjustProductVo product : vo.getProducts()) { + StockAdjustSheetDetail detail = new StockAdjustSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setStockNum(product.getStockNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + productNum++; + + stockCostAdjustSheetDetailService.save(detail); + } + } + + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "发送库存调整单审批流程给ydool系统,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_SEND, orderId = "#id", name = "发送库存调整单审批流程给ydool系统") + @Transactional(rollbackFor = Exception.class) + @Override + public InvokeResult sendApprove(String id) { + StockAdjustSheetFullDto order = this.getDetail(id); + if (order == null) { + throw new DefaultClientException("库存调整单不存在!"); + } + + StockAdjustSheetFullBo bo = new StockAdjustSheetFullBo(order); + + if (order.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,无需再次审核!"); + } + if (order.getStatus() == StockAdjustSheetStatus.APPROVE_ING) { + throw new DefaultClientException("库存调整单正在审核中,请勿重复推送"); + } + + String createCode = bo.getCreateCode(); + if (StringUtil.isBlank(createCode)) { + throw new DefaultClientException("创建人不存在,无法发起审核!"); + } + + List details = bo.getDetails(); + //将商品编号、商品名称、库存数量、采购数量、采购含税金额从details中提取出来 + List list = details.stream().map(detail -> { + //将商品编号、商品名称、库存数量、采购数量、采购含税金额从detail中提取并返回 + return Dict.create() + .set("goods_number", detail.getProductCode()) + .set("goods_name", detail.getProductName()) + .set("number", detail.getStockNum()) + .set("inventory", detail.getCurStockNum()); + }).collect(Collectors.toList()); + Dict dict = Dict.create(); + dict.set("user_id", createCode) + .set("order_id", id) + .set("biz_type", StockAdjustSheetBizType.descByCode(bo.getBizType())) + .set("reason_name", bo.getReasonName()) + .set("audit_person_ids", "120,262") + .set("push_person_ids", "120,262") + .set("remark", bo.getDescription()) + .set("ghd_goodlist_info", list); + + String jsonString = JSONObject.toJSONString(dict); + String json = HttpUtil.post("https://nb.ydool.com/api/ydoolerp/erp_ajax.ashx/send_kc", jsonString); + // 修改订单状态 + StockAdjustSheet stockAdjustSheet = this.baseMapper.selectById(id); + stockAdjustSheet.setStatus(StockAdjustSheetStatus.APPROVE_ING); + int update = getBaseMapper().updateById(stockAdjustSheet); + InvokeResult success = InvokeResultBuilder.success(); + success.setMsg(jsonString); + OpLogUtil.setVariable("code", order.getCode()); + OpLogUtil.setVariable("id", id); + OpLogUtil.setExtra(dict); + return update > 0 ? success : InvokeResultBuilder.fail(jsonString); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void approve(YdoolApproveOrderVo vo) { + String status = vo.getStatus(); + if ("y".equals(status)) { + this.approvePass(vo.getId(), vo.getMsg()); + } else { + this.approveRefuse(vo.getId(), vo.getMsg()); + } + } + + @Override + public StockAdjustProductDto queryStockAdjustBySku(String scId, String sku) { + StockAdjustProductDto datas = getBaseMapper().queryStockAdjustBySku(scId, + sku); + return datas; + } + + @Transactional(rollbackFor = Exception.class) + public void approvePass(String id, String description) { + StockAdjustSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.APPROVE_ING){ + throw new DefaultClientException("库存调整单无法审核通过!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.CREATED + && data.getStatus() != StockAdjustSheetStatus.APPROVE_ING + && data.getStatus() != StockAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存调整单无法审核通过!"); + } + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + LocalDateTime now = LocalDateTime.now(); + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, data.getId()) + .eq(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_ING) + .set(StockAdjustSheet::getApproveBy, user.getId()) + .set(StockAdjustSheet::getApproveTime, now) + .set(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_PASS) + .set(StockAdjustSheet::getDescription, + StringUtil.isBlank(description) ? StringPool.EMPTY_STR : description); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + StockAdjustSheetDetail.class) + .eq(StockAdjustSheetDetail::getSheetId, data.getId()) + .orderByAsc(StockAdjustSheetDetail::getOrderNo); + List details = stockCostAdjustSheetDetailService.list( + queryDetailWrapper); + + for (StockAdjustSheetDetail detail : details) { + Product product = productService.findById(detail.getProductId()); + ProductPurchase productPurchase = productPurchaseService.getById(product.getId()); + if (data.getBizType() == StockAdjustSheetBizType.IN) { + // 入库 + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(product.getId()); + addProductStockVo.setScId(data.getScId()); + addProductStockVo.setStockNum(detail.getStockNum()); + addProductStockVo.setDefaultTaxPrice(productPurchase.getPrice()); + addProductStockVo.setCreateTime(now); + addProductStockVo.setBizId(data.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(data.getCode()); + addProductStockVo.setBizType(ProductStockBizType.STOCK_ADJUST.getCode()); + + productStockService.addStock(addProductStockVo); + } else { + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(product.getId()); + subProductStockVo.setScId(data.getScId()); + subProductStockVo.setStockNum(detail.getStockNum()); + subProductStockVo.setCreateTime(now); + subProductStockVo.setBizId(data.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(data.getCode()); + subProductStockVo.setBizType(ProductStockBizType.STOCK_ADJUST.getCode()); + + productStockService.subStock(subProductStockVo); + } + } + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApprovePassStockAdjustSheetVo vo = new ApprovePassStockAdjustSheetVo(); + vo.setId(id); + vo.setDescription(description); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核通过库存调整单,单号:%s", data.getCode())); + opLogs.setLogType(ScOpLogType.STOCK_ADJUST); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(data.getId()); + orderTimeLine.setContent("审核通过"); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_PASS); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + + + } + + @Transactional(rollbackFor = Exception.class) + public void approveRefuse(String id, String refuseReason) { + if (StringUtil.isBlank(refuseReason)) { + throw new InputErrorException("请输入拒绝理由!"); + } + + StockAdjustSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存调整单不存在!"); + } + + if (data.getStatus() != StockAdjustSheetStatus.APPROVE_ING){ + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存调整单已审核通过,不允许继续执行审核!"); + } + + if (data.getStatus() == StockAdjustSheetStatus.APPROVE_REFUSE){ + throw new DefaultClientException("库存调整单已审核拒绝,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存调整单无法审核拒绝!"); + } + + AbstractUserDetails user = userDetailsService.loadUserByUsername("yanxiaomao1"); + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockAdjustSheet.class) + .eq(StockAdjustSheet::getId, data.getId()) + .eq(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_ING) + .set(StockAdjustSheet::getApproveBy, user.getId()) + .set(StockAdjustSheet::getApproveTime, LocalDateTime.now()) + .set(StockAdjustSheet::getRefuseReason, refuseReason) + .set(StockAdjustSheet::getStatus, StockAdjustSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存调整单信息已过期,请刷新重试!"); + } + + OpLogs opLogs = new OpLogs(); +// OpLogUtil.setVariable("code", order.getCode()); + ApproveRefuseStockAdjustSheetVo vo = new ApproveRefuseStockAdjustSheetVo(); + vo.setId(id); + vo.setRefuseReason(refuseReason); +// OpLogUtil.setExtra(vo); + opLogs.setExtra(JSONUtil.toJsonStr(vo)); + opLogs.setName(String.format("审核拒绝库存调整单,单号:%s", data.getCode())); + opLogs.setLogType(ScOpLogType.STOCK_ADJUST); + opLogs.setCreateBy(user.getName()); + opLogs.setCreateById(user.getId()); + opLogs.setIp(WebUtils.getRemoteIpAddress()); + opLogs.setCreateTime(LocalDateTime.now()); + OpLogsService opLogsService = SpringUtil.getBean(OpLogsService.class); + opLogsService.save(opLogs); + + OrderTimeLine orderTimeLine = new OrderTimeLine(); + orderTimeLine.setOrderId(data.getId()); + orderTimeLine.setContent(String.format("审核拒绝,拒绝理由:%s", refuseReason)); + orderTimeLine.setBizType(OrderTimeLineBizType.APPROVE_RETURN); + orderTimeLine.setCreateBy(user.getName()); + orderTimeLine.setCreateById(user.getId()); + orderTimeLine.setCreateTime(LocalDateTime.now()); + OrderTimeLineService orderTimeLineService = SpringUtil.getBean(OrderTimeLineService.class); + orderTimeLineService.save(orderTimeLine); + } + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockCostAdjustSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockCostAdjustSheetDetailServiceImpl.java new file mode 100644 index 0000000..207331e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockCostAdjustSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheetDetail; +import com.lframework.xingyun.sc.mappers.StockCostAdjustSheetDetailMapper; +import com.lframework.xingyun.sc.service.stock.adjust.StockCostAdjustSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class StockCostAdjustSheetDetailServiceImpl + extends BaseMpServiceImpl + implements StockCostAdjustSheetDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockCostAdjustSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockCostAdjustSheetServiceImpl.java new file mode 100644 index 0000000..2ec7fb2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/adjust/StockCostAdjustSheetServiceImpl.java @@ -0,0 +1,478 @@ +package com.lframework.xingyun.sc.impl.stock.adjust; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustDiffDto; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheet; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheetDetail; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus; +import com.lframework.xingyun.sc.mappers.StockCostAdjustSheetMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.adjust.StockCostAdjustSheetDetailService; +import com.lframework.xingyun.sc.service.stock.adjust.StockCostAdjustSheetService; +import com.lframework.xingyun.sc.vo.stock.StockCostAdjustVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.ApprovePassStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.ApproveRefuseStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.BatchApprovePassStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.BatchApproveRefuseStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.CreateStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.StockCostAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.UpdateStockCostAdjustSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class StockCostAdjustSheetServiceImpl extends + BaseMpServiceImpl + implements StockCostAdjustSheetService { + + @Autowired + private StockCostAdjustSheetDetailService stockCostAdjustSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + @Autowired + private ProductService productService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryStockCostAdjustSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryStockCostAdjustSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public StockCostAdjustSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "新增库存成本调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建调整单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateStockCostAdjustSheetVo vo) { + + StockCostAdjustSheet data = new StockCostAdjustSheet(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.STOCK_COST_ADJUST_SHEET)); + + this.create(data, vo); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "修改库存成本调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改调整单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateStockCostAdjustSheetVo vo) { + + StockCostAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存成本调整单不存在!"); + } + + if (data.getStatus() != StockCostAdjustSheetStatus.CREATED + && data.getStatus() != StockCostAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockCostAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存成本调整单已审核通过,无法修改!"); + } + + throw new DefaultClientException("库存成本调整单无法修改!"); + } + + // 删除出库单明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + StockCostAdjustSheetDetail.class) + .eq(StockCostAdjustSheetDetail::getSheetId, data.getId()); + stockCostAdjustSheetDetailService.remove(deleteDetailWrapper); + + this.create(data, vo); + + data.setStatus(StockCostAdjustSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(StockCostAdjustSheetStatus.CREATED); + statusList.add(StockCostAdjustSheetStatus.APPROVE_REFUSE); + + Wrapper updateSheetWrapper = Wrappers.lambdaUpdate( + StockCostAdjustSheet.class) + .set(StockCostAdjustSheet::getApproveBy, null) + .set(StockCostAdjustSheet::getApproveTime, null) + .set(StockCostAdjustSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(StockCostAdjustSheet::getId, data.getId()) + .in(StockCostAdjustSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(data, updateSheetWrapper) != 1) { + throw new DefaultClientException("库存成本调整单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "删除库存成本调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + StockCostAdjustSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存成本调整单不存在!"); + } + + if (data.getStatus() == StockCostAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的库存成本调整单不允许执行删除操作!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(StockCostAdjustSheet.class) + .eq(StockCostAdjustSheet::getId, id) + .in(StockCostAdjustSheet::getStatus, StockCostAdjustSheetStatus.CREATED, + StockCostAdjustSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("库存成本调整单信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + StockCostAdjustSheetDetail.class) + .eq(StockCostAdjustSheetDetail::getSheetId, id); + stockCostAdjustSheetDetailService.remove(deleteDetailWrapper); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + StockCostAdjustSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个库存成本调整单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "审核通过库存成本调整单,ID:{}", params = {"#vo.id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassStockCostAdjustSheetVo vo) { + + StockCostAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存成本调整单不存在!"); + } + + if (data.getStatus() != StockCostAdjustSheetStatus.CREATED + && data.getStatus() != StockCostAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockCostAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存成本调整单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存成本调整单无法审核通过!"); + } + + LocalDateTime now = LocalDateTime.now(); + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockCostAdjustSheet.class) + .eq(StockCostAdjustSheet::getId, data.getId()) + .in(StockCostAdjustSheet::getStatus, StockCostAdjustSheetStatus.CREATED, + StockCostAdjustSheetStatus.APPROVE_REFUSE) + .set(StockCostAdjustSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(StockCostAdjustSheet::getApproveTime, now) + .set(StockCostAdjustSheet::getStatus, StockCostAdjustSheetStatus.APPROVE_PASS) + .set(StockCostAdjustSheet::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存成本调整单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + StockCostAdjustSheetDetail.class) + .eq(StockCostAdjustSheetDetail::getSheetId, data.getId()) + .orderByAsc(StockCostAdjustSheetDetail::getOrderNo); + List details = stockCostAdjustSheetDetailService.list( + queryDetailWrapper); + + BigDecimal totalDiffAmount = BigDecimal.ZERO; + for (StockCostAdjustSheetDetail detail : details) { + Product product = productService.findById(detail.getProductId()); + StockCostAdjustVo adjustVo = new StockCostAdjustVo(); + adjustVo.setProductId(detail.getProductId()); + adjustVo.setScId(data.getScId()); + adjustVo.setTaxPrice(detail.getPrice()); + adjustVo.setTaxRate(product.getTaxRate()); + adjustVo.setCreateTime(now); + adjustVo.setBizId(data.getId()); + adjustVo.setBizDetailId(detail.getId()); + adjustVo.setBizCode(data.getCode()); + + StockCostAdjustDiffDto diff = productStockService.stockCostAdjust(adjustVo); + detail.setStockNum(diff.getStockNum()); + detail.setOriPrice(diff.getOriPrice()); + detail.setDiffAmount(diff.getDiffAmount()); + + stockCostAdjustSheetDetailService.updateById(detail); + + totalDiffAmount = NumberUtil.add(totalDiffAmount, detail.getDiffAmount()); + } + + updateWrapper = Wrappers.lambdaUpdate(StockCostAdjustSheet.class) + .eq(StockCostAdjustSheet::getId, data.getId()) + .set(StockCostAdjustSheet::getDiffAmount, totalDiffAmount); + this.update(updateWrapper); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassStockCostAdjustSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassStockCostAdjustSheetVo approvePassVo = new ApprovePassStockCostAdjustSheetVo(); + approvePassVo.setId(id); + + try { + StockCostAdjustSheetService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个库存成本调整单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateStockCostAdjustSheetVo vo) { + + StockCostAdjustSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassStockCostAdjustSheetVo approvePassVo = new ApprovePassStockCostAdjustSheetVo(); + approvePassVo.setId(id); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return id; + } + + @OpLog(type = ScOpLogType.STOCK_ADJUST, name = "审核拒绝库存成本调整单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseStockCostAdjustSheetVo vo) { + + StockCostAdjustSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("库存成本调整单不存在!"); + } + + if (data.getStatus() != StockCostAdjustSheetStatus.CREATED + && data.getStatus() != StockCostAdjustSheetStatus.APPROVE_REFUSE) { + + if (data.getStatus() == StockCostAdjustSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("库存成本调整单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("库存成本调整单无法审核通过!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(StockCostAdjustSheet.class) + .eq(StockCostAdjustSheet::getId, data.getId()) + .in(StockCostAdjustSheet::getStatus, StockCostAdjustSheetStatus.CREATED, + StockCostAdjustSheetStatus.APPROVE_REFUSE) + .set(StockCostAdjustSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(StockCostAdjustSheet::getApproveTime, LocalDateTime.now()) + .set(StockCostAdjustSheet::getRefuseReason, vo.getRefuseReason()) + .set(StockCostAdjustSheet::getStatus, StockCostAdjustSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("库存成本调整单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseStockCostAdjustSheetVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseStockCostAdjustSheetVo approveRefuseVo = new ApproveRefuseStockCostAdjustSheetVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + StockCostAdjustSheetService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个库存成本调整单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + + @Override + public PageResult queryStockCostAdjustByCondition(Integer pageIndex, + Integer pageSize, String scId, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryStockCostAdjustByCondition(scId, + condition); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryStockCostAdjustList(Integer pageIndex, + Integer pageSize, QueryStockCostAdjustProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryStockCostAdjustList(vo); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + private void create(StockCostAdjustSheet data, CreateStockCostAdjustSheetVo vo) { + + data.setScId(vo.getScId()); + data.setStatus(StockCostAdjustSheetStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + int productNum = 0; + BigDecimal diffAmount = BigDecimal.ZERO; + int orderNo = 1; + for (StockCostAdjustProductVo product : vo.getProducts()) { + StockCostAdjustSheetDetail detail = new StockCostAdjustSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + ProductStock productStock = productStockService.getByProductIdAndScId(product.getProductId(), + data.getScId()); + ProductPurchase productPurchase = productPurchaseService.getById(product.getProductId()); + detail.setStockNum(productStock == null ? 0 : productStock.getStockNum()); + detail.setPurchasePrice(productPurchase.getPrice()); + detail.setOriPrice( + productStock == null ? BigDecimal.ZERO + : NumberUtil.getNumber(productStock.getTaxPrice(), 2)); + detail.setPrice(product.getPrice()); + detail.setDiffAmount(NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.sub(detail.getPrice(), detail.getOriPrice()), + detail.getStockNum()), 2)); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + productNum++; + + diffAmount = NumberUtil.add(diffAmount, detail.getDiffAmount()); + + stockCostAdjustSheetDetailService.save(detail); + } + + data.setProductNum(productNum); + data.setDiffAmount(diffAmount); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetDetailServiceImpl.java new file mode 100644 index 0000000..6e3d918 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; +import com.lframework.xingyun.sc.mappers.PreTakeStockSheetDetailMapper; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class PreTakeStockSheetDetailServiceImpl + extends BaseMpServiceImpl + implements PreTakeStockSheetDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetServiceImpl.java new file mode 100644 index 0000000..e441404 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/PreTakeStockSheetServiceImpl.java @@ -0,0 +1,246 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.PreTakeStockSheetMapper; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetDetailService; +import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.pre.CreatePreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockProductVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockProductVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.UpdatePreTakeStockSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class PreTakeStockSheetServiceImpl extends + BaseMpServiceImpl + implements PreTakeStockSheetService { + + @Autowired + private PreTakeStockSheetDetailService preTakeStockSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryPreTakeStockSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryPreTakeStockSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + PreTakeStockSheetSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public PreTakeStockSheetFullDto getDetail(String id) { + + PreTakeStockSheetFullDto data = getBaseMapper().getDetail(id); + if (data == null) { + throw new DefaultClientException("预先盘点单不存在!"); + } + + return data; + } + + @Override + public List getProducts(String id, String planId) { + + return getBaseMapper().getProducts(id, planId); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "新增预先盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreatePreTakeStockSheetVo vo) { + + PreTakeStockSheet data = new PreTakeStockSheet(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.PRE_TAKE_STOCK_SHEET)); + data.setScId(vo.getScId()); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + data.setTakeStatus(EnumUtil.getByCode(PreTakeStockSheetStatus.class, vo.getTakeStatus())); + + getBaseMapper().insert(data); + + int orderNo = 1; + for (PreTakeStockProductVo product : vo.getProducts()) { + PreTakeStockSheetDetail detail = new PreTakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setFirstNum(product.getFirstNum()); + detail.setSecondNum(product.getSecondNum()); + detail.setRandNum(product.getRandNum()); + detail.setOrderNo(orderNo++); + + preTakeStockSheetDetailService.save(detail); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "修改预先盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdatePreTakeStockSheetVo vo) { + + PreTakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("预先盘点单不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + PreTakeStockSheet.class) + .set(PreTakeStockSheet::getScId, vo.getScId()).set(PreTakeStockSheet::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(PreTakeStockSheet::getTakeStatus, + EnumUtil.getByCode(PreTakeStockSheetStatus.class, vo.getTakeStatus())) + .eq(PreTakeStockSheet::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PreTakeStockSheetDetail.class) + .eq(PreTakeStockSheetDetail::getSheetId, data.getId()); + preTakeStockSheetDetailService.remove(deleteDetailWrapper); + + int orderNo = 1; + for (PreTakeStockProductVo product : vo.getProducts()) { + PreTakeStockSheetDetail detail = new PreTakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setFirstNum(product.getFirstNum()); + detail.setSecondNum(product.getSecondNum()); + detail.setRandNum(product.getRandNum()); + detail.setOrderNo(orderNo++); + + preTakeStockSheetDetailService.save(detail); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "删除预先盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + if (takeStockSheetService.hasRelatePreTakeStockSheet(id)) { + throw new DefaultClientException("已有库存盘点单关联此预先盘点单,不允许执行删除操作!"); + } + + getBaseMapper().deleteById(id); + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + PreTakeStockSheetDetail.class) + .eq(PreTakeStockSheetDetail::getSheetId, id); + preTakeStockSheetDetailService.remove(deleteDetailWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(List ids) { + + for (String id : ids) { + getThis(this.getClass()).deleteById(id); + } + } + + @Override + public PageResult queryPreTakeStockByCondition(Integer pageIndex, + Integer pageSize, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPreTakeStockByCondition(condition); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryPreTakeStockList(Integer pageIndex, + Integer pageSize, QueryPreTakeStockProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryPreTakeStockList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockConfigServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockConfigServiceImpl.java new file mode 100644 index 0000000..ace3db2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockConfigServiceImpl.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.mappers.TakeStockConfigMapper; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.vo.stock.take.config.UpdateTakeStockConfigVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class TakeStockConfigServiceImpl extends + BaseMpServiceImpl + implements TakeStockConfigService { + + @Cacheable(value = TakeStockConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'", unless = "#result == null") + @Override + public TakeStockConfig get() { + + return getBaseMapper().selectOne(Wrappers.query()); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "修改盘点参数,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateTakeStockConfigVo vo) { + + TakeStockConfig data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点参数不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + TakeStockConfig.class) + .set(TakeStockConfig::getShowProduct, vo.getShowProduct()) + .set(TakeStockConfig::getShowStock, vo.getShowStock()) + .set(TakeStockConfig::getAutoChangeStock, vo.getAutoChangeStock()) + .set(TakeStockConfig::getAllowChangeNum, vo.getAllowChangeNum()) + .set(TakeStockConfig::getCancelHours, vo.getCancelHours()) + .eq(TakeStockConfig::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = TakeStockConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + 'config'") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanDetailServiceImpl.java new file mode 100644 index 0000000..42b78ec --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanDetailServiceImpl.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; +import com.lframework.xingyun.sc.mappers.TakeStockPlanDetailMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class TakeStockPlanDetailServiceImpl extends + BaseMpServiceImpl + implements TakeStockPlanDetailService { + + @Autowired + private ProductStockService productStockService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Override + public GetTakeStockPlanDetailProductDto getByPlanIdAndProductId(String planId, String productId) { + + return getBaseMapper().getByPlanIdAndProductId(planId, productId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void savePlanDetailBySimple(String planId, List productIds) { + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(planId); + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, planId).orderByAsc(TakeStockPlanDetail::getOrderNo); + + List planDetails = getBaseMapper().selectList(queryDetailWrapper); + + int orderNo = planDetails.size() + 1; + for (String productId : productIds) { + if (planDetails.stream().anyMatch(t -> t.getProductId().equals(productId))) { + continue; + } + + TakeStockPlanDetail detail = new TakeStockPlanDetail(); + detail.setId(IdUtil.getId()); + detail.setPlanId(planId); + detail.setProductId(productId); + + ProductStock productStock = productStockService.getByProductIdAndScId(productId, + takeStockPlan.getScId()); + detail.setStockNum(productStock == null ? 0 : productStock.getStockNum()); + + detail.setDescription(StringPool.EMPTY_STR); + detail.setOrderNo(orderNo++); + getBaseMapper().insert(detail); + } + } + + @Override + public List getDetailsByPlanId(String planId) { + + return getBaseMapper().getDetailsByPlanId(planId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateOriTakeNum(String planId, String productId, Integer num) { + + getBaseMapper().updateOriTakeNum(planId, productId, num); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanServiceImpl.java new file mode 100644 index 0000000..eeadbe6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockPlanServiceImpl.java @@ -0,0 +1,490 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.entity.ProductPurchase; +import com.lframework.xingyun.basedata.enums.ProductType; +import com.lframework.xingyun.basedata.service.product.ProductPurchaseService; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.basedata.vo.product.info.QueryProductVo; +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.core.events.stock.AddStockEvent; +import com.lframework.xingyun.core.events.stock.SubStockEvent; +import com.lframework.xingyun.core.events.stock.take.DeleteTakeStockPlanEvent; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.mappers.TakeStockPlanDetailMapper; +import com.lframework.xingyun.sc.mappers.TakeStockPlanMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockConfigService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.CancelTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.CreateTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.HandleTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.QueryTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.UpdateTakeStockPlanVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.components.qrtz.QrtzJob; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.quartz.JobExecutionContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class TakeStockPlanServiceImpl extends BaseMpServiceImpl + implements TakeStockPlanService { + + @Autowired + private TakeStockPlanDetailService takeStockPlanDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ProductService productService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private TakeStockConfigService takeStockConfigService; + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Autowired + private ProductPurchaseService productPurchaseService; + + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryTakeStockPlanVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryTakeStockPlanVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + TakeStockPlanSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public TakeStockPlanFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "新增盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateTakeStockPlanVo vo) { + + TakeStockPlan data = new TakeStockPlan(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.TAKE_STOCK_PLAN)); + data.setScId(vo.getScId()); + data.setTakeType(EnumUtil.getByCode(TakeStockPlanType.class, vo.getTakeType())); + if (data.getTakeType() == TakeStockPlanType.CATEGORY + || data.getTakeType() == TakeStockPlanType.BRAND) { + data.setBizId(StringUtil.join(",", vo.getBizIds())); + } + + data.setTakeStatus(TakeStockPlanStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + List products = null; + if (data.getTakeType() != TakeStockPlanType.SIMPLE) { + // 单品盘点不生成明细 + if (data.getTakeType() == TakeStockPlanType.ALL) { + // 全场盘点 + // 将所有商品添加明细 + QueryProductVo queryProductVo = new QueryProductVo(); + queryProductVo.setAvailable(Boolean.TRUE); + queryProductVo.setProductType(ProductType.NORMAL.getCode()); + Integer count = productService.queryCount(queryProductVo); + if (count > 2000) { + throw new DefaultClientException( + TakeStockPlanType.ALL.getDesc() + "最多支持2000个商品,当前系统内已经超过2000个商品,无法进行" + + TakeStockPlanType.ALL.getDesc()); + } + products = productService.query(queryProductVo); + } else if (data.getTakeType() == TakeStockPlanType.CATEGORY) { + // 类目盘点 + products = productService.getByCategoryIds(vo.getBizIds(), ProductType.NORMAL.getCode()); + } else if (data.getTakeType() == TakeStockPlanType.BRAND) { + // 品牌盘点 + products = productService.getByBrandIds(vo.getBizIds(), ProductType.NORMAL.getCode()); + } + } + + if (data.getTakeType() != TakeStockPlanType.SIMPLE && CollectionUtil.isEmpty(products)) { + throw new DefaultClientException("没有查询到商品信息,无法生成盘点任务!"); + } + + if (products != null) { + List productIds = products.stream().map(Product::getId) + .collect(Collectors.toList()); + List productStocks = productStockService.getByProductIdsAndScId(productIds, + vo.getScId(), ProductType.NORMAL.getCode()); + int orderNo = 1; + for (Product product : products) { + ProductStock productStock = productStocks.stream() + .filter(t -> t.getProductId().equals(product.getId())) + .findFirst().orElse(null); + + TakeStockPlanDetail detail = new TakeStockPlanDetail(); + detail.setId(IdUtil.getId()); + detail.setPlanId(data.getId()); + detail.setProductId(product.getId()); + + detail.setStockNum(productStock == null ? 0 : productStock.getStockNum()); + detail.setTotalOutNum(0); + detail.setTotalInNum(0); + detail.setOrderNo(orderNo++); + + takeStockPlanDetailService.save(detail); + } + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "修改盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateTakeStockPlanVo vo) { + + TakeStockPlan data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点任务不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getScId, vo.getScId()) + .set(TakeStockPlan::getDescription, vo.getDescription()) + .eq(TakeStockPlan::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @Override + public List getProducts(String planId) { + + return getBaseMapper().getProducts(planId); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "差异生成,盘点任务ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void createDiff(String id) { + + TakeStockPlan data = getBaseMapper().selectById(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + // 判断是否还有没审核通过的盘点单 + if (takeStockSheetService.hasUnApprove(data.getId())) { + throw new DefaultClientException("盘点任务存在未审核的库存盘点单,请优先处理库存盘点单!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.DIFF_CREATED) + .eq(TakeStockPlan::getId, data.getId()) + .eq(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, data.getId()) + .orderByAsc(TakeStockPlanDetail::getOrderNo); + List details = takeStockPlanDetailService.list(queryDetailWrapper); + if (CollectionUtil.isEmpty(details)) { + throw new DefaultClientException("盘点任务不存在商品信息,不允许执行差异生成操作!"); + } + for (TakeStockPlanDetail detail : details) { + if (detail.getOriTakeNum() != null) { + continue; + } + LambdaUpdateWrapper updateDetailWrapper = Wrappers.lambdaUpdate( + TakeStockPlanDetail.class).set(TakeStockPlanDetail::getOriTakeNum, 0) + .eq(TakeStockPlanDetail::getId, detail.getId()); + + takeStockPlanDetailService.update(updateDetailWrapper); + } + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "差异处理,盘点任务ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void handleDiff(HandleTakeStockPlanVo vo) { + + TakeStockPlan data = getBaseMapper().selectById(vo.getId()); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.FINISHED) + .eq(TakeStockPlan::getId, data.getId()) + .eq(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.DIFF_CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + TakeStockConfig config = takeStockConfigService.get(); + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, data.getId()) + .orderByAsc(TakeStockPlanDetail::getOrderNo); + List details = takeStockPlanDetailService.list(queryDetailWrapper); + if (CollectionUtil.isEmpty(details)) { + throw new DefaultClientException("盘点任务不存在商品信息,不允许执行差异处理操作!"); + } + + if (!config.getAllowChangeNum().equals(vo.getAllowChangeNum()) || !config.getAutoChangeStock() + .equals(vo.getAutoChangeStock())) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + for (TakeStockPlanDetail detail : details) { + HandleTakeStockPlanVo.ProductVo productVo = vo.getProducts().stream() + .filter(t -> t.getProductId().equals(detail.getProductId())).findFirst().get(); + if (config.getAllowChangeNum()) { + // 如果允许修改盘点数量 + detail.setTakeNum(productVo.getTakeNum()); + } else { + // 如果允许自动调整,那么盘点数量=盘点单的盘点数量 - 进项数量 + 出项数量,否则就等于盘点单的盘点数量 + detail.setTakeNum(config.getAutoChangeStock() ? + detail.getOriTakeNum() - detail.getTotalInNum() + detail.getTotalOutNum() : + detail.getOriTakeNum()); + } + detail.setDescription( + StringUtil.isBlank(productVo.getDescription()) ? StringPool.EMPTY_STR + : productVo.getDescription()); + + LambdaUpdateWrapper updateDetailWrapper = Wrappers.lambdaUpdate( + TakeStockPlanDetail.class).set(TakeStockPlanDetail::getTakeNum, detail.getTakeNum()) + .set(TakeStockPlanDetail::getDescription, detail.getDescription()) + .eq(TakeStockPlanDetail::getId, detail.getId()); + takeStockPlanDetailService.update(updateDetailWrapper); + } + + // 进行出入库操作 + int orderNo = 0; + for (TakeStockPlanDetail detail : details) { + orderNo++; + if (!NumberUtil.equal(detail.getStockNum(), detail.getTakeNum())) { + if (NumberUtil.lt(detail.getStockNum(), detail.getTakeNum())) { + Product product = productService.findById(detail.getProductId()); + ProductPurchase purchase = productPurchaseService.getById(product.getId()); + // 如果库存数量小于盘点数量,则报溢 + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(data.getScId()); + addProductStockVo.setStockNum(detail.getTakeNum() - detail.getStockNum()); + addProductStockVo.setDefaultTaxPrice(purchase.getPrice()); + addProductStockVo.setBizId(data.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(data.getCode()); + addProductStockVo.setBizType(ProductStockBizType.TAKE_STOCK_IN.getCode()); + + productStockService.addStock(addProductStockVo); + } else { + // 如果库存数量大于盘点数量,则报损 + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(detail.getProductId()); + subProductStockVo.setScId(data.getScId()); + subProductStockVo.setStockNum(detail.getStockNum() - detail.getTakeNum()); + subProductStockVo.setBizId(data.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(data.getCode()); + subProductStockVo.setBizType(ProductStockBizType.TAKE_STOCK_OUT.getCode()); + + productStockService.subStock(subProductStockVo); + } + } + } + + OpLogUtil.setVariable("id", vo.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "作废盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void cancel(CancelTakeStockPlanVo vo) { + + TakeStockPlan data = getBaseMapper().selectById(vo.getId()); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockPlan.class) + .set(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CANCELED) + .eq(TakeStockPlan::getId, data.getId()) + .in(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CREATED, + TakeStockPlanStatus.DIFF_CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", vo.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "删除盘点任务,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + TakeStockPlan data = getBaseMapper().selectById(id); + if (data == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(TakeStockPlan.class) + .eq(TakeStockPlan::getId, data.getId()) + .eq(TakeStockPlan::getTakeStatus, TakeStockPlanStatus.CANCELED); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("盘点任务信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockPlanDetail.class) + .eq(TakeStockPlanDetail::getPlanId, data.getId()); + takeStockPlanDetailService.remove(deleteDetailWrapper); + + DeleteTakeStockPlanEvent deleteEvent = new DeleteTakeStockPlanEvent(this, data.getId()); + ApplicationUtil.publishEvent(deleteEvent); + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + @Service + public static class AddStockListener implements ApplicationListener { + + @Autowired + private TakeStockPlanDetailMapper takeStockPlanDetailMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(AddStockEvent addStockEvent) { + + ProductStockChangeDto change = addStockEvent.getChange(); + takeStockPlanDetailMapper.addTotalInNum(change.getScId(), change.getProductId(), + change.getNum()); + } + } + + @Service + public static class SubStockListener implements ApplicationListener { + + @Autowired + private TakeStockPlanDetailMapper takeStockPlanDetailMapper; + + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(SubStockEvent addStockEvent) { + + ProductStockChangeDto change = addStockEvent.getChange(); + takeStockPlanDetailMapper.addTotalOutNum(change.getScId(), change.getProductId(), + change.getNum()); + } + } + + /** + * 自动作废任务 + */ + @Slf4j + public static class AutoCancelJob extends QrtzJob { + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Override + public void onExecute(JobExecutionContext context) { + + String id = (String) context.getMergedJobDataMap().get("id"); + + CancelTakeStockPlanVo cancelVo = new CancelTakeStockPlanVo(); + cancelVo.setId(id); + takeStockPlanService.cancel(cancelVo); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetDetailServiceImpl.java new file mode 100644 index 0000000..9c5d6de --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; +import com.lframework.xingyun.sc.mappers.TakeStockSheetDetailMapper; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class TakeStockSheetDetailServiceImpl extends + BaseMpServiceImpl + implements TakeStockSheetDetailService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetServiceImpl.java new file mode 100644 index 0000000..a1911a0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/take/TakeStockSheetServiceImpl.java @@ -0,0 +1,533 @@ +package com.lframework.xingyun.sc.impl.stock.take; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.core.events.stock.take.DeleteTakeStockPlanEvent; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import com.lframework.xingyun.sc.mappers.TakeStockSheetMapper; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetDetailService; +import com.lframework.xingyun.sc.service.stock.take.TakeStockSheetService; +import com.lframework.xingyun.sc.vo.stock.take.sheet.ApprovePassTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.ApproveRefuseTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.BatchApprovePassTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.BatchApproveRefuseTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.CreateTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetProductVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.TakeStockSheetProductVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.UpdateTakeStockSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class TakeStockSheetServiceImpl extends + BaseMpServiceImpl + implements TakeStockSheetService { + + @Autowired + private TakeStockSheetDetailService takeStockSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private TakeStockPlanService takeStockPlanService; + + @Autowired + private TakeStockPlanDetailService takeStockPlanDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryTakeStockSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryTakeStockSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public TakeStockSheetFullDto getDetail(String id) { + + TakeStockSheetFullDto data = getBaseMapper().getDetail(id); + if (data == null) { + throw new DefaultClientException("盘点单不存在!"); + } + + return data; + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "新增盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建盘点单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateTakeStockSheetVo vo) { + + TakeStockSheet data = new TakeStockSheet(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.TAKE_STOCK_SHEET)); + data.setPlanId(vo.getPlanId()); + data.setPreSheetId(vo.getPreSheetId()); + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(vo.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许进行新增!"); + } + + data.setScId(takeStockPlan.getScId()); + data.setStatus(TakeStockSheetStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + int orderNo = 1; + for (TakeStockSheetProductVo product : vo.getProducts()) { + TakeStockSheetDetail detail = new TakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setTakeNum(product.getTakeNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + + takeStockSheetDetailService.save(detail); + } + + // 盘点任务如果是单品盘点 + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + takeStockPlanDetailService.savePlanDetailBySimple(takeStockPlan.getId(), + vo.getProducts().stream().map(TakeStockSheetProductVo::getProductId) + .collect(Collectors.toList())); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "修改盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#_result", name = "修改盘点单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateTakeStockSheetVo vo) { + + TakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许进行修改!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(TakeStockSheet::getApproveBy, null).set(TakeStockSheet::getApproveTime, null) + .set(TakeStockSheet::getRefuseReason, null) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED) + .eq(TakeStockSheet::getId, vo.getId()) + .in(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED, + TakeStockSheetStatus.APPROVE_REFUSE); + + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()); + takeStockSheetDetailService.remove(deleteDetailWrapper); + + int orderNo = 1; + for (TakeStockSheetProductVo product : vo.getProducts()) { + TakeStockSheetDetail detail = new TakeStockSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setTakeNum(product.getTakeNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + + takeStockSheetDetailService.save(detail); + } + + // 盘点任务如果是单品盘点 + if (takeStockPlan.getTakeType() == TakeStockPlanType.SIMPLE) { + takeStockPlanDetailService.savePlanDetailBySimple(takeStockPlan.getId(), + vo.getProducts().stream().map(TakeStockSheetProductVo::getProductId) + .collect(Collectors.toList())); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "审核通过盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassTakeStockSheetVo vo) { + + TakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许继续执行审核!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(TakeStockSheet::getApproveTime, LocalDateTime.now()) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.APPROVE_PASS) + .eq(TakeStockSheet::getId, data.getId()) + .in(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED, + TakeStockSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()) + .orderByAsc(TakeStockSheetDetail::getOrderNo); + List details = takeStockSheetDetailService.list(queryDetailWrapper); + for (TakeStockSheetDetail detail : details) { + takeStockPlanDetailService.updateOriTakeNum(data.getPlanId(), detail.getProductId(), + detail.getTakeNum()); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassTakeStockSheetVo vo) { + + TakeStockSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassTakeStockSheetVo approveVo = new ApprovePassTakeStockSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个库存盘点单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateTakeStockSheetVo vo) { + + TakeStockSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassTakeStockSheetVo approveVo = new ApprovePassTakeStockSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "审核拒绝盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseTakeStockSheetVo vo) { + + TakeStockSheet data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许继续执行审核!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(TakeStockSheet::getApproveTime, LocalDateTime.now()) + .set(TakeStockSheet::getRefuseReason, + StringUtil.isBlank(vo.getRefuseReason()) ? StringPool.EMPTY_STR : vo.getRefuseReason()) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.APPROVE_REFUSE) + .eq(TakeStockSheet::getId, data.getId()) + .eq(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseTakeStockSheetVo vo) { + + TakeStockSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseTakeStockSheetVo approveVo = new ApproveRefuseTakeStockSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个库存盘点单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.CANCEL_APPROVE, orderId = "#id", name = "取消审核") + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "取消审核通过盘点单,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void cancelApprovePass(String id) { + + TakeStockSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + TakeStockPlan takeStockPlan = takeStockPlanService.getById(data.getPlanId()); + if (takeStockPlan == null) { + throw new DefaultClientException("盘点任务不存在!"); + } + + if (takeStockPlan.getTakeStatus() != TakeStockPlanStatus.CREATED) { + throw new DefaultClientException("关联盘点任务的盘点状态已改变,不允许执行取消审核!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(TakeStockSheet.class) + .set(TakeStockSheet::getApproveBy, null).set(TakeStockSheet::getApproveTime, null) + .set(TakeStockSheet::getRefuseReason, null) + .set(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED) + .eq(TakeStockSheet::getId, data.getId()) + .eq(TakeStockSheet::getStatus, TakeStockSheetStatus.APPROVE_PASS); + + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()) + .orderByAsc(TakeStockSheetDetail::getOrderNo); + List details = takeStockSheetDetailService.list(queryDetailWrapper); + for (TakeStockSheetDetail detail : details) { + takeStockPlanDetailService.updateOriTakeNum(data.getPlanId(), detail.getProductId(), + -detail.getTakeNum()); + } + + OpLogUtil.setVariable("id", data.getId()); + } + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "删除盘点单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + TakeStockSheet data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("盘点单不存在!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(TakeStockSheet.class) + .eq(TakeStockSheet::getId, id) + .in(TakeStockSheet::getStatus, TakeStockSheetStatus.CREATED, + TakeStockSheetStatus.APPROVE_REFUSE); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("盘点单信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .eq(TakeStockSheetDetail::getSheetId, data.getId()); + takeStockSheetDetailService.remove(deleteDetailWrapper); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(List ids) { + + TakeStockSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : ids) { + try { + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个库存盘点单删除失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @Override + public Boolean hasRelatePreTakeStockSheet(String preSheetId) { + + return getBaseMapper().hasRelatePreTakeStockSheet(preSheetId); + } + + @Override + public Boolean hasUnApprove(String planId) { + + return getBaseMapper().hasUnApprove(planId); + } + + @Override + public PageResult queryTakeStockByCondition(Integer pageIndex, + Integer pageSize, String planId, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryTakeStockByCondition(planId, + condition); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryTakeStockList(Integer pageIndex, + Integer pageSize, QueryTakeStockSheetProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryTakeStockList(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + @Service + public static class DeleteTakeStockPlanListener implements + ApplicationListener { + + @Autowired + private TakeStockSheetService takeStockSheetService; + + @Autowired + private TakeStockSheetDetailService takeStockSheetDetailService; + + @OpLog(type = ScOpLogType.TAKE_STOCK, name = "删除库存盘点表,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void onApplicationEvent(DeleteTakeStockPlanEvent deleteTakeStockPlanEvent) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(TakeStockSheet.class) + .eq(TakeStockSheet::getPlanId, deleteTakeStockPlanEvent.getId()); + List sheets = takeStockSheetService.list(deleteWrapper); + + List ids = CollectionUtil.emptyList(); + + if (!CollectionUtil.isEmpty(sheets)) { + ids = sheets.stream().map(TakeStockSheet::getId).collect(Collectors.toList()); + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + TakeStockSheetDetail.class) + .in(TakeStockSheetDetail::getSheetId, ids); + takeStockSheetDetailService.remove(deleteDetailWrapper); + } + + takeStockSheetService.remove(deleteWrapper); + + OpLogUtil.setVariable("ids", ids); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailReceiveServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailReceiveServiceImpl.java new file mode 100644 index 0000000..0016ea2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailReceiveServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.sc.impl.stock.transfer; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import com.lframework.xingyun.sc.mappers.ScTransferOrderDetailReceiveMapper; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailReceiveService; +import org.springframework.stereotype.Service; + +@Service +public class ScTransferOrderDetailReceiveServiceImpl + extends BaseMpServiceImpl + implements ScTransferOrderDetailReceiveService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailServiceImpl.java new file mode 100644 index 0000000..24bef3d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderDetailServiceImpl.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.sc.impl.stock.transfer; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; +import com.lframework.xingyun.sc.mappers.ScTransferOrderDetailMapper; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ScTransferOrderDetailServiceImpl + extends BaseMpServiceImpl + implements ScTransferOrderDetailService { + + @Transactional(rollbackFor = Exception.class) + @Override + public int receive(String orderId, String productId, Integer receiveNum) { + return getBaseMapper().receive(orderId, productId, receiveNum); + } + + @Override + public int countUnReceive(String orderId) { + return getBaseMapper().countUnReceive(orderId); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderServiceImpl.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderServiceImpl.java new file mode 100644 index 0000000..b3cbf1d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/stock/transfer/ScTransferOrderServiceImpl.java @@ -0,0 +1,541 @@ +package com.lframework.xingyun.sc.impl.stock.transfer; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.basedata.entity.Product; +import com.lframework.xingyun.basedata.service.product.ProductService; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import com.lframework.xingyun.sc.enums.ScOpLogType; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import com.lframework.xingyun.sc.mappers.ScTransferOrderMapper; +import com.lframework.xingyun.sc.service.stock.ProductStockService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailReceiveService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderDetailService; +import com.lframework.xingyun.sc.service.stock.transfer.ScTransferOrderService; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ApprovePassScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ApproveRefuseScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.BatchApprovePassScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.BatchApproveRefuseScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.CreateScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferProductVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ReceiveScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ReceiveScTransferOrderVo.ReceiveScTransferProductVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ScTransferProductVo; +import com.lframework.xingyun.sc.vo.stock.transfer.UpdateScTransferOrderVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ScTransferOrderServiceImpl extends + BaseMpServiceImpl + implements ScTransferOrderService { + + @Autowired + private ScTransferOrderDetailService scTransferOrderDetailService; + + @Autowired + private ScTransferOrderDetailReceiveService scTransferOrderDetailReceiveService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ProductStockService productStockService; + + @Autowired + private ProductService productService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryScTransferOrderVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryScTransferOrderVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public ScTransferOrderFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = ScOpLogType.SC_TRANSFER, name = "新增仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建调拨单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateScTransferOrderVo vo) { + + ScTransferOrder data = new ScTransferOrder(); + data.setId(IdUtil.getId()); + data.setCode(generateCodeService.generate(GenerateCodeTypePool.SC_TRANSFER_ORDER)); + + this.create(data, vo); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = ScOpLogType.SC_TRANSFER, name = "修改仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改调拨单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateScTransferOrderVo vo) { + + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.CREATED + && data.getStatus() != ScTransferOrderStatus.APPROVE_REFUSE) { + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("仓库调拨单已审核通过,无法修改!"); + } + + throw new DefaultClientException("仓库调拨单无法修改!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class) + .eq(ScTransferOrderDetail::getOrderId, data.getId()); + scTransferOrderDetailService.remove(deleteDetailWrapper); + + this.create(data, vo); + + data.setStatus(ScTransferOrderStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(ScTransferOrderStatus.CREATED); + statusList.add(ScTransferOrderStatus.APPROVE_REFUSE); + + Wrapper updateSheetWrapper = Wrappers.lambdaUpdate( + ScTransferOrder.class) + .set(ScTransferOrder::getApproveBy, null) + .set(ScTransferOrder::getApproveTime, null) + .set(ScTransferOrder::getRefuseReason, StringPool.EMPTY_STR) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, statusList); + if (getBaseMapper().updateAllColumn(data, updateSheetWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = ScOpLogType.SC_TRANSFER, name = "删除仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + ScTransferOrder data = getBaseMapper().selectById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS + || data.getStatus() == ScTransferOrderStatus.PART_RECEIVED + || data.getStatus() == ScTransferOrderStatus.RECEIVED) { + throw new DefaultClientException("“审核通过”的仓库调拨单不允许执行删除操作!"); + } + + Wrapper deleteWrapper = Wrappers.lambdaQuery(ScTransferOrder.class) + .eq(ScTransferOrder::getId, id) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.CREATED, + ScTransferOrderStatus.APPROVE_REFUSE); + if (getBaseMapper().delete(deleteWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class) + .eq(ScTransferOrderDetail::getOrderId, id); + scTransferOrderDetailService.remove(deleteDetailWrapper); + + Wrapper deleteDetailReceiveWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetailReceive.class).eq(ScTransferOrderDetailReceive::getOrderId, id); + scTransferOrderDetailReceiveService.remove(deleteDetailReceiveWrapper); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + ScTransferOrderService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个仓库调拨单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @OpLog(type = ScOpLogType.SC_TRANSFER, name = "审核通过仓库调拨单,ID:{}", params = {"#vo.id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassScTransferOrderVo vo) { + + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.CREATED + && data.getStatus() != ScTransferOrderStatus.APPROVE_REFUSE) { + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("仓库调拨单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("仓库调拨单无法审核通过!"); + } + + LocalDateTime now = LocalDateTime.now(); + Wrapper updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.CREATED, + ScTransferOrderStatus.APPROVE_REFUSE) + .set(ScTransferOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ScTransferOrder::getApproveTime, now) + .set(ScTransferOrder::getStatus, ScTransferOrderStatus.APPROVE_PASS) + .set(ScTransferOrder::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class) + .eq(ScTransferOrderDetail::getOrderId, data.getId()) + .orderByAsc(ScTransferOrderDetail::getOrderNo); + List details = scTransferOrderDetailService.list( + queryDetailWrapper); + + BigDecimal totalAmount = BigDecimal.ZERO; + for (ScTransferOrderDetail detail : details) { + Product product = productService.findById(detail.getProductId()); + SubProductStockVo subProductStockVo = new SubProductStockVo(); + subProductStockVo.setProductId(product.getId()); + subProductStockVo.setScId(data.getSourceScId()); + subProductStockVo.setStockNum(detail.getTransferNum()); + subProductStockVo.setCreateTime(now); + subProductStockVo.setBizId(data.getId()); + subProductStockVo.setBizDetailId(detail.getId()); + subProductStockVo.setBizCode(data.getCode()); + subProductStockVo.setBizType(ProductStockBizType.SC_TRANSFER.getCode()); + + ProductStockChangeDto changeDto = productStockService.subStock(subProductStockVo); + + detail.setTaxPrice(changeDto.getCurTaxPrice()); + + Wrapper updateDetailWrapper = Wrappers.lambdaUpdate( + ScTransferOrderDetail.class).eq(ScTransferOrderDetail::getId, detail.getId()) + .set(ScTransferOrderDetail::getTaxPrice, detail.getTaxPrice()); + scTransferOrderDetailService.update(updateDetailWrapper); + totalAmount = NumberUtil.add(totalAmount, + NumberUtil.mul(detail.getTaxPrice(), detail.getTransferNum())); + } + + updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .eq(ScTransferOrder::getId, data.getId()).set(ScTransferOrder::getTotalAmount, totalAmount); + this.update(updateWrapper); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassScTransferOrderVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassScTransferOrderVo approvePassVo = new ApprovePassScTransferOrderVo(); + approvePassVo.setId(id); + + try { + ScTransferOrderService thisService = getThis(this.getClass()); + thisService.approvePass(approvePassVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个仓库调拨单审核通过失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateScTransferOrderVo vo) { + + ScTransferOrderService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassScTransferOrderVo approvePassVo = new ApprovePassScTransferOrderVo(); + approvePassVo.setId(id); + approvePassVo.setDescription(vo.getDescription()); + + thisService.approvePass(approvePassVo); + + return id; + } + + @OpLog(type = ScOpLogType.SC_TRANSFER, name = "审核拒绝仓库调拨单,ID:{}", params = {"#id"}) + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseScTransferOrderVo vo) { + + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.CREATED + && data.getStatus() != ScTransferOrderStatus.APPROVE_REFUSE) { + + if (data.getStatus() == ScTransferOrderStatus.APPROVE_PASS) { + throw new DefaultClientException("仓库调拨单已审核通过,不允许继续执行审核!"); + } + + throw new DefaultClientException("仓库调拨单无法审核通过!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.CREATED, + ScTransferOrderStatus.APPROVE_REFUSE) + .set(ScTransferOrder::getApproveBy, SecurityUtil.getCurrentUser().getId()) + .set(ScTransferOrder::getApproveTime, LocalDateTime.now()) + .set(ScTransferOrder::getRefuseReason, vo.getRefuseReason()) + .set(ScTransferOrder::getStatus, ScTransferOrderStatus.APPROVE_REFUSE); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseScTransferOrderVo vo) { + + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseScTransferOrderVo approveRefuseVo = new ApproveRefuseScTransferOrderVo(); + approveRefuseVo.setId(id); + approveRefuseVo.setRefuseReason(vo.getRefuseReason()); + + try { + ScTransferOrderService thisService = getThis(this.getClass()); + thisService.approveRefuse(approveRefuseVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个仓库调拨单审核拒绝失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.RECEIVE, orderId = "#vo.id", name = "仓库调拨单收货") + @Transactional(rollbackFor = Exception.class) + @Override + public void receive(ReceiveScTransferOrderVo vo) { + ScTransferOrder data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("仓库调拨单不存在!"); + } + + if (data.getStatus() != ScTransferOrderStatus.APPROVE_PASS + && data.getStatus() != ScTransferOrderStatus.PART_RECEIVED) { + + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + for (ReceiveScTransferProductVo productVo : vo.getProducts()) { + if (scTransferOrderDetailService.receive(data.getId(), productVo.getProductId(), + productVo.getReceiveNum()) != 1) { + Product product = productService.findById(productVo.getProductId()); + throw new DefaultClientException( + "商品(" + product.getCode() + ")" + product.getName() + "待收货数量不足,请检查!"); + } + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(ScTransferOrder.class) + .set(ScTransferOrder::getStatus, + scTransferOrderDetailService.countUnReceive(data.getId()) > 0 + ? ScTransferOrderStatus.PART_RECEIVED : ScTransferOrderStatus.RECEIVED) + .eq(ScTransferOrder::getId, data.getId()) + .in(ScTransferOrder::getStatus, ScTransferOrderStatus.APPROVE_PASS, + ScTransferOrderStatus.PART_RECEIVED); + if (!this.update(updateWrapper)) { + throw new DefaultClientException("仓库调拨单信息已过期,请刷新重试!"); + } + + LocalDateTime now = LocalDateTime.now(); + for (ReceiveScTransferProductVo productVo : vo.getProducts()) { + Wrapper queryWrapper = Wrappers.lambdaQuery( + ScTransferOrderDetail.class).eq(ScTransferOrderDetail::getOrderId, data.getId()) + .eq(ScTransferOrderDetail::getProductId, productVo.getProductId()); + ScTransferOrderDetail detail = scTransferOrderDetailService.getOne(queryWrapper); + // 入库 + AddProductStockVo addProductStockVo = new AddProductStockVo(); + addProductStockVo.setProductId(detail.getProductId()); + addProductStockVo.setScId(data.getTargetScId()); + addProductStockVo.setStockNum(productVo.getReceiveNum()); + addProductStockVo.setTaxPrice(detail.getTaxPrice()); + addProductStockVo.setCreateTime(now); + addProductStockVo.setBizId(data.getId()); + addProductStockVo.setBizDetailId(detail.getId()); + addProductStockVo.setBizCode(data.getCode()); + addProductStockVo.setBizType(ProductStockBizType.SC_TRANSFER.getCode()); + + productStockService.addStock(addProductStockVo); + + ScTransferOrderDetailReceive detailReceive = new ScTransferOrderDetailReceive(); + detailReceive.setId(IdUtil.getId()); + detailReceive.setOrderId(data.getId()); + detailReceive.setDetailId(detail.getId()); + detailReceive.setReceiveNum(productVo.getReceiveNum()); + scTransferOrderDetailReceiveService.save(detailReceive); + } + } + + + @Override + public PageResult queryScTransferByCondition(Integer pageIndex, + Integer pageSize, String scId, String condition) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryScTransferByCondition(scId, + condition); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public PageResult queryScTransferList(Integer pageIndex, + Integer pageSize, QueryScTransferProductVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().queryScTransferList(vo); + PageResult pageResult = PageResultUtil.convert( + new PageInfo<>(datas)); + + return pageResult; + } + + @Override + public void cleanCacheByKey(Serializable key) { + + } + + private void create(ScTransferOrder data, CreateScTransferOrderVo vo) { + + data.setSourceScId(vo.getSourceScId()); + data.setTargetScId(vo.getTargetScId()); + if (StringUtil.equals(vo.getSourceScId(), vo.getTargetScId())) { + throw new DefaultClientException("转出仓库和转入仓库不允许相同!"); + } + data.setStatus(ScTransferOrderStatus.CREATED); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + int totalNum = 0; + int orderNo = 1; + for (ScTransferProductVo product : vo.getProducts()) { + ScTransferOrderDetail detail = new ScTransferOrderDetail(); + detail.setId(IdUtil.getId()); + detail.setOrderId(data.getId()); + detail.setProductId(product.getProductId()); + detail.setTransferNum(product.getTransferNum()); + detail.setDescription( + StringUtil.isBlank(product.getDescription()) ? StringPool.EMPTY_STR + : product.getDescription()); + detail.setOrderNo(orderNo++); + + totalNum += detail.getTransferNum(); + + scTransferOrderDetailService.save(detail); + } + data.setTotalNum(totalNum); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetDetailMapper.java new file mode 100644 index 0000000..447a083 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; + +/** + *

+ * 物流单明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface LogisticsSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetMapper.java new file mode 100644 index 0000000..44979a5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/LogisticsSheetMapper.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetSelectorVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetBizOrderVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 物流单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface LogisticsSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "logisticsNo", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + @Sort(value = "deliveryTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List query(@Param("vo") QueryLogisticsSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + LogisticsSheetFullDto getDetail(String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List selector(@Param("vo") LogisticsSheetSelectorVo vo); + + /** + * 查询业务单据列表 + * + * @param vo + * @param dataPermission + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List queryBizOrder(@Param("vo") QueryLogisticsSheetBizOrderVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderPayTypeMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderPayTypeMapper.java new file mode 100644 index 0000000..24e7a1b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderPayTypeMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.OrderPayType; + +/** + *

+ * 订单支付方式 Mapper 接口 + *

+ * + * @author zmj + */ +public interface OrderPayTypeMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetDetailMapper.java new file mode 100644 index 0000000..fbf7bec --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; + +/** + *

+ * 预先盘点单详情 Mapper 接口 + *

+ * + * @author zmj + */ +public interface PreTakeStockSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetMapper.java new file mode 100644 index 0000000..84b98f6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PreTakeStockSheetMapper.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockProductVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 预先盘点单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface PreTakeStockSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryPreTakeStockSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PreTakeStockSheetFullDto getDetail(@Param("id") String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List selector(@Param("vo") PreTakeStockSheetSelectorVo vo); + + /** + * 根据预先盘点单、盘点任务查询商品信息 + * + * @param id + * @param planId + * @return + */ + List getProducts(@Param("id") String id, + @Param("planId") String planId); + + /** + * 根据关键字查询预先盘点单商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPreTakeStockByCondition(@Param("condition") String condition); + + /** + * 查询预先盘点单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPreTakeStockList(@Param("vo") QueryPreTakeStockProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockLogMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockLogMapper.java new file mode 100644 index 0000000..87c6304 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockLogMapper.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-14 + */ +public interface ProductStockLogMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "scCode", alias = "sc.code"), + @Sort(value = "productCode", alias = "g.code"), + @Sort(value = "oriStockNum", alias = "gsl", autoParse = true), + @Sort(value = "curStockNum", alias = "gsl", autoParse = true), + @Sort(value = "stockNum", alias = "gsl", autoParse = true), + @Sort(value = "oriTaxPrice", alias = "gsl", autoParse = true), + @Sort(value = "curTaxPrice", alias = "gsl", autoParse = true), + @Sort(value = "taxAmount", alias = "gsl", autoParse = true), + @Sort(value = "createTime", alias = "gsl", autoParse = true), + @Sort(value = "bizCode", alias = "gsl", autoParse = true), + @Sort(value = "bizType", alias = "gsl", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List query(@Param("vo") QueryProductStockLogVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockMapper.java new file mode 100644 index 0000000..e6a785a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ProductStockMapper.java @@ -0,0 +1,106 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.math.BigDecimal; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface ProductStockMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "scCode", alias = "sc.code"), + @Sort(value = "productCode", alias = "g.code"), + @Sort(value = "stockNum", alias = "gs.stock_num"), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List query(@Param("vo") QueryProductStockVo vo); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productId + * @param scId + * @return + */ + ProductStock getByProductIdAndScId(@Param("productId") String productId, + @Param("scId") String scId); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productIds + * @param scId + * @return + */ + List getByProductIdsAndScId(@Param("productIds") List productIds, + @Param("scId") String scId, @Param("productType") Integer productType); + + /** + * 入库 + * + * @param productId + * @param scId + * @param stockNum + * @param taxAmount + * @param oriStockNum + * @param oriTaxAmount + * @return + */ + int addStock(@Param("productId") String productId, @Param("scId") String scId, + @Param("stockNum") Integer stockNum, + @Param("taxAmount") BigDecimal taxAmount, + @Param("oriStockNum") Integer oriStockNum, @Param("oriTaxAmount") BigDecimal oriTaxAmount, + @Param("reCalcCostPrice") boolean reCalcCostPrice); + + /** + * 出库 + * + * @param productId + * @param scId + * @param stockNum + * @param taxAmount + * @param oriStockNum + * @param oriTaxAmount + * @return + */ + int subStock(@Param("productId") String productId, @Param("scId") String scId, + @Param("stockNum") Integer stockNum, + @Param("taxAmount") BigDecimal taxAmount, + @Param("oriStockNum") Integer oriStockNum, @Param("oriTaxAmount") BigDecimal oriTaxAmount, + @Param("reCalcCostPrice") boolean reCalcCostPrice); + + /** + * 库存成本调整 + * + * @param productId + * @param scId + * @param taxPrice + */ + void stockCostAdjust(@Param("productId") String productId, @Param("scId") String scId, + @Param("taxPrice") BigDecimal taxPrice); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseConfigMapper.java new file mode 100644 index 0000000..66112b5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseConfigMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseConfig; + +public interface PurchaseConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailMapper.java new file mode 100644 index 0000000..80707c7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderDetailMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface PurchaseOrderDetailMapper extends BaseMapper { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加收货数量 + * + * @param id + * @param num + * @return + */ + int addReceiveNum(@Param("id") String id, @Param("num") Integer num); + + /** + * 减少收货数量 + * + * @param id + * @param num + * @return + */ + int subReceiveNum(@Param("id") String id, @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderMapper.java new file mode 100644 index 0000000..e5d2c30 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseOrderMapper.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.vo.purchase.PurchaseOrderSelectorVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseOrderWithReceiveVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseProductVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-09-12 + */ +public interface PurchaseOrderMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + @Sort(value = "approveTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List query(@Param("vo") QueryPurchaseOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseOrderFullDto getDetail(String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List selector(@Param("vo") PurchaseOrderSelectorVo vo); + + /** + * 根据ID查询(收货业务) + * + * @param id + * @return + */ + PurchaseOrderWithReceiveDto getWithReceive(@Param("id") String id, + @Param("requirePurchase") Boolean requirePurchase); + + /** + * 查询列表(收货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List queryWithReceive(@Param("vo") QueryPurchaseOrderWithReceiveVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 根据关键字查询采购商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPurchaseByCondition( + @Param("condition") String condition); + + /** + * 查询可采购商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryPurchaseList(@Param("vo") QueryPurchaseProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseProductDto getPurchaseById(String id); + + /** + * 根据SKU查询可采购商品信息 + * @param sku + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + PurchaseProductDto queryPurchaseBySku( @Param("sku") String sku); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnDetailMapper.java new file mode 100644 index 0000000..1e19448 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.PurchaseReturnDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-16 + */ +public interface PurchaseReturnDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnMapper.java new file mode 100644 index 0000000..4618a17 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/PurchaseReturnMapper.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.returned.QueryPurchaseReturnVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-16 + */ +public interface PurchaseReturnMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + @Sort(value = "approveTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QueryPurchaseReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseReturnFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailMapper.java new file mode 100644 index 0000000..a11c523 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetDetailMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-09 + */ +public interface ReceiveSheetDetailMapper extends BaseMapper { + + /** + * 根据收货单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetMapper.java new file mode 100644 index 0000000..7777b18 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ReceiveSheetMapper.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveSheetSelectorVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-09 + */ +public interface ReceiveSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "r", autoParse = true), + @Sort(value = "createTime", alias = "r", autoParse = true), + @Sort(value = "approveTime", alias = "r", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QueryReceiveSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "r") + }) + List selector(@Param("vo") ReceiveSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ReceiveSheetFullDto getDetail(String id); + + /** + * 根据ID查询(采购退货业务) + * + * @param id + * @return + */ + ReceiveSheetWithReturnDto getWithReturn(@Param("id") String id, + @Param("requireReceive") Boolean requireReceive); + + /** + * 查询列表(采购退货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "r") + }) + List queryWithReturn(@Param("vo") QueryReceiveSheetWithReturnVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailConfigMapper.java new file mode 100644 index 0000000..b07774b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailConfigMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailConfig; + +public interface RetailConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailBundleMapper.java new file mode 100644 index 0000000..f0ccd52 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; + +public interface RetailOutSheetDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailLotMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailLotMapper.java new file mode 100644 index 0000000..5821fde --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailLotMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailLot; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-03 + */ +public interface RetailOutSheetDetailLotMapper extends BaseMapper { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailMapper.java new file mode 100644 index 0000000..4c034a2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetDetailMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface RetailOutSheetDetailMapper extends BaseMapper { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetMapper.java new file mode 100644 index 0000000..52670cd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailOutSheetMapper.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.retail.out.QueryRetailProductVo; +import com.lframework.xingyun.sc.vo.retail.out.RetailOutSheetSelectorVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface RetailOutSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryRetailOutSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List selector(@Param("vo") RetailOutSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(销售退货业务) + * + * @param id + * @return + */ + RetailOutSheetWithReturnDto getWithReturn(@Param("id") String id, + @Param("requireOut") Boolean requireOut); + + /** + * 查询列表(销售退货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List queryWithReturn(@Param("vo") QueryRetailOutSheetWithReturnVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 根据关键字零售采购商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryRetailByCondition( + @Param("condition") String condition, @Param("isReturn") Boolean isReturn); + + /** + * 查询可零售商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryRetailList(@Param("vo") QueryRetailProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailProductDto getRetailById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnDetailMapper.java new file mode 100644 index 0000000..9a88428 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.RetailReturnDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface RetailReturnDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnMapper.java new file mode 100644 index 0000000..a23e01d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/RetailReturnMapper.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.vo.retail.returned.QueryRetailReturnVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface RetailReturnMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "r", autoParse = true), + @Sort(value = "createTime", alias = "r", autoParse = true), + @Sort(value = "approveTime", alias = "r", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QueryRetailReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailReturnFullDto getDetail(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleConfigMapper.java new file mode 100644 index 0000000..ca4c1f6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleConfigMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleConfig; + +public interface SaleConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailBundleMapper.java new file mode 100644 index 0000000..90475fd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; + +public interface SaleOrderDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailMapper.java new file mode 100644 index 0000000..f20065e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderDetailMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-21 + */ +public interface SaleOrderDetailMapper extends BaseMapper { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加出库数量 + * + * @param id + * @param num + * @return + */ + int addOutNum(@Param("id") String id, @Param("num") Integer num); + + /** + * 减少出库数量 + * + * @param id + * @param num + * @return + */ + int subOutNum(@Param("id") String id, @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderMapper.java new file mode 100644 index 0000000..e82c3ef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOrderMapper.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderWithOutVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleProductVo; +import com.lframework.xingyun.sc.vo.sale.SaleOrderSelectorVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-21 + */ +public interface SaleOrderMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "o", autoParse = true), + @Sort(value = "createTime", alias = "o", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List query(@Param("vo") QuerySaleOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOrderFullDto getDetail(String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List selector(@Param("vo") SaleOrderSelectorVo vo); + + /** + * 根据ID查询(出库业务) + * + * @param id + * @return + */ + SaleOrderWithOutDto getWithOut(@Param("id") String id, @Param("requireSale") Boolean requireSale); + + /** + * 查询列表(出库业务) + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "o") + }) + List queryWithOut(@Param("vo") QuerySaleOrderWithOutVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 根据关键字销售采购商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List querySaleByCondition( + @Param("condition") String condition, @Param("isReturn") Boolean isReturn); + + /** + * 查询可销售商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List querySaleList(@Param("vo") QuerySaleProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleProductDto getSaleById(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailBundleMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailBundleMapper.java new file mode 100644 index 0000000..56d1c6e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailBundleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; + +public interface SaleOutSheetDetailBundleMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailLotMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailLotMapper.java new file mode 100644 index 0000000..0379f90 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailLotMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-03 + */ +public interface SaleOutSheetDetailLotMapper extends BaseMapper { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailMapper.java new file mode 100644 index 0000000..e46ab28 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetDetailMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface SaleOutSheetDetailMapper extends BaseMapper { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + * @return + */ + int addReturnNum(@Param("id") String id, @Param("num") Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + * @return + */ + int subReturnNum(@Param("id") String id, @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetMapper.java new file mode 100644 index 0000000..81044a8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleOutSheetMapper.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.sale.out.SaleOutSheetSelectorVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-10-26 + */ +public interface SaleOutSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySaleOutSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List selector(@Param("vo") SaleOutSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(销售退货业务) + * + * @param id + * @return + */ + SaleOutSheetWithReturnDto getWithReturn(@Param("id") String id, + @Param("requireOut") Boolean requireOut); + + /** + * 查询列表(销售退货业务) + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List queryWithReturn(@Param("vo") QuerySaleOutSheetWithReturnVo vo, + @Param("multipleRelate") boolean multipleRelate); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnDetailMapper.java new file mode 100644 index 0000000..4beb6b2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.SaleReturnDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface SaleReturnDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnMapper.java new file mode 100644 index 0000000..4a76d9c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/SaleReturnMapper.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.returned.QuerySaleReturnVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-04 + */ +public interface SaleReturnMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "r", autoParse = true), + @Sort(value = "createTime", alias = "r", autoParse = true), + @Sort(value = "approveTime", alias = "r", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "r") + }) + List query(@Param("vo") QuerySaleReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleReturnFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailMapper.java new file mode 100644 index 0000000..adf1765 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailMapper.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 仓库调拨单明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ScTransferOrderDetailMapper extends BaseMapper { + + /** + * 收货 + * + * @param productId + * @param receiveNum + * @return + */ + int receive(@Param("orderId") String orderId, @Param("productId") String productId, + @Param("receiveNum") Integer receiveNum); + + /** + * 统计未收货的商品 + * + * @param orderId + * @return + */ + int countUnReceive(@Param("orderId") String orderId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailReceiveMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailReceiveMapper.java new file mode 100644 index 0000000..7e4925e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderDetailReceiveMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; + +/** + *

+ * 仓库调拨单收货明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ScTransferOrderDetailReceiveMapper extends + BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderMapper.java new file mode 100644 index 0000000..19c315b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/ScTransferOrderMapper.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferProductVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 仓库调拨单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface ScTransferOrderMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + @Sort(value = "approveTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryScTransferOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ScTransferOrderFullDto getDetail(@Param("id") String id); + + /** + * 根据关键字查询库存成本调整单商品信息 + * + * @param scId + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryScTransferByCondition( + @Param("scId") String scId, @Param("condition") String condition); + + /** + * 查询库存成本调整单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryScTransferList( + @Param("vo") QueryScTransferProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustReasonMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustReasonMapper.java new file mode 100644 index 0000000..f7bb9b4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustReasonMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2023-04-18 + */ +public interface StockAdjustReasonMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryStockAdjustReasonVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") StockAdjustReasonSelectorVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetDetailMapper.java new file mode 100644 index 0000000..3937183 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; + +/** + *

+ * 库存调整单明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface StockAdjustSheetDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetMapper.java new file mode 100644 index 0000000..053270a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockAdjustSheetMapper.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 库存调整单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface StockAdjustSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + @Sort(value = "approveTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryStockAdjustSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockAdjustSheetFullDto getDetail(@Param("id") String id); + + /** + * 根据关键字查询库存成本调整单商品信息 + * + * @param scId + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryStockAdjustByCondition( + @Param("scId") String scId, @Param("condition") String condition); + + /** + * 查询库存成本调整单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryStockAdjustList( + @Param("vo") QueryStockAdjustProductVo vo); + + /** + * 根据商品ID查询库存成本调整单商品信息 + * + * @param scId + * @param sku + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + StockAdjustProductDto queryStockAdjustBySku( @Param("scId") String scId, @Param("sku") String sku); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockCostAdjustSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockCostAdjustSheetDetailMapper.java new file mode 100644 index 0000000..8752b56 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockCostAdjustSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheetDetail; + +/** + *

+ * 库存成本调整单明细 Mapper 接口 + *

+ * + * @author zmj + */ +public interface StockCostAdjustSheetDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockCostAdjustSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockCostAdjustSheetMapper.java new file mode 100644 index 0000000..817f1ae --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/StockCostAdjustSheetMapper.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheet; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 库存成本调整单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface StockCostAdjustSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + @Sort(value = "approveTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryStockCostAdjustSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockCostAdjustSheetFullDto getDetail(@Param("id") String id); + + /** + * 根据关键字查询库存成本调整单商品信息 + * + * @param scId + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryStockCostAdjustByCondition( + @Param("scId") String scId, @Param("condition") String condition); + + /** + * 查询库存成本调整单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryStockCostAdjustList( + @Param("vo") QueryStockCostAdjustProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockConfigMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockConfigMapper.java new file mode 100644 index 0000000..82e738a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockConfigMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.TakeStockConfig; + +/** + *

+ * 盘点参数 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockConfigMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanDetailMapper.java new file mode 100644 index 0000000..f315b8d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanDetailMapper.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 盘点任务详情 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockPlanDetailMapper extends BaseMapper { + + /** + * 根据盘点任务ID、商品ID查询 + * + * @param planId + * @param productId + * @return + */ + GetTakeStockPlanDetailProductDto getByPlanIdAndProductId(@Param("planId") String planId, + @Param("productId") String productId); + + /** + * 根据盘点任务ID查询 + * + * @param planId + * @return + */ + List getDetailsByPlanId(String planId); + + /** + * 更新盘点数量 + * + * @param planId + * @param productId + * @param num + */ + void updateOriTakeNum(@Param("planId") String planId, @Param("productId") String productId, + @Param("num") Integer num); + + /** + * 增加进项数量 + * + * @param scId + * @param productId + * @param num + */ + void addTotalInNum(@Param("scId") String scId, @Param("productId") String productId, + @Param("num") Integer num); + + /** + * 增加出项数量 + * + * @param scId + * @param productId + * @param num + */ + void addTotalOutNum(@Param("scId") String scId, @Param("productId") String productId, + @Param("num") Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanMapper.java new file mode 100644 index 0000000..f7e8acc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockPlanMapper.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.vo.stock.take.plan.QueryTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 盘点任务 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockPlanMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryTakeStockPlanVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List selector(@Param("vo") TakeStockPlanSelectorVo vo); + + /** + * 根据盘点任务ID查询商品信息 + * + * @param planId + * @return + */ + List getProducts(@Param("planId") String planId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + TakeStockPlanFullDto getDetail(String id); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetDetailMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetDetailMapper.java new file mode 100644 index 0000000..a3d2616 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetDetailMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; + +/** + *

+ * 盘点单详情 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetMapper.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetMapper.java new file mode 100644 index 0000000..eaad548 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/TakeStockSheetMapper.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.sc.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetProductVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 盘点单 Mapper 接口 + *

+ * + * @author zmj + */ +public interface TakeStockSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "updateTime", alias = "tb", autoParse = true), + @Sort(value = "approveTime", alias = "tb", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "tb") + }) + List query(@Param("vo") QueryTakeStockSheetVo vo); + + /** + * 根据ID查询详情 + * + * @param id + * @return + */ + TakeStockSheetFullDto getDetail(String id); + + /** + * 根据预先盘点单ID判断是否有盘点单关联 + * + * @param preSheetId + * @return + */ + Boolean hasRelatePreTakeStockSheet(String preSheetId); + + /** + * 根据盘点任务ID查询是否有未审核通过的盘点单 + * + * @param planId + * @return + */ + Boolean hasUnApprove(String planId); + + /** + * 根据关键字查询盘点单商品信息 + * + * @param condition + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryTakeStockByCondition(@Param("planId") String planId, + @Param("condition") String condition); + + /** + * 查询盘点单商品信息 + * + * @param vo + * @return + */ + @DataPermissions(type = SysDataPermissionDataPermissionType.PRODUCT, value = { + @DataPermission(template = "product", alias = "g"), + @DataPermission(template = "brand", alias = "b"), + @DataPermission(template = "category", alias = "c") + }) + List queryTakeStockList(@Param("vo") QueryTakeStockSheetProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetDetailService.java new file mode 100644 index 0000000..aa62115 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetDetailService.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.sc.service.logistics; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.LogisticsSheetDetail; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; + +public interface LogisticsSheetDetailService extends BaseMpService { + + /** + * 根据业务ID查询 + * + * @param bizId + * @param bizType + * @return + */ + LogisticsSheetDetail getByBizId(String bizId, LogisticsSheetDetailBizType bizType); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetService.java new file mode 100644 index 0000000..b03a024 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/logistics/LogisticsSheetService.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.sc.service.logistics; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetBizOrderDto; +import com.lframework.xingyun.sc.dto.logistics.LogisticsSheetFullDto; +import com.lframework.xingyun.sc.entity.LogisticsSheet; +import com.lframework.xingyun.sc.vo.logistics.CreateLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.DeliveryLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.LogisticsSheetSelectorVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetBizOrderVo; +import com.lframework.xingyun.sc.vo.logistics.QueryLogisticsSheetVo; +import com.lframework.xingyun.sc.vo.logistics.UpdateLogisticsSheetVo; +import java.util.List; + +public interface LogisticsSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryLogisticsSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryLogisticsSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + LogisticsSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + LogisticsSheetFullDto getDetail(String id); + + /** + * 查询业务单据列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryBizOrder(Integer pageIndex, Integer pageSize, + QueryLogisticsSheetBizOrderVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateLogisticsSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateLogisticsSheetVo vo); + + /** + * 发货 + * + * @param vo + */ + void delivery(DeliveryLogisticsSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/paytype/OrderPayTypeService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/paytype/OrderPayTypeService.java new file mode 100644 index 0000000..839ce00 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/paytype/OrderPayTypeService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.service.paytype; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.OrderPayType; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import java.util.List; + +public interface OrderPayTypeService extends BaseMpService { + + /** + * 创建 + * + * @param orderId + * @param data + */ + void create(String orderId, List data); + + /** + * 根据订单ID删除 + * + * @param orderId + */ + void deleteByOrderId(String orderId); + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List findByOrderId(String orderId); +} \ No newline at end of file diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseConfigService.java new file mode 100644 index 0000000..342023a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseConfigService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.vo.purchase.config.UpdatePurchaseConfigVo; + +public interface PurchaseConfigService extends BaseMpService { + + /** + * 查询 + * + * @return + */ + PurchaseConfig get(); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePurchaseConfigVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailService.java new file mode 100644 index 0000000..967ef3c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderDetailService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import java.util.List; + +public interface PurchaseOrderDetailService extends BaseMpService { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加收货数量 + * + * @param id + * @param num + */ + void addReceiveNum(String id, Integer num); + + /** + * 减少收货数量 + * + * @param id + * @param num + */ + void subReceiveNum(String id, Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderService.java new file mode 100644 index 0000000..81358b6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseOrderService.java @@ -0,0 +1,200 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderFullDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto; +import com.lframework.xingyun.sc.dto.purchase.PurchaseProductDto; +import com.lframework.xingyun.sc.entity.PurchaseOrder; +import com.lframework.xingyun.sc.vo.purchase.ApprovePassPurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.ApproveRefusePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.BatchApprovePassPurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.BatchApproveRefusePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.CreatePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.PurchaseOrderSelectorVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseOrderVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseOrderWithReceiveVo; +import com.lframework.xingyun.sc.vo.purchase.QueryPurchaseProductVo; +import com.lframework.xingyun.sc.vo.purchase.UpdatePurchaseOrderVo; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; + +import java.util.List; + +public interface PurchaseOrderService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryPurchaseOrderVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPurchaseOrderVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + PurchaseOrderSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseOrderFullDto getDetail(String id); + + /** + * 根据ID查询(收货业务) + * + * @param id + * @return + */ + PurchaseOrderWithReceiveDto getWithReceive(String id); + + /** + * 查询列表(收货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReceive(Integer pageIndex, Integer pageSize, + QueryPurchaseOrderWithReceiveVo vo); + + /** + * 创建订单 + * + * @param vo + * @return + */ + String create(CreatePurchaseOrderVo vo); + + /** + * 修改订单 + * + * @param vo + */ + void update(UpdatePurchaseOrderVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassPurchaseOrderVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassPurchaseOrderVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreatePurchaseOrderVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefusePurchaseOrderVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefusePurchaseOrderVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 取消审核 + * + * @param id + */ + void cancelApprovePass(String id); + + /** + * 根据关键字查询采购商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult queryPurchaseByCondition(Integer pageIndex, Integer pageSize, String condition); + + /** + * 查询可采购商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryPurchaseList(Integer pageIndex, Integer pageSize, QueryPurchaseProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseProductDto getPurchaseById(String id); + + /** + * 云朵里审批反馈接收接口 + * @param vo + */ + void approve(YdoolApproveOrderVo vo); + + /** + * 发送审批 + * @param id + * @return + */ + InvokeResult sendApprove(String id); + + /** + * 根据SKU查询采购商品信息 + * @param sku + * @return + */ + PurchaseProductDto queryPurchaseBySku(String sku); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnDetailService.java new file mode 100644 index 0000000..643fa56 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PurchaseReturnDetail; + +public interface PurchaseReturnDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnService.java new file mode 100644 index 0000000..b4f928e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/PurchaseReturnService.java @@ -0,0 +1,145 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.returned.PurchaseReturnFullDto; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.returned.ApprovePassPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.ApproveRefusePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.BatchApprovePassPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.BatchApproveRefusePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.CreatePurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.QueryPurchaseReturnVo; +import com.lframework.xingyun.sc.vo.purchase.returned.UpdatePurchaseReturnVo; +import java.time.LocalDateTime; +import java.util.List; + +public interface PurchaseReturnService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryPurchaseReturnVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPurchaseReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PurchaseReturnFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreatePurchaseReturnVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePurchaseReturnVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassPurchaseReturnVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassPurchaseReturnVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreatePurchaseReturnVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefusePurchaseReturnVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefusePurchaseReturnVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailService.java new file mode 100644 index 0000000..6c1dd5a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetDetailService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import java.util.List; + +public interface ReceiveSheetDetailService extends BaseMpService { + + /** + * 根据收货单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetService.java new file mode 100644 index 0000000..eef3036 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/purchase/ReceiveSheetService.java @@ -0,0 +1,185 @@ +package com.lframework.xingyun.sc.service.purchase; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetFullDto; +import com.lframework.xingyun.sc.dto.purchase.receive.ReceiveSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.purchase.receive.ApprovePassReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ApproveRefuseReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.BatchApprovePassReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.BatchApproveRefuseReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.CreateReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetVo; +import com.lframework.xingyun.sc.vo.purchase.receive.QueryReceiveSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveSheetSelectorVo; +import com.lframework.xingyun.sc.vo.purchase.receive.UpdateReceiveSheetVo; +import java.time.LocalDateTime; +import java.util.List; + +public interface ReceiveSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryReceiveSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryReceiveSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, ReceiveSheetSelectorVo vo); + + /** + * 根据供应商ID查询默认付款日期 + * + * @param supplierId + */ + GetPaymentDateDto getPaymentDate(String supplierId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ReceiveSheetFullDto getDetail(String id); + + /** + * 根据ID查询(采购退货业务) + * + * @param id + * @return + */ + ReceiveSheetWithReturnDto getWithReturn(String id); + + /** + * 查询列表(采购退货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryReceiveSheetWithReturnVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateReceiveSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateReceiveSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassReceiveSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassReceiveSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateReceiveSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseReceiveSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseReceiveSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailConfigService.java new file mode 100644 index 0000000..a22e672 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailConfigService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.vo.retail.config.UpdateRetailConfigVo; + +public interface RetailConfigService extends BaseMpService { + + /** + * 查询 + * + * @return + */ + RetailConfig get(); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateRetailConfigVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailBundleService.java new file mode 100644 index 0000000..6355ab8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailBundleService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailBundle; + +public interface RetailOutSheetDetailBundleService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailLotService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailLotService.java new file mode 100644 index 0000000..15f4c91 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailLotService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetailLot; + +public interface RetailOutSheetDetailLotService extends BaseMpService { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailService.java new file mode 100644 index 0000000..e4bd908 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetDetailService.java @@ -0,0 +1,47 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import java.math.BigDecimal; +import java.util.List; + +public interface RetailOutSheetDetailService extends BaseMpService { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, Integer num); + + /** + * 根据出库单ID查询商品总重量 + * @param sheetIds + * @return + */ + BigDecimal getTotalWeightBySheetIds(List sheetIds); + + /** + * 根据出库单ID查询商品总体积 + * @param sheetIds + * @return + */ + BigDecimal getTotalVolumeBySheetIds(List sheetIds); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetService.java new file mode 100644 index 0000000..58cea6f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailOutSheetService.java @@ -0,0 +1,188 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.RetailProductDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetFullDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.RetailOutSheet; +import com.lframework.xingyun.sc.vo.retail.out.*; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; + +import java.util.List; + +public interface RetailOutSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryRetailOutSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryRetailOutSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + RetailOutSheetSelectorVo vo); + + /** + * 根据会员ID查询默认付款日期 + * + * @param memberId + */ + GetPaymentDateDto getPaymentDate(String memberId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(零售退货业务) + * + * @param id + * @return + */ + RetailOutSheetWithReturnDto getWithReturn(String id); + + /** + * 查询列表(零售退货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QueryRetailOutSheetWithReturnVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateRetailOutSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateRetailOutSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassRetailOutSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassRetailOutSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateRetailOutSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseRetailOutSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseRetailOutSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 根据关键字查询零售商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult queryRetailByCondition(Integer pageIndex, Integer pageSize, + String condition, Boolean isReturn); + + /** + * 查询可零售商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryRetailList(Integer pageIndex, Integer pageSize, + QueryRetailProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailProductDto getRetailById(String id); + + /** + * 发送审批 + * + * @param id + * @return + */ + InvokeResult sendApprove(String id); + + /** + * 云朵里审批反馈接收接口 + * @param vo + */ + void approve(YdoolApproveOrderVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnDetailService.java new file mode 100644 index 0000000..f5a9358 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.RetailReturnDetail; + +public interface RetailReturnDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnService.java new file mode 100644 index 0000000..0bdda78 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/retail/RetailReturnService.java @@ -0,0 +1,107 @@ +package com.lframework.xingyun.sc.service.retail; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.retail.returned.RetailReturnFullDto; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.vo.retail.returned.ApprovePassRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.ApproveRefuseRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.BatchApprovePassRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.BatchApproveRefuseRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.CreateRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.QueryRetailReturnVo; +import com.lframework.xingyun.sc.vo.retail.returned.UpdateRetailReturnVo; +import java.util.List; + +public interface RetailReturnService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryRetailReturnVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryRetailReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + RetailReturnFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateRetailReturnVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateRetailReturnVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassRetailReturnVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassRetailReturnVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateRetailReturnVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseRetailReturnVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseRetailReturnVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleConfigService.java new file mode 100644 index 0000000..96059a1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleConfigService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.vo.sale.config.UpdateSaleConfigVo; + +public interface SaleConfigService extends BaseMpService { + + /** + * 查询 + * + * @return + */ + SaleConfig get(); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSaleConfigVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailBundleService.java new file mode 100644 index 0000000..e3d565a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailBundleService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle; + +public interface SaleOrderDetailBundleService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailService.java new file mode 100644 index 0000000..1527c62 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderDetailService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import java.util.List; + +public interface SaleOrderDetailService extends BaseMpService { + + /** + * 根据订单ID查询 + * + * @param orderId + * @return + */ + List getByOrderId(String orderId); + + /** + * 增加出库数量 + * + * @param id + * @param num + */ + void addOutNum(String id, Integer num); + + /** + * 减少出库数量 + * + * @param id + * @param num + */ + void subOutNum(String id, Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderService.java new file mode 100644 index 0000000..3f4ffb1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOrderService.java @@ -0,0 +1,186 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.sale.SaleOrderFullDto; +import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto; +import com.lframework.xingyun.sc.dto.sale.SaleProductDto; +import com.lframework.xingyun.sc.entity.SaleOrder; +import com.lframework.xingyun.sc.vo.sale.ApprovePassSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.ApproveRefuseSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.BatchApprovePassSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.BatchApproveRefuseSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.CreateSaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleOrderWithOutVo; +import com.lframework.xingyun.sc.vo.sale.QuerySaleProductVo; +import com.lframework.xingyun.sc.vo.sale.SaleOrderSelectorVo; +import com.lframework.xingyun.sc.vo.sale.UpdateSaleOrderVo; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; + +import java.util.List; + +public interface SaleOrderService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySaleOrderVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySaleOrderVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SaleOrderSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOrderFullDto getDetail(String id); + + /** + * 根据ID查询(发货业务) + * + * @param id + * @return + */ + SaleOrderWithOutDto getWithOut(String id); + + /** + * 查询列表(出库业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithOut(Integer pageIndex, Integer pageSize, + QuerySaleOrderWithOutVo vo); + + /** + * 创建订单 + * + * @param vo + * @return + */ + String create(CreateSaleOrderVo vo); + + /** + * 修改订单 + * + * @param vo + */ + void update(UpdateSaleOrderVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSaleOrderVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassSaleOrderVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSaleOrderVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSaleOrderVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseSaleOrderVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 根据关键字查询销售商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult querySaleByCondition(Integer pageIndex, Integer pageSize, String condition, Boolean isReturn); + + /** + * 查询可销售商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult querySaleList(Integer pageIndex, Integer pageSize, QuerySaleProductVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleProductDto getSaleById(String id); + + /** + * 发送审批流程给ydool系统 + * @param id + * @return + */ + InvokeResult sendApprove(String id); + + + /** + * 云朵里审批反馈接收接口 + * @param vo + */ + void approve(YdoolApproveOrderVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailBundleService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailBundleService.java new file mode 100644 index 0000000..072a2eb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailBundleService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailBundle; + +public interface SaleOutSheetDetailBundleService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailLotService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailLotService.java new file mode 100644 index 0000000..319aed2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailLotService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; + +public interface SaleOutSheetDetailLotService extends BaseMpService { + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetDetailLotDto findById(String id); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailService.java new file mode 100644 index 0000000..e349ce8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetDetailService.java @@ -0,0 +1,47 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import java.math.BigDecimal; +import java.util.List; + +public interface SaleOutSheetDetailService extends BaseMpService { + + /** + * 根据出库单ID查询 + * + * @param sheetId + * @return + */ + List getBySheetId(String sheetId); + + /** + * 增加退货数量 + * + * @param id + * @param num + */ + void addReturnNum(String id, Integer num); + + /** + * 减少退货数量 + * + * @param id + * @param num + */ + void subReturnNum(String id, Integer num); + + /** + * 根据出库单ID查询商品总重量 + * @param sheetIds + * @return + */ + BigDecimal getTotalWeightBySheetIds(List sheetIds); + + /** + * 根据出库单ID查询商品总体积 + * @param sheetIds + * @return + */ + BigDecimal getTotalVolumeBySheetIds(List sheetIds); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetService.java new file mode 100644 index 0000000..a7d1cce --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleOutSheetService.java @@ -0,0 +1,185 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetFullDto; +import com.lframework.xingyun.sc.dto.sale.out.SaleOutSheetWithReturnDto; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.out.ApprovePassSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.ApproveRefuseSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.BatchApprovePassSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.BatchApproveRefuseSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.CreateSaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetVo; +import com.lframework.xingyun.sc.vo.sale.out.QuerySaleOutSheetWithReturnVo; +import com.lframework.xingyun.sc.vo.sale.out.SaleOutSheetSelectorVo; +import com.lframework.xingyun.sc.vo.sale.out.UpdateSaleOutSheetVo; +import java.time.LocalDateTime; +import java.util.List; + +public interface SaleOutSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySaleOutSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySaleOutSheetVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SaleOutSheetSelectorVo vo); + + /** + * 根据客户ID查询默认付款日期 + * + * @param customerId + */ + GetPaymentDateDto getPaymentDate(String customerId); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleOutSheetFullDto getDetail(String id); + + /** + * 根据ID查询(销售退货业务) + * + * @param id + * @return + */ + SaleOutSheetWithReturnDto getWithReturn(String id); + + /** + * 查询列表(销售退货业务) + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryWithReturn(Integer pageIndex, Integer pageSize, + QuerySaleOutSheetWithReturnVo vo); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSaleOutSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSaleOutSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSaleOutSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassSaleOutSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSaleOutSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSaleOutSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseSaleOutSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnDetailService.java new file mode 100644 index 0000000..d972783 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.SaleReturnDetail; + +public interface SaleReturnDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnService.java new file mode 100644 index 0000000..0ae4253 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/sale/SaleReturnService.java @@ -0,0 +1,145 @@ +package com.lframework.xingyun.sc.service.sale; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.sale.returned.SaleReturnFullDto; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.vo.sale.returned.ApprovePassSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.ApproveRefuseSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.BatchApprovePassSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.BatchApproveRefuseSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.CreateSaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.QuerySaleReturnVo; +import com.lframework.xingyun.sc.vo.sale.returned.UpdateSaleReturnVo; +import java.time.LocalDateTime; +import java.util.List; + +public interface SaleReturnService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySaleReturnVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySaleReturnVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SaleReturnFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSaleReturnVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSaleReturnVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSaleReturnVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassSaleReturnVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSaleReturnVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSaleReturnVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseSaleReturnVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockLogService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockLogService.java new file mode 100644 index 0000000..9991a35 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockLogService.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.service.stock; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ProductStockLog; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithAddStockVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithStockCostAdjustVo; +import com.lframework.xingyun.sc.vo.stock.log.AddLogWithSubStockVo; +import com.lframework.xingyun.sc.vo.stock.log.QueryProductStockLogVo; +import java.util.List; + +public interface ProductStockLogService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductStockLogVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductStockLogVo vo); + + /** + * 添加入库记录 + */ + void addLogWithAddStock(AddLogWithAddStockVo vo); + + /** + * 添加出库记录 + */ + void addLogWithSubStock(AddLogWithSubStockVo vo); + + /** + * 添加库存成本调整记录 + * + * @param vo + */ + void addLogWithStockCostAdjust(AddLogWithStockCostAdjustVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockService.java new file mode 100644 index 0000000..33b5dc6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/ProductStockService.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.sc.service.stock; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.core.dto.stock.ProductStockChangeDto; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustDiffDto; +import com.lframework.xingyun.sc.entity.ProductStock; +import com.lframework.xingyun.sc.vo.stock.AddProductStockVo; +import com.lframework.xingyun.sc.vo.stock.QueryProductStockVo; +import com.lframework.xingyun.sc.vo.stock.StockCostAdjustVo; +import com.lframework.xingyun.sc.vo.stock.SubProductStockVo; +import java.util.List; + +public interface ProductStockService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryProductStockVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryProductStockVo vo); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productId + * @param scId + * @return + */ + ProductStock getByProductIdAndScId(String productId, String scId); + + /** + * 根据商品ID、仓库ID查询 + * + * @param productIds + * @param scId + * @return + */ + List getByProductIdsAndScId(List productIds, String scId, + Integer productType); + + /** + * 入库 + * + * @param vo + */ + ProductStockChangeDto addStock(AddProductStockVo vo); + + /** + * 出库 + * + * @param vo + */ + ProductStockChangeDto subStock(SubProductStockVo vo); + + /** + * 库存成本调整 + * + * @param vo + */ + StockCostAdjustDiffDto stockCostAdjust(StockCostAdjustVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustReasonService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustReasonService.java new file mode 100644 index 0000000..e3cc00f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustReasonService.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.StockAdjustReason; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.CreateStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.QueryStockAdjustReasonVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.UpdateStockAdjustReasonVo; +import java.util.Collection; +import java.util.List; + +public interface StockAdjustReasonService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustReasonVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryStockAdjustReasonVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + StockAdjustReasonSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockAdjustReason findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateStockAdjustReasonVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateStockAdjustReasonVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetDetailService.java new file mode 100644 index 0000000..5874b5a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.StockAdjustSheetDetail; + +public interface StockAdjustSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetService.java new file mode 100644 index 0000000..59964b4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockAdjustSheetService.java @@ -0,0 +1,161 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockAdjustSheet; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.ApprovePassStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.ApproveRefuseStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.BatchApprovePassStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.BatchApproveRefuseStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.CreateStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.QueryStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.stock.UpdateStockAdjustSheetVo; +import com.lframework.xingyun.sc.vo.ydool.YdoolApproveOrderVo; + +import java.util.List; + +/** + * 库存调整单 Service + * + * @author zmj + */ +public interface StockAdjustSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryStockAdjustSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryStockAdjustSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockAdjustSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateStockAdjustSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateStockAdjustSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassStockAdjustSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassStockAdjustSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateStockAdjustSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseStockAdjustSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseStockAdjustSheetVo vo); + + /** + * 根据关键字查询库存成本调整单商品信息 + * + * @param pageIndex + * @param pageSize + * @param scId + * @param condition + * @return + */ + PageResult queryStockAdjustByCondition(Integer pageIndex, Integer pageSize, + String scId, String condition); + + /** + * 查询库存成本调整单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryStockAdjustList(Integer pageIndex, Integer pageSize, + QueryStockAdjustProductVo vo); + + /** + * 发送审批 + * + * @param id + * @return + */ + InvokeResult sendApprove(String id); + + /** + * 云朵里审批反馈接收接口 + * @param vo + */ + void approve(YdoolApproveOrderVo vo); + + /** + * 根据SKU查询库存成本调整单商品信息 + * @param scId + * @param sku + * @return + */ + StockAdjustProductDto queryStockAdjustBySku(String scId, String sku); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockCostAdjustSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockCostAdjustSheetDetailService.java new file mode 100644 index 0000000..47a455e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockCostAdjustSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheetDetail; + +public interface StockCostAdjustSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockCostAdjustSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockCostAdjustSheetService.java new file mode 100644 index 0000000..f1084fb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/adjust/StockCostAdjustSheetService.java @@ -0,0 +1,136 @@ +package com.lframework.xingyun.sc.service.stock.adjust; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustProductDto; +import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustSheetFullDto; +import com.lframework.xingyun.sc.entity.StockCostAdjustSheet; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.ApprovePassStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.ApproveRefuseStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.BatchApprovePassStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.BatchApproveRefuseStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.CreateStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustProductVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.QueryStockCostAdjustSheetVo; +import com.lframework.xingyun.sc.vo.stock.adjust.cost.UpdateStockCostAdjustSheetVo; +import java.util.List; + +/** + * 库存成本调整单 Service + * + * @author zmj + */ +public interface StockCostAdjustSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryStockCostAdjustSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryStockCostAdjustSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + StockCostAdjustSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateStockCostAdjustSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateStockCostAdjustSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassStockCostAdjustSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassStockCostAdjustSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateStockCostAdjustSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseStockCostAdjustSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseStockCostAdjustSheetVo vo); + + /** + * 根据关键字查询库存成本调整单商品信息 + * + * @param pageIndex + * @param pageSize + * @param scId + * @param condition + * @return + */ + PageResult queryStockCostAdjustByCondition(Integer pageIndex, Integer pageSize, + String scId, String condition); + + /** + * 查询库存成本调整单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryStockCostAdjustList(Integer pageIndex, Integer pageSize, + QueryStockCostAdjustProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetDetailService.java new file mode 100644 index 0000000..e12bb66 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.PreTakeStockSheetDetail; + +public interface PreTakeStockSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetService.java new file mode 100644 index 0000000..c494536 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/PreTakeStockSheetService.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockProductDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.PreTakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.pre.QueryPreTakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.PreTakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.pre.CreatePreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockProductVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.QueryPreTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.pre.UpdatePreTakeStockSheetVo; +import java.util.List; + +/** + * 预先盘点单 Service + * + * @author zmj + */ +public interface PreTakeStockSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryPreTakeStockSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryPreTakeStockSheetVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + PreTakeStockSheetSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + PreTakeStockSheetFullDto getDetail(String id); + + /** + * 根据预先盘点单、盘点任务查询商品信息 + * + * @param id + * @param planId + * @return + */ + List getProducts(String id, String planId); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreatePreTakeStockSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdatePreTakeStockSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据ID批量删除 + * + * @param ids + */ + void batchDelete(List ids); + + /** + * 根据关键字查询预先盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult queryPreTakeStockByCondition(Integer pageIndex, Integer pageSize, + String condition); + + /** + * 查询预先盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryPreTakeStockList(Integer pageIndex, Integer pageSize, + QueryPreTakeStockProductVo vo); + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockConfigService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockConfigService.java new file mode 100644 index 0000000..c42ae83 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockConfigService.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.TakeStockConfig; +import com.lframework.xingyun.sc.vo.stock.take.config.UpdateTakeStockConfigVo; + +/** + * 盘点参数 Service + * + * @author zmj + */ +public interface TakeStockConfigService extends BaseMpService { + + /** + * 根据ID查询 + * + * @return + */ + TakeStockConfig get(); + + + /** + * 修改 + * + * @param vo + */ + void update(UpdateTakeStockConfigVo vo); + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanDetailService.java new file mode 100644 index 0000000..9ba6817 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanDetailService.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.plan.GetTakeStockPlanDetailProductDto; +import com.lframework.xingyun.sc.entity.TakeStockPlanDetail; +import java.util.List; + +public interface TakeStockPlanDetailService extends BaseMpService { + + /** + * 根据盘点任务ID、商品ID查询 + * + * @param planId + * @param productId + * @return + */ + GetTakeStockPlanDetailProductDto getByPlanIdAndProductId(String planId, String productId); + + /** + * 单品盘点-保存盘点任务明细 + * + * @param planId + * @param productIds + */ + void savePlanDetailBySimple(String planId, List productIds); + + /** + * 根据盘点任务ID查询 + * + * @param planId + * @return + */ + List getDetailsByPlanId(String planId); + + /** + * 更新盘点数量 + * + * @param planId + * @param productId + * @param num + */ + void updateOriTakeNum(String planId, String productId, Integer num); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanService.java new file mode 100644 index 0000000..33fb192 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockPlanService.java @@ -0,0 +1,108 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.plan.QueryTakeStockPlanProductDto; +import com.lframework.xingyun.sc.dto.stock.take.plan.TakeStockPlanFullDto; +import com.lframework.xingyun.sc.entity.TakeStockPlan; +import com.lframework.xingyun.sc.vo.stock.take.plan.CancelTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.CreateTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.HandleTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.QueryTakeStockPlanVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo; +import com.lframework.xingyun.sc.vo.stock.take.plan.UpdateTakeStockPlanVo; +import java.util.List; + +/** + * 盘点任务 Service + * + * @author zmj + */ +public interface TakeStockPlanService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryTakeStockPlanVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryTakeStockPlanVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + TakeStockPlanSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + TakeStockPlanFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateTakeStockPlanVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateTakeStockPlanVo vo); + + /** + * 根据盘点任务ID查询商品信息 + * + * @param planId + * @return + */ + List getProducts(String planId); + + /** + * 差异生成 + * + * @param id + */ + void createDiff(String id); + + /** + * 差异处理 + * + * @param vo + */ + void handleDiff(HandleTakeStockPlanVo vo); + + /** + * 作废 + * + * @param vo + */ + void cancel(CancelTakeStockPlanVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetDetailService.java new file mode 100644 index 0000000..664d577 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.TakeStockSheetDetail; + +public interface TakeStockSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetService.java new file mode 100644 index 0000000..0625f02 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/take/TakeStockSheetService.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.sc.service.stock.take; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetFullDto; +import com.lframework.xingyun.sc.dto.stock.take.sheet.TakeStockSheetProductDto; +import com.lframework.xingyun.sc.entity.TakeStockSheet; +import com.lframework.xingyun.sc.vo.stock.take.sheet.ApprovePassTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.ApproveRefuseTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.BatchApprovePassTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.BatchApproveRefuseTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.CreateTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetProductVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.QueryTakeStockSheetVo; +import com.lframework.xingyun.sc.vo.stock.take.sheet.UpdateTakeStockSheetVo; +import java.util.List; + +/** + * 盘点单 Service + * + * @author zmj + */ +public interface TakeStockSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryTakeStockSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryTakeStockSheetVo vo); + + /** + * 根据ID查询详情 + * + * @param id + * @return + */ + TakeStockSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateTakeStockSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateTakeStockSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassTakeStockSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassTakeStockSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateTakeStockSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseTakeStockSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseTakeStockSheetVo vo); + + /** + * 取消审核 + * + * @param id + */ + void cancelApprovePass(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据ID删除 + * + * @param ids + */ + void batchDelete(List ids); + + /** + * 根据预先盘点单ID判断是否有盘点单关联 + * + * @param preSheetId + * @return + */ + Boolean hasRelatePreTakeStockSheet(String preSheetId); + + /** + * 根据盘点任务ID查询是否有未审核通过的盘点单 + * + * @param planId + * @return + */ + Boolean hasUnApprove(String planId); + + /** + * 根据关键字查询盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param condition + * @return + */ + PageResult queryTakeStockByCondition(Integer pageIndex, Integer pageSize, String planId, + String condition); + + /** + * 查询盘点单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryTakeStockList(Integer pageIndex, Integer pageSize, + QueryTakeStockSheetProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailReceiveService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailReceiveService.java new file mode 100644 index 0000000..0d13bda --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailReceiveService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.sc.service.stock.transfer; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetailReceive; + +public interface ScTransferOrderDetailReceiveService extends + BaseMpService { + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailService.java new file mode 100644 index 0000000..745eab8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderDetailService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.sc.service.stock.transfer; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.entity.ScTransferOrderDetail; + +public interface ScTransferOrderDetailService extends BaseMpService { + + /** + * 收货 + * + * @param productId + * @param receiveNum + * @return + */ + int receive(String orderId, String productId, Integer receiveNum); + + /** + * 统计未收货的商品 + * + * @param orderId + * @return + */ + int countUnReceive(String orderId); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderService.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderService.java new file mode 100644 index 0000000..86189ef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/stock/transfer/ScTransferOrderService.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.sc.service.stock.transfer; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferOrderFullDto; +import com.lframework.xingyun.sc.dto.stock.transfer.ScTransferProductDto; +import com.lframework.xingyun.sc.entity.ScTransferOrder; +import com.lframework.xingyun.sc.vo.stock.transfer.ApprovePassScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ApproveRefuseScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.BatchApprovePassScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.BatchApproveRefuseScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.CreateScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.QueryScTransferProductVo; +import com.lframework.xingyun.sc.vo.stock.transfer.ReceiveScTransferOrderVo; +import com.lframework.xingyun.sc.vo.stock.transfer.UpdateScTransferOrderVo; +import java.util.List; + +public interface ScTransferOrderService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryScTransferOrderVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryScTransferOrderVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + ScTransferOrderFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateScTransferOrderVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateScTransferOrderVo vo); + + /** + * 根据ID删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassScTransferOrderVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassScTransferOrderVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateScTransferOrderVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseScTransferOrderVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseScTransferOrderVo vo); + + /** + * 收货 + * @param vo + */ + void receive(ReceiveScTransferOrderVo vo); + + /** + * 根据关键字查询仓库调拨单商品信息 + * + * @param pageIndex + * @param pageSize + * @param scId + * @param condition + * @return + */ + PageResult queryScTransferByCondition(Integer pageIndex, Integer pageSize, + String scId, String condition); + + /** + * 查询仓库调拨单商品信息 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryScTransferList(Integer pageIndex, Integer pageSize, + QueryScTransferProductVo vo); +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/utils/WebUtils.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/utils/WebUtils.java new file mode 100644 index 0000000..657d512 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/utils/WebUtils.java @@ -0,0 +1,109 @@ +package com.lframework.xingyun.sc.utils; + +import cn.hutool.core.collection.ArrayIter; +import cn.hutool.core.collection.IterUtil; +import cn.hutool.core.map.CaseInsensitiveMap; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.text.CharSequenceUtil; +import cn.hutool.core.util.ArrayUtil; + +import org.springframework.util.Assert; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + + +public class WebUtils { + + private static final String UNKNOWN ="unknown"; + + public static HttpServletRequest getHttpRequest() { + ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); + Assert.notNull(attributes, "RequestContextHolder.getRequestAttributes can't be NULL"); + return attributes.getRequest(); + } + + public static HttpServletRequest getRequest() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + return (requestAttributes == null) ? null : ((ServletRequestAttributes) requestAttributes).getRequest(); + } + + public static HttpServletResponse getResponse() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + return (requestAttributes == null) ? null : ((ServletRequestAttributes) requestAttributes).getResponse(); + } + + public static void redirect(String url) throws Exception { + redirect(getResponse(), url); + } + + public static void redirect(HttpServletResponse response, String url) throws Exception { + response.sendRedirect(url); + } + + public static void addCookie(String name, String value) { + getResponse().addCookie(new Cookie(name, value)); + } + + public static void addCookie(String name, String value, int expiry) { + Cookie cookie = new Cookie(name, value); + cookie.setMaxAge(expiry); + cookie.setPath("/"); + getResponse().addCookie(cookie); + } + + public static String getCookie(String name) { + Map cookieMap = readCookieMap(getRequest()); + return cookieMap.containsKey(name) ? ((Cookie)cookieMap.get(name)).getValue() : null; + } + + public static Map readCookieMap(HttpServletRequest httpServletRequest) { + Cookie[] cookies = httpServletRequest.getCookies(); + return ArrayUtil.isEmpty(cookies) ? MapUtil.empty() : IterUtil.toMap(new ArrayIter(httpServletRequest.getCookies()), new CaseInsensitiveMap(), Cookie::getName); + } + + + + public static String getRemoteIpAddress() { + return getRemoteIpAddress(getRequest()); + } + + public static String getRemoteIpAddress(HttpServletRequest request) { + String ip = null; + // X-Forwarded-For:Squid 服务代理 + String ipAddresses = request.getHeader("X-Forwarded-For"); + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // Proxy-Client-IP:apache 服务代理 + ipAddresses = request.getHeader("Proxy-Client-IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + ipAddresses = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // WL-Proxy-Client-IP:weblogic 服务代理 + ipAddresses = request.getHeader("WL-Proxy-Client-IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // HTTP_CLIENT_IP:有些代理服务器 + ipAddresses = request.getHeader("HTTP_CLIENT_IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // X-Real-IP:nginx服务代理 + ipAddresses = request.getHeader("X-Real-IP"); + } + // 有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP + if (CharSequenceUtil.isNotBlank(ipAddresses)) { + ip = ipAddresses.split(",")[0]; + } + // 还是不能获取到,最后再通过request.getRemoteAddr();获取 + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + ip = request.getRemoteAddr(); + } + return ip; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/address/CreateOrderAddressVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/address/CreateOrderAddressVo.java new file mode 100644 index 0000000..38b44bc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/address/CreateOrderAddressVo.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.sc.vo.address; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.basedata.enums.AddressType; +import com.lframework.xingyun.sc.enums.OrderAddressOrderType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateOrderAddressVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + private String orderId; + + /** + * 地址类型 + */ + @ApiModelProperty(value = "订单类型", required = true) + @NotNull(message = "订单类型不能为空!") + @IsEnum(message = "订单类型格式错误!", enumClass = OrderAddressOrderType.class) + private Integer orderType; + + /** + * 地址类型 + */ + @ApiModelProperty(value = "地址类型", required = true) + @NotNull(message = "地址类型不能为空!") + @IsEnum(message = "地址类型格式错误!", enumClass = AddressType.class) + private Integer addressType; + + /** + * 姓名 + */ + @ApiModelProperty(value = "姓名", required = true) + @NotBlank(message = "姓名不能为空!") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号", required = true) + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 省ID + */ + @ApiModelProperty(value = "省ID", required = true) + @NotBlank(message = "省ID不能为空!") + private String provinceId; + + /** + * 市ID + */ + @ApiModelProperty(value = "市ID", required = true) + @NotBlank(message = "市ID不能为空!") + private String cityId; + + /** + * 区ID + */ + @ApiModelProperty(value = "区ID", required = true) + @NotBlank(message = "区ID不能为空!") + private String districtId; + + /** + * 详细地址 + */ + @ApiModelProperty(value = "详细地址", required = true) + @NotBlank(message = "详细地址不能为空!") + private String address; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/CreateLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/CreateLogisticsSheetVo.java new file mode 100644 index 0000000..e37ae62 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/CreateLogisticsSheetVo.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateLogisticsSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 物流单号 + */ + @ApiModelProperty(value = "物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @ApiModelProperty(value = "物流公司ID", required = true) + @NotBlank(message = "物流公司ID不能为空!") + private String logisticsCompanyId; + + /** + * 寄件人姓名 + */ + @ApiModelProperty(value = "寄件人姓名", required = true) + @NotBlank(message = "寄件人姓名不能为空!") + private String senderName; + + /** + * 寄件人联系电话 + */ + @ApiModelProperty(value = "寄件人联系电话", required = true) + @NotBlank(message = "寄件人联系电话不能为空!") + private String senderTelephone; + + /** + * 寄件人省 + */ + @ApiModelProperty(value = "寄件人省", required = true) + @NotBlank(message = "寄件人省不能为空!") + private String senderProvinceId; + + /** + * 寄件人市 + */ + @ApiModelProperty(value = "寄件人市", required = true) + @NotBlank(message = "寄件人市不能为空!") + private String senderCityId; + + /** + * 寄件人区 + */ + @ApiModelProperty(value = "寄件人区", required = true) + @NotBlank(message = "寄件人区不能为空!") + private String senderDistrictId; + + /** + * 寄件人地址 + */ + @ApiModelProperty(value = "寄件人地址", required = true) + @NotBlank(message = "寄件人地址不能为空!") + private String senderAddress; + + /** + * 收件人姓名 + */ + @ApiModelProperty(value = "收件人姓名", required = true) + @NotBlank(message = "收件人姓名不能为空!") + private String receiverName; + + /** + * 收件人联系电话 + */ + @ApiModelProperty(value = "收件人联系电话", required = true) + @NotBlank(message = "收件人联系电话不能为空!") + private String receiverTelephone; + + /** + * 收件人省 + */ + @ApiModelProperty(value = "收件人省", required = true) + @NotBlank(message = "收件人省不能为空!") + private String receiverProvinceId; + + /** + * 收件人市 + */ + @ApiModelProperty(value = "收件人市", required = true) + @NotBlank(message = "收件人市不能为空!") + private String receiverCityId; + + /** + * 收件人区 + */ + @ApiModelProperty(value = "收件人区", required = true) + @NotBlank(message = "收件人区不能为空!") + private String receiverDistrictId; + + /** + * 收件人地址 + */ + @ApiModelProperty(value = "收件人地址", required = true) + @NotBlank(message = "收件人地址不能为空!") + private String receiverAddress; + + /** + * 总重量 + */ + @ApiModelProperty(value = "总重量") + @Min(value = 0, message = "总重量必须大于0!") + private BigDecimal totalWeight; + + /** + * 总体积 + */ + @ApiModelProperty(value = "总体积") + @Min(value = 0, message = "总体积必须大于0!") + private BigDecimal totalVolume; + + /** + * 物流费 + */ + @ApiModelProperty(value = "物流费") + @Min(value = 0, message = "物流费必须大于0!") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 业务单据 + */ + @NotEmpty(message = "业务单据不能为空!") + @Valid + private List bizOrders; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/DeliveryLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/DeliveryLogisticsSheetVo.java new file mode 100644 index 0000000..34bc818 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/DeliveryLogisticsSheetVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class DeliveryLogisticsSheetVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 物流单号 + */ + @ApiModelProperty("物流单号") + private String logisticsNo; + + /** + * 物流费 + */ + @ApiModelProperty("物流费") + @Min(value = 0, message = "物流费必须大于0!") + private BigDecimal totalAmount; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetBizOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetBizOrderVo.java new file mode 100644 index 0000000..0ef3e52 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetBizOrderVo.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class LogisticsSheetBizOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据ID + */ + @ApiModelProperty(value = "业务单据ID", required = true) + @NotBlank(message = "业务单据ID不能为空!") + private String bizId; + + /** + * 业务类型 + */ + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型格式错误!", enumClass = LogisticsSheetDetailBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetCalcWeightOrVolumeVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetCalcWeightOrVolumeVo.java new file mode 100644 index 0000000..06eb4dc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetCalcWeightOrVolumeVo.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetDetailBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class LogisticsSheetCalcWeightOrVolumeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据 + */ + @ApiModelProperty(value = "业务单据", required = true) + @NotEmpty(message = "业务单据不能为空!") + @Valid + private List bizOrders; + + @Data + public static class BizOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据ID + */ + @ApiModelProperty(value = "业务单据ID", required = true) + @NotBlank(message = "业务单据ID不能为空!") + private String bizId; + + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型格式错误!", enumClass = LogisticsSheetDetailBizType.class) + private Integer bizType; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetSelectorVo.java new file mode 100644 index 0000000..565dfb4 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/LogisticsSheetSelectorVo.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class LogisticsSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 物流单号 + */ + @ApiModelProperty("物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @ApiModelProperty("物流公司ID") + private String logisticsCompanyId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 发货人ID + */ + @ApiModelProperty("发货人ID") + private String deliveryBy; + + /** + * 发货起始时间 + */ + @ApiModelProperty("发货起始时间") + private LocalDateTime deliveryStartTime; + + /** + * 发货截止时间 + */ + @ApiModelProperty("发货截止时间") + private LocalDateTime deliveryEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = LogisticsSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetBizOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetBizOrderVo.java new file mode 100644 index 0000000..80f90ce --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetBizOrderVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryLogisticsSheetBizOrderVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetVo.java new file mode 100644 index 0000000..083b33f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/QueryLogisticsSheetVo.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.LogisticsSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryLogisticsSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 物流单号 + */ + @ApiModelProperty("物流单号") + private String logisticsNo; + + /** + * 物流公司ID + */ + @ApiModelProperty("物流公司ID") + private String logisticsCompanyId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 发货人ID + */ + @ApiModelProperty("发货人ID") + private String deliveryBy; + + /** + * 发货起始时间 + */ + @ApiModelProperty("发货起始时间") + private LocalDateTime deliveryStartTime; + + /** + * 发货截止时间 + */ + @ApiModelProperty("发货截止时间") + private LocalDateTime deliveryEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = LogisticsSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/UpdateLogisticsSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/UpdateLogisticsSheetVo.java new file mode 100644 index 0000000..8ad4631 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/logistics/UpdateLogisticsSheetVo.java @@ -0,0 +1,19 @@ +package com.lframework.xingyun.sc.vo.logistics; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateLogisticsSheetVo extends CreateLogisticsSheetVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/paytype/OrderPayTypeVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/paytype/OrderPayTypeVo.java new file mode 100644 index 0000000..b806a87 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/paytype/OrderPayTypeVo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.sc.vo.paytype; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class OrderPayTypeVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 支付金额 + */ + @ApiModelProperty("支付金额") + @NotNull(message = "支付金额不能为空!") + private BigDecimal payAmount; + + /** + * 支付内容 + */ + @ApiModelProperty("支付内容") + private String text; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApprovePassPurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApprovePassPurchaseOrderVo.java new file mode 100644 index 0000000..da20469 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApprovePassPurchaseOrderVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassPurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotBlank(message = "订单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApproveRefusePurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApproveRefusePurchaseOrderVo.java new file mode 100644 index 0000000..870ae59 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/ApproveRefusePurchaseOrderVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefusePurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotBlank(message = "订单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/BatchApprovePassPurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/BatchApprovePassPurchaseOrderVo.java new file mode 100644 index 0000000..d98babc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/BatchApprovePassPurchaseOrderVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassPurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotEmpty(message = "订单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/BatchApproveRefusePurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/BatchApproveRefusePurchaseOrderVo.java new file mode 100644 index 0000000..08994be --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/BatchApproveRefusePurchaseOrderVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefusePurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotEmpty(message = "订单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/CreatePurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/CreatePurchaseOrderVo.java new file mode 100644 index 0000000..23493b2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/CreatePurchaseOrderVo.java @@ -0,0 +1,111 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreatePurchaseOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 预计到货日期 + */ + @ApiModelProperty(value = "预计到货日期", required = true) + @NotNull(message = "预计到货日期不能为空!") + private LocalDate expectArriveDate; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @ApiModelProperty("约定支付") + @Valid + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (PurchaseProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getPurchaseNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品采购数量不能为空!"); + } + + if (product.getPurchaseNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品采购数量必须大于0!"); + } + + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品采购价不能为空!"); + } + + if (product.getPurchasePrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品采购价不允许小于0!"); + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.mul(t.getPurchaseNum(), t.getPurchasePrice())).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseOrderSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseOrderSelectorVo.java new file mode 100644 index 0000000..3912ec9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseOrderSelectorVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class PurchaseOrderSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = PurchaseOrderStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseProductVo.java new file mode 100644 index 0000000..f3e554e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/PurchaseProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class PurchaseProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 采购数量 + */ + @ApiModelProperty("采购数量") + private Integer purchaseNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderVo.java new file mode 100644 index 0000000..3bb5787 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderVo.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.PurchaseOrderStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPurchaseOrderVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = PurchaseOrderStatus.class) + private Integer status; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderWithReceiveVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderWithReceiveVo.java new file mode 100644 index 0000000..c8348da --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseOrderWithReceiveVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPurchaseOrderWithReceiveVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseProductVo.java new file mode 100644 index 0000000..2bc96c6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/QueryPurchaseProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryPurchaseProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/UpdatePurchaseOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/UpdatePurchaseOrderVo.java new file mode 100644 index 0000000..223beac --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/UpdatePurchaseOrderVo.java @@ -0,0 +1,19 @@ +package com.lframework.xingyun.sc.vo.purchase; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdatePurchaseOrderVo extends CreatePurchaseOrderVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotBlank(message = "订单ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/config/UpdatePurchaseConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/config/UpdatePurchaseConfigVo.java new file mode 100644 index 0000000..e64fa1a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/config/UpdatePurchaseConfigVo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.sc.vo.purchase.config; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdatePurchaseConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 采购收货单是否关联采购订单 + */ + @ApiModelProperty(value = "采购收货单是否关联采购订单", required = true) + @NotNull(message = "采购收货单是否关联采购订单不能为空!") + private Boolean receiveRequirePurchase; + + /** + * 采购收货单是否多次关联采购订单 + */ + @ApiModelProperty(value = "采购收货单是否多次关联采购订单", required = true) + @NotNull(message = "采购收货单是否多次关联采购订单不能为空!") + private Boolean receiveMultipleRelatePurchase; + + /** + * 采购退货单是否关联采购收货单 + */ + @ApiModelProperty(value = "采购退货单是否关联采购收货单", required = true) + @NotNull(message = "采购退货单是否关联采购收货单不能为空!") + private Boolean purchaseReturnRequireReceive; + + /** + * 采购退货单是否多次关联采购收货单 + */ + @ApiModelProperty(value = "采购退货单是否多次关联采购收货单", required = true) + @NotNull(message = "采购退货单是否多次关联采购收货单不能为空!") + private Boolean purchaseReturnMultipleRelateReceive; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApprovePassReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApprovePassReceiveSheetVo.java new file mode 100644 index 0000000..f63af93 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApprovePassReceiveSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @ApiModelProperty(value = "收货单ID", required = true) + @NotBlank(message = "收货单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApproveRefuseReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApproveRefuseReceiveSheetVo.java new file mode 100644 index 0000000..197197c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ApproveRefuseReceiveSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @ApiModelProperty(value = "收货单ID", required = true) + @NotBlank(message = "收货单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/BatchApprovePassReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/BatchApprovePassReceiveSheetVo.java new file mode 100644 index 0000000..ed17eb0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/BatchApprovePassReceiveSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @ApiModelProperty(value = "收货单ID", required = true) + @NotEmpty(message = "收货单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/BatchApproveRefuseReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/BatchApproveRefuseReceiveSheetVo.java new file mode 100644 index 0000000..7a2e62d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/BatchApproveRefuseReceiveSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @ApiModelProperty(value = "收货单ID", required = true) + @NotEmpty(message = "收货单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/CreateReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/CreateReceiveSheetVo.java new file mode 100644 index 0000000..a137b37 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/CreateReceiveSheetVo.java @@ -0,0 +1,168 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.PurchaseOrderDetail; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.PurchaseOrderDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateReceiveSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @ApiModelProperty("是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 到货日期 + */ + @ApiModelProperty(value = "到货日期", required = true) + @NotNull(message = "到货日期不能为空!") + private LocalDate receiveDate; + + /** + * 采购订单ID + */ + @ApiModelProperty("采购订单ID") + private String purchaseOrderId; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 是否关联采购订单 + */ + @ApiModelProperty("是否关联采购订单") + private Boolean required; + + public void validate() { + + PurchaseConfigService purchaseConfigService = ApplicationUtil.getBean( + PurchaseConfigService.class); + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getReceiveRequirePurchase().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(purchaseConfig.getReceiveRequirePurchase()); + } + + protected void validate(boolean requirePurchase) { + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + GetPaymentDateDto paymentDate = receiveSheetService.getPaymentDate(this.supplierId); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requirePurchase) { + if (StringUtil.isBlank(this.getPurchaseOrderId())) { + throw new InputErrorException("采购订单不能为空!"); + } + } + + PurchaseOrderDetailService purchaseOrderDetailService = ApplicationUtil.getBean( + PurchaseOrderDetailService.class); + + int orderNo = 1; + for (ReceiveProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReceiveNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品收货数量不能为空!"); + } + + if (product.getReceiveNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品收货数量必须大于0!"); + } + + if (!requirePurchase) { + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品采购价不能为空!"); + } + + if (product.getPurchasePrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品采购价不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getPurchasePrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许2位小数!"); + } + } else { + if (StringUtil.isNotBlank(product.getPurchaseOrderDetailId())) { + PurchaseOrderDetail orderDetail = purchaseOrderDetailService.getById( + product.getPurchaseOrderDetailId()); + product.setPurchasePrice(orderDetail.getTaxPrice()); + } else { + product.setPurchasePrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetVo.java new file mode 100644 index 0000000..33d4e47 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetVo.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryReceiveSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = ReceiveSheetStatus.class) + private Integer status; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 采购订单号 + */ + @ApiModelProperty("采购订单号") + private String purchaseOrderCode; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetWithReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetWithReturnVo.java new file mode 100644 index 0000000..03490a5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/QueryReceiveSheetWithReturnVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryReceiveSheetWithReturnVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveProductVo.java new file mode 100644 index 0000000..ad5072a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveProductVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class ReceiveProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 收货数量 + */ + @ApiModelProperty("收货数量") + private Integer receiveNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 采购订单明细ID + */ + @ApiModelProperty("采购订单明细ID") + private String purchaseOrderDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveSheetSelectorVo.java new file mode 100644 index 0000000..123a315 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/ReceiveSheetSelectorVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.ReceiveSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class ReceiveSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = ReceiveSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/UpdateReceiveSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/UpdateReceiveSheetVo.java new file mode 100644 index 0000000..4b7a651 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/receive/UpdateReceiveSheetVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.purchase.receive; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateReceiveSheetVo extends CreateReceiveSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * 收货单ID + */ + @ApiModelProperty(value = "收货单ID", required = true) + @NotBlank(message = "收货单ID不能为空!") + private String id; + + @Override + public void validate() { + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + ReceiveSheet receiveSheet = receiveSheetService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(receiveSheet.getPurchaseOrderId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApprovePassPurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApprovePassPurchaseReturnVo.java new file mode 100644 index 0000000..e088109 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApprovePassPurchaseReturnVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassPurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @ApiModelProperty(value = "退货单ID", required = true) + @NotBlank(message = "退货单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApproveRefusePurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApproveRefusePurchaseReturnVo.java new file mode 100644 index 0000000..1882843 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ApproveRefusePurchaseReturnVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefusePurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @ApiModelProperty(value = "退货单ID", required = true) + @NotBlank(message = "退货单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/BatchApprovePassPurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/BatchApprovePassPurchaseReturnVo.java new file mode 100644 index 0000000..8c44cf9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/BatchApprovePassPurchaseReturnVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassPurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @ApiModelProperty(value = "退货单ID", required = true) + @NotEmpty(message = "退货单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/BatchApproveRefusePurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/BatchApproveRefusePurchaseReturnVo.java new file mode 100644 index 0000000..fc0837a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/BatchApproveRefusePurchaseReturnVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefusePurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @ApiModelProperty(value = "退货单ID", required = true) + @NotEmpty(message = "退货单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/CreatePurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/CreatePurchaseReturnVo.java new file mode 100644 index 0000000..f647c76 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/CreatePurchaseReturnVo.java @@ -0,0 +1,162 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.PurchaseConfig; +import com.lframework.xingyun.sc.entity.ReceiveSheetDetail; +import com.lframework.xingyun.sc.service.purchase.PurchaseConfigService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetDetailService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreatePurchaseReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private LocalDate paymentDate; + + /** + * 收货单ID + */ + @ApiModelProperty("收货单ID") + private String receiveSheetId; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + @Valid + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 是否关联采购收货单 + */ + @ApiModelProperty("是否关联采购收货单") + private Boolean required; + + public void validate() { + + PurchaseConfigService purchaseConfigService = ApplicationUtil.getBean( + PurchaseConfigService.class); + PurchaseConfig purchaseConfig = purchaseConfigService.get(); + + if (!purchaseConfig.getPurchaseReturnRequireReceive().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(purchaseConfig.getPurchaseReturnRequireReceive()); + } + + protected void validate(boolean requireReceive) { + + ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); + GetPaymentDateDto paymentDate = receiveSheetService.getPaymentDate(this.supplierId); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireReceive) { + if (StringUtil.isBlank(this.getReceiveSheetId())) { + throw new InputErrorException("采购收货单不能为空!"); + } + } + + ReceiveSheetDetailService receiveSheetDetailService = ApplicationUtil.getBean( + ReceiveSheetDetailService.class); + + int orderNo = 1; + for (ReturnProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReturnNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品退货数量不能为空!"); + } + + if (product.getReturnNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品退货数量必须大于0!"); + } + + if (!requireReceive) { + if (product.getPurchasePrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品采购价不能为空!"); + } + + if (product.getPurchasePrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品采购价不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getPurchasePrice(), 2)) { + throw new InputErrorException("第" + orderNo + "行商品采购价最多允许2位小数!"); + } + } else { + if (StringUtil.isNotBlank(product.getReceiveSheetDetailId())) { + ReceiveSheetDetail detail = receiveSheetDetailService.getById( + product.getReceiveSheetDetailId()); + product.setPurchasePrice(detail.getTaxPrice()); + } else { + product.setPurchasePrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/QueryPurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/QueryPurchaseReturnVo.java new file mode 100644 index 0000000..1fa0b04 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/QueryPurchaseReturnVo.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.PurchaseReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPurchaseReturnVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = PurchaseReturnStatus.class) + private Integer status; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String purchaserId; + + /** + * 采购订单号 + */ + @ApiModelProperty("采购订单号") + private String receiveSheetCode; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ReturnProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ReturnProductVo.java new file mode 100644 index 0000000..ca3b35f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/ReturnProductVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class ReturnProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 采购价 + */ + @ApiModelProperty("采购价") + private BigDecimal purchasePrice; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 收货单明细ID + */ + @ApiModelProperty("收货单明细ID") + private String receiveSheetDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/UpdatePurchaseReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/UpdatePurchaseReturnVo.java new file mode 100644 index 0000000..ba96ac6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/purchase/returned/UpdatePurchaseReturnVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.sc.vo.purchase.returned; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdatePurchaseReturnVo extends CreatePurchaseReturnVo { + + private static final long serialVersionUID = 1L; + + /** + * 退货单ID + */ + @ApiModelProperty(value = "退货单ID", required = true) + @NotBlank(message = "退货单ID不能为空!") + private String id; + + @Override + public void validate() { + + PurchaseReturnService purchaseReturnService = ApplicationUtil.getBean( + PurchaseReturnService.class); + PurchaseReturn purchaseReturn = purchaseReturnService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(purchaseReturn.getReceiveSheetId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/config/UpdateRetailConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/config/UpdateRetailConfigVo.java new file mode 100644 index 0000000..ec3c63b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/config/UpdateRetailConfigVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.vo.retail.config; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateRetailConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 零售出库单上的会员是否必填 + */ + @ApiModelProperty(value = "零售出库单上的会员是否必填", required = true) + @NotNull(message = "零售出库单上的会员是否必填不能为空!") + private Boolean retailOutSheetRequireMember; + + /** + * 零售退货单是否关联零售出库单 + */ + @ApiModelProperty(value = "零售退货单是否关联零售出库单", required = true) + @NotNull(message = "零售退货单是否关联零售出库单不能为空!") + private Boolean retailReturnRequireOutStock; + + /** + * 零售退货单是否多次关联零售出库单 + */ + @ApiModelProperty(value = "零售退货单是否多次关联零售出库单", required = true) + @NotNull(message = "零售退货单是否多次关联零售出库单不能为空!") + private Boolean retailReturnMultipleRelateOutStock; + + /** + * 零售退货单上的会员是否必填 + */ + @ApiModelProperty(value = "零售退货单上的会员是否必填", required = true) + @NotNull(message = "零售退货单上的会员是否必填不能为空!") + private Boolean retailReturnRequireMember; + + /** + * 零售出库单是否需要发货 + */ + @ApiModelProperty(value = "零售出库单是否需要发货", required = true) + @NotNull(message = "零售出库单是否需要发货不能为空!") + private Boolean retailOutSheetRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApprovePassRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApprovePassRetailOutSheetVo.java new file mode 100644 index 0000000..17fec3f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApprovePassRetailOutSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApproveRefuseRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApproveRefuseRetailOutSheetVo.java new file mode 100644 index 0000000..ce0aa88 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/ApproveRefuseRetailOutSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/BatchApprovePassRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/BatchApprovePassRetailOutSheetVo.java new file mode 100644 index 0000000..ab0094f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/BatchApprovePassRetailOutSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotEmpty(message = "出库单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/BatchApproveRefuseRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/BatchApproveRefuseRetailOutSheetVo.java new file mode 100644 index 0000000..fdaee38 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/BatchApproveRefuseRetailOutSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotEmpty(message = "出库单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/CreateRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/CreateRetailOutSheetVo.java new file mode 100644 index 0000000..cb440cb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/CreateRetailOutSheetVo.java @@ -0,0 +1,151 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 会员ID + */ + @ApiModelProperty(value = "会员ID") + private String memberId; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @ApiModelProperty("是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + @Valid + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + RetailConfigService retailConfigService = ApplicationUtil.getBean(RetailConfigService.class); + RetailConfig config = retailConfigService.get(); + if (config.getRetailOutSheetRequireMember()) { + if (StringUtil.isBlank(this.memberId)) { + throw new DefaultClientException("请选择会员!"); + } + } + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + GetPaymentDateDto paymentDate = retailOutSheetService.getPaymentDate(this.getMemberId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + int orderNo = 1; + for (RetailOutProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getOrderNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品零售数量不能为空!"); + } + + if (product.getOrderNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品零售数量必须大于0!"); + } + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考零售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (product.getTaxPrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.mul(t.getOrderNum(), t.getTaxPrice())).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetVo.java new file mode 100644 index 0000000..21e24df --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetVo.java @@ -0,0 +1,89 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryRetailOutSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 会员ID + */ + @ApiModelProperty("会员ID") + private String memberId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = RetailOutSheetStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetWithReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetWithReturnVo.java new file mode 100644 index 0000000..2e60ba0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailOutSheetWithReturnVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryRetailOutSheetWithReturnVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 会员ID + */ + @ApiModelProperty("会员ID") + private String memberId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailProductVo.java new file mode 100644 index 0000000..a632d34 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/QueryRetailProductVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryRetailProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + + /** + * 是否退货 + */ + @ApiModelProperty("是否退货") + private Boolean isReturn = Boolean.FALSE; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutProductVo.java new file mode 100644 index 0000000..ad003a5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutProductVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class RetailOutProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @ApiModelProperty("现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @ApiModelProperty("折扣(%)") + private BigDecimal discountRate; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer orderNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutSheetSelectorVo.java new file mode 100644 index 0000000..54db747 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/RetailOutSheetSelectorVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.RetailOutSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class RetailOutSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 会员ID + */ + @ApiModelProperty("会员ID") + private String memberId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = RetailOutSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/UpdateRetailOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/UpdateRetailOutSheetVo.java new file mode 100644 index 0000000..a7cb637 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/out/UpdateRetailOutSheetVo.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.sc.vo.retail.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateRetailOutSheetVo extends CreateRetailOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotBlank(message = "出库单ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApprovePassRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApprovePassRetailReturnVo.java new file mode 100644 index 0000000..140a60a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApprovePassRetailReturnVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApproveRefuseRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApproveRefuseRetailReturnVo.java new file mode 100644 index 0000000..0128b54 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/ApproveRefuseRetailReturnVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/BatchApprovePassRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/BatchApprovePassRetailReturnVo.java new file mode 100644 index 0000000..274c6d5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/BatchApprovePassRetailReturnVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotEmpty(message = "退单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/BatchApproveRefuseRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/BatchApproveRefuseRetailReturnVo.java new file mode 100644 index 0000000..440c947 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/BatchApproveRefuseRetailReturnVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotEmpty(message = "退单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/CreateRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/CreateRetailReturnVo.java new file mode 100644 index 0000000..652929e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/CreateRetailReturnVo.java @@ -0,0 +1,200 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.dto.retail.out.RetailOutSheetDetailLotDto; +import com.lframework.xingyun.sc.entity.RetailConfig; +import com.lframework.xingyun.sc.entity.RetailOutSheetDetail; +import com.lframework.xingyun.sc.service.retail.RetailConfigService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetDetailService; +import com.lframework.xingyun.sc.service.retail.RetailOutSheetService; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateRetailReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 会员ID + */ + @ApiModelProperty("会员ID") + private String memberId; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String salerId; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @ApiModelProperty("是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 收货单ID + */ + @ApiModelProperty("收货单ID") + private String outSheetId; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @ApiModelProperty("支付方式") + @Valid + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 是否关联零售出库单 + */ + @ApiModelProperty("是否关联零售出库单") + private Boolean required; + + public void validate() { + + RetailConfigService retailConfigService = ApplicationUtil.getBean(RetailConfigService.class); + RetailConfig retailConfig = retailConfigService.get(); + + if (retailConfig.getRetailReturnRequireMember()) { + if (StringUtil.isBlank(this.memberId)) { + throw new DefaultClientException("请选择会员!"); + } + } + + if (!retailConfig.getRetailReturnRequireOutStock().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(retailConfig.getRetailReturnRequireOutStock()); + } + + protected void validate(boolean requireOut) { + + RetailOutSheetService retailOutSheetService = ApplicationUtil.getBean( + RetailOutSheetService.class); + GetPaymentDateDto paymentDate = retailOutSheetService.getPaymentDate(this.getMemberId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireOut) { + if (StringUtil.isBlank(this.getOutSheetId())) { + throw new InputErrorException("零售出库单不能为空!"); + } + } + + RetailOutSheetDetailService retailOutSheetDetailService = ApplicationUtil.getBean( + RetailOutSheetDetailService.class); + RetailOutSheetDetailLotService retailOutSheetDetailLotService = ApplicationUtil.getBean( + RetailOutSheetDetailLotService.class); + int orderNo = 1; + for (RetailReturnProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReturnNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品退货数量不能为空!"); + } + + if (product.getReturnNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品退货数量必须大于0!"); + } + + if (!requireOut) { + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考零售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (product.getTaxPrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + } else { + if (StringUtil.isNotBlank(product.getOutSheetDetailId())) { + RetailOutSheetDetailLotDto detailLot = retailOutSheetDetailLotService.findById( + product.getOutSheetDetailId()); + RetailOutSheetDetail detail = retailOutSheetDetailService.getById( + detailLot.getDetailId()); + product.setTaxPrice(detail.getTaxPrice()); + } else { + product.setTaxPrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.mul(t.getReturnNum(), t.getTaxPrice())).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/QueryRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/QueryRetailReturnVo.java new file mode 100644 index 0000000..29e966a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/QueryRetailReturnVo.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.RetailReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryRetailReturnVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 会员ID + */ + @ApiModelProperty("会员ID") + private String memberId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = RetailReturnStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 出库单号 + */ + @ApiModelProperty("出库单号") + private String outSheetCode; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/RetailReturnProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/RetailReturnProductVo.java new file mode 100644 index 0000000..9e14e14 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/RetailReturnProductVo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class RetailReturnProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @ApiModelProperty("现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @ApiModelProperty("折扣(%)") + private BigDecimal discountRate; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 出库单明细ID + */ + @ApiModelProperty("出库单明细ID") + private String outSheetDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/UpdateRetailReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/UpdateRetailReturnVo.java new file mode 100644 index 0000000..281835c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/retail/returned/UpdateRetailReturnVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.retail.returned; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.RetailReturn; +import com.lframework.xingyun.sc.service.retail.RetailReturnService; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateRetailReturnVo extends CreateRetailReturnVo { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotBlank(message = "退单ID不能为空!") + private String id; + + @Override + public void validate() { + + RetailReturnService saleReturnService = ApplicationUtil.getBean(RetailReturnService.class); + RetailReturn saleReturn = saleReturnService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(saleReturn.getOutSheetId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApprovePassSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApprovePassSaleOrderVo.java new file mode 100644 index 0000000..f7c6b63 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApprovePassSaleOrderVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotBlank(message = "订单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApproveRefuseSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApproveRefuseSaleOrderVo.java new file mode 100644 index 0000000..25fe187 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/ApproveRefuseSaleOrderVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotBlank(message = "订单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/BatchApprovePassSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/BatchApprovePassSaleOrderVo.java new file mode 100644 index 0000000..513a197 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/BatchApprovePassSaleOrderVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotEmpty(message = "订单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/BatchApproveRefuseSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/BatchApproveRefuseSaleOrderVo.java new file mode 100644 index 0000000..1bb758a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/BatchApproveRefuseSaleOrderVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotEmpty(message = "订单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java new file mode 100644 index 0000000..870bed1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/CreateSaleOrderVo.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.vo.paytype.OrderPayTypeVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateSaleOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotBlank(message = "客户ID不能为空!") + private String customerId; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 支付方式 + */ + @ApiModelProperty("约定支付") + @Valid + private List payTypes; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SaleProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getOrderNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品销售数量不能为空!"); + } + + if (product.getOrderNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品销售数量必须大于0!"); + } + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (product.getTaxPrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + + orderNo++; + } + + BigDecimal totalAmount = this.products.stream() + .map(t -> NumberUtil.mul(t.getOrderNum(), t.getTaxPrice())).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + BigDecimal payTypeAmount = CollectionUtil.isEmpty(this.payTypes) ? BigDecimal.ZERO + : this.payTypes.stream().map(OrderPayTypeVo::getPayAmount).reduce(NumberUtil::add) + .orElse(BigDecimal.ZERO); + if (!NumberUtil.equal(totalAmount, payTypeAmount)) { + throw new InputErrorException("所有支付方式的支付金额不等于含税总金额,请检查!"); + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderVo.java new file mode 100644 index 0000000..5586549 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderVo.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOrderVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOrderStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderWithOutVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderWithOutVo.java new file mode 100644 index 0000000..7e5cde9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleOrderWithOutVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOrderWithOutVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleProductVo.java new file mode 100644 index 0000000..75904b2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/QuerySaleProductVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QuerySaleProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + + /** + * 是否退货 + */ + @ApiModelProperty("是否退货") + private Boolean isReturn = Boolean.FALSE; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleOrderSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleOrderSelectorVo.java new file mode 100644 index 0000000..d18441c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleOrderSelectorVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.SaleOrderStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class SaleOrderSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOrderStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleProductVo.java new file mode 100644 index 0000000..d6a16f0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/SaleProductVo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.sc.vo.sale; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SaleProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @ApiModelProperty("现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @ApiModelProperty("折扣(%)") + private BigDecimal discountRate; + + /** + * 销售数量 + */ + @ApiModelProperty("销售数量") + private Integer orderNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/UpdateSaleOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/UpdateSaleOrderVo.java new file mode 100644 index 0000000..5dcba8f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/UpdateSaleOrderVo.java @@ -0,0 +1,19 @@ +package com.lframework.xingyun.sc.vo.sale; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateSaleOrderVo extends CreateSaleOrderVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 订单ID + */ + @ApiModelProperty(value = "订单ID", required = true) + @NotBlank(message = "订单ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/config/UpdateSaleConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/config/UpdateSaleConfigVo.java new file mode 100644 index 0000000..a5cbebf --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/config/UpdateSaleConfigVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.vo.sale.config; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSaleConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 销售出库单是否关联销售订单 + */ + @ApiModelProperty(value = "销售出库单是否关联销售订单", required = true) + @NotNull(message = "销售出库单是否关联销售订单不能为空!") + private Boolean outStockRequireSale; + + /** + * 销售出库单是否多次关联销售订单 + */ + @ApiModelProperty(value = "销售出库单是否多次关联销售订单", required = true) + @NotNull(message = "销售出库单是否多次关联销售订单不能为空!") + private Boolean outStockMultipleRelateSale; + + /** + * 销售退货单是否关联销售出库单 + */ + @ApiModelProperty(value = "销售退货单是否关联销售出库单", required = true) + @NotNull(message = "销售退货单是否关联销售出库单不能为空!") + private Boolean saleReturnRequireOutStock; + + /** + * 销售退货单是否多次关联销售出库单 + */ + @ApiModelProperty(value = "销售退货单是否多次关联销售出库单", required = true) + @NotNull(message = "销售退货单是否多次关联销售出库单不能为空!") + private Boolean saleReturnMultipleRelateOutStock; + + /** + * 销售出库单是否关联物流单 + */ + @ApiModelProperty(value = "销售出库单是否关联物流单", required = true) + @NotNull(message = "销售出库单是否关联物流单不能为空!") + private Boolean outStockRequireLogistics; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApprovePassSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApprovePassSaleOutSheetVo.java new file mode 100644 index 0000000..7d597e5 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApprovePassSaleOutSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApproveRefuseSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApproveRefuseSaleOutSheetVo.java new file mode 100644 index 0000000..067cff8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/ApproveRefuseSaleOutSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/BatchApprovePassSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/BatchApprovePassSaleOutSheetVo.java new file mode 100644 index 0000000..b9403a8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/BatchApprovePassSaleOutSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotEmpty(message = "出库单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/BatchApproveRefuseSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/BatchApproveRefuseSaleOutSheetVo.java new file mode 100644 index 0000000..055e4fd --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/BatchApproveRefuseSaleOutSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotEmpty(message = "出库单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/CreateSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/CreateSaleOutSheetVo.java new file mode 100644 index 0000000..ed49b25 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/CreateSaleOutSheetVo.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.entity.SaleOrderDetail; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOrderDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotBlank(message = "客户ID不能为空!") + private String customerId; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private LocalDate paymentDate; + + /** + * 是否允许修改付款日期 + */ + @ApiModelProperty("是否允许修改付款日期") + private Boolean allowModifyPaymentDate = Boolean.FALSE; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 销售订单ID + */ + @ApiModelProperty("销售订单ID") + private String saleOrderId; + + /** + * 是否关联销售订单 + */ + @ApiModelProperty("是否关联销售订单") + private Boolean required; + + public void validate() { + + SaleConfigService saleConfigService = ApplicationUtil.getBean(SaleConfigService.class); + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getOutStockRequireSale().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(saleConfig.getOutStockRequireSale()); + } + + protected void validate(boolean requireSale) { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + GetPaymentDateDto paymentDate = saleOutSheetService.getPaymentDate(this.getCustomerId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireSale) { + if (StringUtil.isBlank(this.getSaleOrderId())) { + throw new InputErrorException("销售订单不能为空!"); + } + } + + SaleOrderDetailService saleOrderDetailService = ApplicationUtil.getBean( + SaleOrderDetailService.class); + + int orderNo = 1; + for (SaleOutProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getOrderNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品销售数量不能为空!"); + } + + if (product.getOrderNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品销售数量必须大于0!"); + } + + if (!requireSale) { + + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (product.getTaxPrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + } else { + if (StringUtil.isNotBlank(product.getSaleOrderDetailId())) { + SaleOrderDetail orderDetail = saleOrderDetailService.getById( + product.getSaleOrderDetailId()); + product.setTaxPrice(orderDetail.getTaxPrice()); + } else { + product.setTaxPrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetVo.java new file mode 100644 index 0000000..9694d4d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetVo.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOutSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOutSheetStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 销售订单号 + */ + @ApiModelProperty("销售订单号") + private String saleOrderCode; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetWithReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetWithReturnVo.java new file mode 100644 index 0000000..350d546 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/QuerySaleOutSheetWithReturnVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleOutSheetWithReturnVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutProductVo.java new file mode 100644 index 0000000..5397041 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutProductVo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SaleOutProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @ApiModelProperty("现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @ApiModelProperty("折扣(%)") + private BigDecimal discountRate; + + /** + * 出库数量 + */ + @ApiModelProperty("出库数量") + private Integer orderNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 销售订单明细ID + */ + @ApiModelProperty("销售订单明细ID") + private String saleOrderDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutSheetSelectorVo.java new file mode 100644 index 0000000..696e71b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/SaleOutSheetSelectorVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.SaleOutSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class SaleOutSheetSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleOutSheetStatus.class) + private Integer status; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/UpdateSaleOutSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/UpdateSaleOutSheetVo.java new file mode 100644 index 0000000..0c9dad6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/out/UpdateSaleOutSheetVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.sc.vo.sale.out; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateSaleOutSheetVo extends CreateSaleOutSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 出库单ID + */ + @ApiModelProperty(value = "出库单ID", required = true) + @NotBlank(message = "出库单ID不能为空!") + private String id; + + @Override + public void validate() { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + SaleOutSheet saleOutSheet = saleOutSheetService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(saleOutSheet.getSaleOrderId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApprovePassSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApprovePassSaleReturnVo.java new file mode 100644 index 0000000..924d3ed --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApprovePassSaleReturnVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApproveRefuseSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApproveRefuseSaleReturnVo.java new file mode 100644 index 0000000..42d75ea --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/ApproveRefuseSaleReturnVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotBlank(message = "退单ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/BatchApprovePassSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/BatchApprovePassSaleReturnVo.java new file mode 100644 index 0000000..9634685 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/BatchApprovePassSaleReturnVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotEmpty(message = "退单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/BatchApproveRefuseSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/BatchApproveRefuseSaleReturnVo.java new file mode 100644 index 0000000..b429ce3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/BatchApproveRefuseSaleReturnVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotEmpty(message = "退单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/CreateSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/CreateSaleReturnVo.java new file mode 100644 index 0000000..748376d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/CreateSaleReturnVo.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.dto.purchase.receive.GetPaymentDateDto; +import com.lframework.xingyun.sc.entity.SaleConfig; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetail; +import com.lframework.xingyun.sc.entity.SaleOutSheetDetailLot; +import com.lframework.xingyun.sc.service.sale.SaleConfigService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailLotService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetDetailService; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateSaleReturnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotBlank(message = "客户ID不能为空!") + private String customerId; + + /** + * 采购员ID + */ + @ApiModelProperty("采购员ID") + private String salerId; + + /** + * 付款日期 + */ + @ApiModelProperty("付款日期") + private LocalDate paymentDate; + + /** + * 收货单ID + */ + @ApiModelProperty("收货单ID") + private String outSheetId; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品不能为空!") + private List products; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 是否关联销售出库单 + */ + @ApiModelProperty("是否关联销售出库单") + private Boolean required; + + public void validate() { + + SaleConfigService saleConfigService = ApplicationUtil.getBean(SaleConfigService.class); + SaleConfig saleConfig = saleConfigService.get(); + + if (!saleConfig.getSaleReturnRequireOutStock().equals(this.required)) { + throw new DefaultClientException("系统参数发生改变,请刷新页面后重试!"); + } + + this.validate(saleConfig.getSaleReturnRequireOutStock()); + } + + protected void validate(boolean requireOut) { + + SaleOutSheetService saleOutSheetService = ApplicationUtil.getBean(SaleOutSheetService.class); + GetPaymentDateDto paymentDate = saleOutSheetService.getPaymentDate(this.getCustomerId()); + if (paymentDate.getAllowModify()) { + if (this.getPaymentDate() == null) { + throw new InputErrorException("付款日期不能为空!"); + } + } + + if (requireOut) { + if (StringUtil.isBlank(this.getOutSheetId())) { + throw new InputErrorException("销售出库单不能为空!"); + } + } + + SaleOutSheetDetailService saleOutSheetDetailService = ApplicationUtil.getBean( + SaleOutSheetDetailService.class); + SaleOutSheetDetailLotService saleOutSheetDetailLotService = ApplicationUtil.getBean( + SaleOutSheetDetailLotService.class); + + int orderNo = 1; + for (SaleReturnProductVo product : this.products) { + + if (StringUtil.isBlank(product.getProductId())) { + throw new InputErrorException("第" + orderNo + "行商品不能为空!"); + } + + if (product.getReturnNum() == null) { + throw new InputErrorException("第" + orderNo + "行商品退货数量不能为空!"); + } + + if (product.getReturnNum() <= 0) { + throw new InputErrorException("第" + orderNo + "行商品退货数量必须大于0!"); + } + + if (!requireOut) { + if (product.getOriPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品参考销售价不能为空!"); + } + + if (product.getTaxPrice() == null) { + throw new InputErrorException("第" + orderNo + "行商品价格不能为空!"); + } + + if (product.getTaxPrice().doubleValue() < 0D) { + throw new InputErrorException("第" + orderNo + "行商品价格不允许小于0!"); + } + + if (!NumberUtil.equal(product.getOriPrice(), 0D)) { + // 由 根据原价和折扣率校验现价 更改为 根据原价、现价计算折扣率,即:不以传入的折扣率为准 + BigDecimal discountRate = NumberUtil.getNumber( + NumberUtil.mul(NumberUtil.div(product.getTaxPrice(), product.getOriPrice()), 100), 2); + product.setDiscountRate(discountRate); + } else { + //如果原价为0,折扣率固定为100 + product.setDiscountRate(BigDecimal.valueOf(100)); + } + } else { + if (StringUtil.isNotBlank(product.getOutSheetDetailId())) { + SaleOutSheetDetailLot detailLot = saleOutSheetDetailLotService.getById( + product.getOutSheetDetailId()); + SaleOutSheetDetail outSheetDetail = saleOutSheetDetailService.getById( + detailLot.getDetailId()); + product.setTaxPrice(outSheetDetail.getTaxPrice()); + } else { + product.setTaxPrice(BigDecimal.ZERO); + } + } + + orderNo++; + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/QuerySaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/QuerySaleReturnVo.java new file mode 100644 index 0000000..028620a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/QuerySaleReturnVo.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SaleReturnStatus; +import com.lframework.xingyun.sc.enums.SettleStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySaleReturnVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 操作人ID + */ + @ApiModelProperty("操作人ID") + private String createBy; + + /** + * 操作起始时间 + */ + @ApiModelProperty("操作起始时间") + private LocalDateTime createStartTime; + + /** + * 操作截止时间 + */ + @ApiModelProperty("操作截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人ID + */ + @ApiModelProperty("审核人ID") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式不正确!", enumClass = SaleReturnStatus.class) + private Integer status; + + /** + * 销售员ID + */ + @ApiModelProperty("销售员ID") + private String salerId; + + /** + * 出库单号 + */ + @ApiModelProperty("出库单号") + private String outSheetCode; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/SaleReturnProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/SaleReturnProductVo.java new file mode 100644 index 0000000..be035a2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/SaleReturnProductVo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SaleReturnProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty("商品ID") + private String productId; + + /** + * 原价 + */ + @ApiModelProperty("原价") + private BigDecimal oriPrice; + + /** + * 现价 + */ + @ApiModelProperty("现价") + private BigDecimal taxPrice; + + /** + * 折扣(%) + */ + @ApiModelProperty("折扣(%)") + private BigDecimal discountRate; + + /** + * 退货数量 + */ + @ApiModelProperty("退货数量") + private Integer returnNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 出库单明细ID + */ + @ApiModelProperty("出库单明细ID") + private String outSheetDetailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/UpdateSaleReturnVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/UpdateSaleReturnVo.java new file mode 100644 index 0000000..c785289 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/sale/returned/UpdateSaleReturnVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.sale.returned; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateSaleReturnVo extends CreateSaleReturnVo { + + private static final long serialVersionUID = 1L; + + /** + * 退单ID + */ + @ApiModelProperty(value = "退单ID", required = true) + @NotBlank(message = "退单ID不能为空!") + private String id; + + @Override + public void validate() { + + SaleReturnService saleReturnService = ApplicationUtil.getBean(SaleReturnService.class); + SaleReturn saleReturn = saleReturnService.getById(this.getId()); + + this.validate(!StringUtil.isBlank(saleReturn.getOutSheetId())); + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/AddProductStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/AddProductStockVo.java new file mode 100644 index 0000000..f393b85 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/AddProductStockVo.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.sc.vo.stock; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class AddProductStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 入库数量 + */ + @ApiModelProperty(value = "入库数量", required = true) + @NotNull(message = "入库数量不能为空!") + @Min(message = "入库数量必须大于0!", value = 1) + private Integer stockNum; + + /** + * 含税成本总金额,如果为null则代表不计算均价入库 + */ + @ApiModelProperty("含税成本价,如果为null则代表不计算均价入库") + @Min(message = "含税成本价不能小于0!", value = 0) + private BigDecimal taxPrice; + + /** + * 默认的含税成本价,如果不为null则代表:入库时商品没有库存(没有均价),按照此成本价入库 如果与taxPrice同时为null,那么当入库时没有库存就会报错 + */ + @ApiModelProperty("默认的含税成本价,如果不为null则代表:入库时商品没有库存(没有均价),按照此成本价入库 如果与taxPrice同时为null,那么当入库时没有库存就会报错") + @Min(message = "默认的含税成本价不能小于0!", value = 0) + private BigDecimal defaultTaxPrice; + + /** + * 入库时间 + */ + @ApiModelProperty("入库时间") + private LocalDateTime createTime = LocalDateTime.now(); + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @ApiModelProperty("业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/QueryProductStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/QueryProductStockVo.java new file mode 100644 index 0000000..eb198b9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/QueryProductStockVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.sc.vo.stock; + +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryProductStockVo extends SortPageVo { + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 商品类目ID + */ + @ApiModelProperty("商品类目ID") + private String categoryId; + + /** + * 商品品牌ID + */ + @ApiModelProperty("商品品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/StockCostAdjustVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/StockCostAdjustVo.java new file mode 100644 index 0000000..e168bd1 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/StockCostAdjustVo.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.sc.vo.stock; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class StockCostAdjustVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 含税成本价 + */ + @ApiModelProperty(value = "含税成本价", required = true) + @NotNull(message = "含税成本价不能为空!") + @Min(message = "含税成本价不能小于0!", value = 0) + private BigDecimal taxPrice; + + /** + * 税率(%) + */ + @ApiModelProperty(value = "税率(%)", required = true) + @NotNull(message = "税率(%)不能为空!") + @Min(message = "税率(%)不能小于0!", value = 0) + private BigDecimal taxRate; + + /** + * 出库时间 + */ + @ApiModelProperty("出库时间") + private LocalDateTime createTime = LocalDateTime.now(); + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @ApiModelProperty("业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/SubProductStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/SubProductStockVo.java new file mode 100644 index 0000000..1adb1b7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/SubProductStockVo.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.sc.vo.stock; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class SubProductStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 出库数量 + */ + @ApiModelProperty(value = "出库数量", required = true) + @NotNull(message = "出库数量不能为空!") + @Min(message = "出库数量必须大于0!", value = 1) + private Integer stockNum; + + /** + * 含税成本总金额 + */ + @ApiModelProperty("含税成本总金额") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 出库时间 + */ + @ApiModelProperty("出库时间") + private LocalDateTime createTime = LocalDateTime.now(); + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @ApiModelProperty("业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/ApprovePassStockCostAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/ApprovePassStockCostAdjustSheetVo.java new file mode 100644 index 0000000..9db16fb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/ApprovePassStockCostAdjustSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassStockCostAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/ApproveRefuseStockCostAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/ApproveRefuseStockCostAdjustSheetVo.java new file mode 100644 index 0000000..72f3c11 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/ApproveRefuseStockCostAdjustSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseStockCostAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty("拒绝理由") + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/BatchApprovePassStockCostAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/BatchApprovePassStockCostAdjustSheetVo.java new file mode 100644 index 0000000..a8f0dbe --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/BatchApprovePassStockCostAdjustSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassStockCostAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 库存成本调整单ID + */ + @ApiModelProperty(value = "库存成本调整单ID", required = true) + @NotEmpty(message = "库存成本调整单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/BatchApproveRefuseStockCostAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/BatchApproveRefuseStockCostAdjustSheetVo.java new file mode 100644 index 0000000..80acfd7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/BatchApproveRefuseStockCostAdjustSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseStockCostAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 库存成本调整单ID + */ + @ApiModelProperty(value = "库存成本调整单ID", required = true) + @NotEmpty(message = "库存成本调整单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/CreateStockCostAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/CreateStockCostAdjustSheetVo.java new file mode 100644 index 0000000..daf1a07 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/CreateStockCostAdjustSheetVo.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateStockCostAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "请输入仓库ID!") + private String scId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + int orderNo = 1; + for (StockCostAdjustProductVo product : this.products) { + if (NumberUtil.lt(product.getPrice(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行商品的调整后成本价不允许小于0!"); + } + + if (!NumberUtil.isNumberPrecision(product.getPrice(), 2)) { + throw new DefaultClientException("第" + orderNo + "行商品的调整后成本价最多允许2位小数!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/QueryStockCostAdjustProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/QueryStockCostAdjustProductVo.java new file mode 100644 index 0000000..b383d4b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/QueryStockCostAdjustProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryStockCostAdjustProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/QueryStockCostAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/QueryStockCostAdjustSheetVo.java new file mode 100644 index 0000000..467570b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/QueryStockCostAdjustSheetVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryStockCostAdjustSheetVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @TypeMismatch(message = "状态格式有误!") + @IsEnum(message = "状态格式有误!", enumClass = StockCostAdjustSheetStatus.class) + private Integer status; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 起始时间 + */ + @ApiModelProperty("审核时间 起始时间") + @TypeMismatch(message = "审核时间起始时间格式有误!") + private LocalDateTime approveTimeStart; + + /** + * 审核时间 截止时间 + */ + @ApiModelProperty("审核时间 截止时间") + @TypeMismatch(message = "审核时间截止时间格式有误!") + private LocalDateTime approveTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/StockCostAdjustProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/StockCostAdjustProductVo.java new file mode 100644 index 0000000..39afef2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/StockCostAdjustProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class StockCostAdjustProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 调整后成本价 + */ + @ApiModelProperty(value = "调整后成本价", required = true) + @NotNull(message = "调整后成本价不能为空!") + @TypeMismatch(message = "调整后成本价格式有误!") + private BigDecimal price; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/UpdateStockCostAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/UpdateStockCostAdjustSheetVo.java new file mode 100644 index 0000000..c7d5ee9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/cost/UpdateStockCostAdjustSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.cost; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateStockCostAdjustSheetVo extends CreateStockCostAdjustSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApprovePassStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApprovePassStockAdjustSheetVo.java new file mode 100644 index 0000000..46751e3 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApprovePassStockAdjustSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApproveRefuseStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApproveRefuseStockAdjustSheetVo.java new file mode 100644 index 0000000..00977ef --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/ApproveRefuseStockAdjustSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty("拒绝理由") + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/BatchApprovePassStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/BatchApprovePassStockAdjustSheetVo.java new file mode 100644 index 0000000..b19fcd0 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/BatchApprovePassStockAdjustSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 库存调整单ID + */ + @ApiModelProperty(value = "库存调整单ID", required = true) + @NotEmpty(message = "库存调整单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/BatchApproveRefuseStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/BatchApproveRefuseStockAdjustSheetVo.java new file mode 100644 index 0000000..3d2264a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/BatchApproveRefuseStockAdjustSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 库存调整单ID + */ + @ApiModelProperty(value = "库存调整单ID", required = true) + @NotEmpty(message = "库存调整单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/CreateStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/CreateStockAdjustSheetVo.java new file mode 100644 index 0000000..c168fad --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/CreateStockAdjustSheetVo.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.StockAdjustSheetBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateStockAdjustSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "请输入仓库ID!") + private String scId; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型格式错误!", enumClass = StockAdjustSheetBizType.class) + private Integer bizType; + + /** + * 调整原因ID + */ + @ApiModelProperty(value = "调整原因ID", required = true) + @NotBlank(message = "调整原因ID不能为空!") + private String reasonId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + int orderNo = 1; + for (StockAdjustProductVo product : this.products) { + if (NumberUtil.le(product.getStockNum(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行商品的调整库存数量必须大于0!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustProductVo.java new file mode 100644 index 0000000..fa15f4f --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryStockAdjustProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustSheetVo.java new file mode 100644 index 0000000..7213209 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/QueryStockAdjustSheetVo.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryStockAdjustSheetVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + private Integer bizType; + + /** + * 调整原因ID + */ + @ApiModelProperty("调整原因ID") + private String reasonId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @TypeMismatch(message = "状态格式有误!") + @IsEnum(message = "状态格式有误!", enumClass = StockCostAdjustSheetStatus.class) + private Integer status; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 起始时间 + */ + @ApiModelProperty("审核时间 起始时间") + @TypeMismatch(message = "审核时间起始时间格式有误!") + private LocalDateTime approveTimeStart; + + /** + * 审核时间 截止时间 + */ + @ApiModelProperty("审核时间 截止时间") + @TypeMismatch(message = "审核时间截止时间格式有误!") + private LocalDateTime approveTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/StockAdjustProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/StockAdjustProductVo.java new file mode 100644 index 0000000..bdf3b57 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/StockAdjustProductVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class StockAdjustProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 调整库存数量 + */ + @ApiModelProperty(value = "调整库存数量", required = true) + @NotNull(message = "调整库存数量不能为空!") + @TypeMismatch(message = "调整库存数量格式有误!") + private Integer stockNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/UpdateStockAdjustSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/UpdateStockAdjustSheetVo.java new file mode 100644 index 0000000..284e34a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/UpdateStockAdjustSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateStockAdjustSheetVo extends CreateStockAdjustSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/CreateStockAdjustReasonVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/CreateStockAdjustReasonVo.java new file mode 100644 index 0000000..5e9c446 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/CreateStockAdjustReasonVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateStockAdjustReasonVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/QueryStockAdjustReasonVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/QueryStockAdjustReasonVo.java new file mode 100644 index 0000000..bef6167 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/QueryStockAdjustReasonVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryStockAdjustReasonVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/StockAdjustReasonSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/StockAdjustReasonSelectorVo.java new file mode 100644 index 0000000..c1b15e8 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/StockAdjustReasonSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class StockAdjustReasonSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/UpdateStockAdjustReasonVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/UpdateStockAdjustReasonVo.java new file mode 100644 index 0000000..0243aeb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/adjust/stock/reason/UpdateStockAdjustReasonVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.sc.vo.stock.adjust.stock.reason; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateStockAdjustReasonVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithAddStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithAddStockVo.java new file mode 100644 index 0000000..db554e2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithAddStockVo.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.sc.vo.stock.log; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class AddLogWithAddStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 入库数量 + */ + @ApiModelProperty(value = "入库数量", required = true) + @NotNull(message = "入库数量不能为空!") + @Min(message = "入库数量必须大于0!", value = 1) + private Integer stockNum; + + /** + * 含税成本总金额 + */ + @ApiModelProperty(value = "含税成本总金额", required = true) + @NotNull(message = "含税成本总金额不能为空!") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 原库存数量 + */ + @ApiModelProperty(value = "原库存数量", required = true) + @NotNull(message = "原库存数量不能为空!") + private Integer oriStockNum; + + /** + * 现库存数量 + */ + @ApiModelProperty(value = "现库存数量", required = true) + @NotNull(message = "现库存数量不能为空!") + private Integer curStockNum; + + /** + * 原含税成本价 + */ + @ApiModelProperty(value = "原含税成本价", required = true) + @NotNull(message = "原含税成本价不能为空!") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @ApiModelProperty(value = "现含税成本价", required = true) + @NotNull(message = "现含税成本价不能为空!") + private BigDecimal curTaxPrice; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createById; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 入库时间 + */ + @ApiModelProperty(value = "入库时间", required = true) + @NotNull(message = "入库时间不能为空!") + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @ApiModelProperty("业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithStockCostAdjustVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithStockCostAdjustVo.java new file mode 100644 index 0000000..746abe9 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithStockCostAdjustVo.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.sc.vo.stock.log; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class AddLogWithStockCostAdjustVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 含税成本总金额 + */ + @ApiModelProperty(value = "含税成本总金额", required = true) + @NotNull(message = "含税成本总金额不能为空!") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 原库存数量 + */ + @ApiModelProperty(value = "原库存数量", required = true) + @NotNull(message = "原库存数量不能为空!") + private Integer oriStockNum; + + /** + * 原含税成本价 + */ + @ApiModelProperty(value = "原含税成本价", required = true) + @NotNull(message = "原含税成本价不能为空!") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @ApiModelProperty(value = "现含税成本价", required = true) + @NotNull(message = "现含税成本价不能为空!") + private BigDecimal curTaxPrice; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createById; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 出库时间 + */ + @ApiModelProperty(value = "出库时间", required = true) + @NotNull(message = "出库时间不能为空!") + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @ApiModelProperty("业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithSubStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithSubStockVo.java new file mode 100644 index 0000000..2c03900 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/AddLogWithSubStockVo.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.sc.vo.stock.log; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class AddLogWithSubStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 出库数量 + */ + @ApiModelProperty(value = "出库数量", required = true) + @NotNull(message = "出库数量不能为空!") + @Min(message = "出库数量必须大于0!", value = 1) + private Integer stockNum; + + /** + * 含税成本总金额 + */ + @ApiModelProperty(value = "含税成本总金额", required = true) + @NotNull(message = "含税成本总金额不能为空!") + @Min(message = "含税成本总金额不能小于0!", value = 0) + private BigDecimal taxAmount; + + /** + * 原库存数量 + */ + @ApiModelProperty(value = "原库存数量", required = true) + @NotNull(message = "原库存数量不能为空!") + private Integer oriStockNum; + + /** + * 现库存数量 + */ + @ApiModelProperty(value = "现库存数量", required = true) + @NotNull(message = "现库存数量不能为空!") + private Integer curStockNum; + + /** + * 原含税成本价 + */ + @ApiModelProperty(value = "原含税成本价", required = true) + @NotNull(message = "原含税成本价不能为空!") + private BigDecimal oriTaxPrice; + + /** + * 现含税成本价 + */ + @ApiModelProperty(value = "现含税成本价", required = true) + @NotNull(message = "现含税成本价不能为空!") + private BigDecimal curTaxPrice; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createById; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 出库时间 + */ + @ApiModelProperty(value = "出库时间", required = true) + @NotNull(message = "出库时间不能为空!") + private LocalDateTime createTime; + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @ApiModelProperty("业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/QueryProductStockLogVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/QueryProductStockLogVo.java new file mode 100644 index 0000000..cbe25fc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/log/QueryProductStockLogVo.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.sc.vo.stock.log; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryProductStockLogVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 商品类目ID + */ + @ApiModelProperty("商品类目ID") + private String categoryId; + + /** + * 商品品牌ID + */ + @ApiModelProperty("商品品牌ID") + private String brandId; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + @IsEnum(message = "业务类型不存在!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/AddProductLotStockVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/AddProductLotStockVo.java new file mode 100644 index 0000000..8363e4a --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/AddProductLotStockVo.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.sc.vo.stock.lot; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class AddProductLotStockVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 入库数量 + */ + @ApiModelProperty(value = "入库数量", required = true) + @NotNull(message = "入库数量不能为空!") + @Min(message = "入库数量必须大于0!", value = 1) + private Integer stockNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/CreateProductLotVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/CreateProductLotVo.java new file mode 100644 index 0000000..e0f029e --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/CreateProductLotVo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.sc.vo.stock.lot; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.ProductStockBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateProductLotVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotBlank(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 税率(%) + */ + @ApiModelProperty(value = "税率(%)", required = true) + @NotNull(message = "税率(%)不能为空!") + @Min(message = "税率(%)不能小于0!", value = 0) + private BigDecimal taxRate; + + /** + * 入库时间 + */ + @ApiModelProperty("入库时间") + private LocalDateTime createTime = LocalDateTime.now(); + + /** + * 业务单据ID + */ + @ApiModelProperty("业务单据ID") + private String bizId; + + /** + * 业务单据明细ID + */ + @ApiModelProperty("业务单据明细ID") + private String bizDetailId; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型不正确!", enumClass = ProductStockBizType.class) + private Integer bizType; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/QueryProductLotVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/QueryProductLotVo.java new file mode 100644 index 0000000..60c25a2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/lot/QueryProductLotVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.vo.stock.lot; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryProductLotVo extends PageVo { + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 商品编号 + */ + @ApiModelProperty("商品编号") + private String productCode; + + /** + * 商品名称 + */ + @ApiModelProperty("商品名称") + private String productName; + + /** + * 商品类目ID + */ + @ApiModelProperty("商品类目ID") + private String categoryId; + + /** + * 商品品牌ID + */ + @ApiModelProperty("商品品牌ID") + private String brandId; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 生成起始时间 + */ + @ApiModelProperty("生成起始时间") + private LocalDateTime createStartTime; + + /** + * 生成截止时间 + */ + @ApiModelProperty("生成截止时间") + private LocalDateTime createEndTime; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/config/UpdateTakeStockConfigVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/config/UpdateTakeStockConfigVo.java new file mode 100644 index 0000000..b70ae22 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/config/UpdateTakeStockConfigVo.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.sc.vo.stock.take.config; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateTakeStockConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据 + */ + @ApiModelProperty(value = "库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据", required = true) + @TypeMismatch(message = "库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据格式有误!") + @NotNull(message = "请选择库存盘点单关联盘点任务后,是否显示盘点任务中的商品数据!") + private Boolean showProduct; + + /** + * 库存盘点单是否显示盘点任务创建时商品的系统库存数量 + */ + @ApiModelProperty(value = "库存盘点单是否显示盘点任务创建时商品的系统库存数量", required = true) + @TypeMismatch(message = "库存盘点单是否显示盘点任务创建时商品的系统库存数量格式有误!") + @NotNull(message = "请选择库存盘点单是否显示盘点任务创建时商品的系统库存数量!") + private Boolean showStock; + + /** + * 盘点差异生成时是否自动调整盘点任务中商品的系统库存数量 + */ + @ApiModelProperty(value = "盘点差异生成时是否自动调整盘点任务中商品的系统库存数量", required = true) + @TypeMismatch(message = "盘点差异生成时是否自动调整盘点任务中商品的系统库存数量格式有误!") + @NotNull(message = "请选择盘点差异生成时是否自动调整盘点任务中商品的系统库存数量!") + private Boolean autoChangeStock; + + /** + * 盘点差异单中的盘点数量是否允许手动修改 + */ + @ApiModelProperty(value = "盘点差异单中的盘点数量是否允许手动修改", required = true) + @TypeMismatch(message = "盘点差异单中的盘点数量是否允许手动修改格式有误!") + @NotNull(message = "请选择盘点差异单中的盘点数量是否允许手动修改!") + private Boolean allowChangeNum; + + /** + * 盘点任务创建后多少小时内未完成,则自动作废 + */ + @ApiModelProperty(value = "盘点任务创建后多少小时内未完成,则自动作废", required = true) + @TypeMismatch(message = "盘点任务自动作废时间格式有误!") + @NotNull(message = "请输入盘点任务自动作废时间!") + @Min(value = 1, message = "盘点任务自动作废时间必须大于0!") + private Integer cancelHours; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CancelTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CancelTakeStockPlanVo.java new file mode 100644 index 0000000..68efcf7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CancelTakeStockPlanVo.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CancelTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CreateTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CreateTakeStockPlanVo.java new file mode 100644 index 0000000..680c507 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/CreateTakeStockPlanVo.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "请输入仓库ID!") + private String scId; + + + /** + * 盘点类别 + */ + @ApiModelProperty(value = "盘点类别", required = true) + @NotNull(message = "请选择盘点类别!") + @TypeMismatch(message = "盘点类别格式有误!") + @IsEnum(message = "盘点类别格式有误!", enumClass = TakeStockPlanType.class) + private Integer takeType; + + /** + * 业务ID + */ + @ApiModelProperty("业务ID") + private List bizIds; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + TakeStockPlanType takeType = EnumUtil.getByCode(TakeStockPlanType.class, this.takeType); + if (takeType == TakeStockPlanType.CATEGORY) { + if (CollectionUtil.isEmpty(this.bizIds)) { + throw new InputErrorException("请选择商品类目!"); + } + } else if (takeType == TakeStockPlanType.BRAND) { + if (CollectionUtil.isEmpty(this.bizIds)) { + throw new InputErrorException("请选择商品品牌!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/HandleTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/HandleTakeStockPlanVo.java new file mode 100644 index 0000000..f42b65b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/HandleTakeStockPlanVo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class HandleTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "商品信息不能为空!") + private List products; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 是否允许修改数量 + */ + @ApiModelProperty("是否允许修改数量") + private Boolean allowChangeNum; + + /** + * 是否自动计算数量 + */ + @ApiModelProperty("是否自动计算数量") + private Boolean autoChangeStock; + + @Data + public static class ProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 修改后盘点数量 + */ + @ApiModelProperty(value = "修改后盘点数量") + private Integer takeNum; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String description; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/QueryTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/QueryTakeStockPlanVo.java new file mode 100644 index 0000000..f96d0cb --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/QueryTakeStockPlanVo.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryTakeStockPlanVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + @TypeMismatch(message = "盘点状态格式有误!") + @IsEnum(message = "盘点状态格式有误!", enumClass = TakeStockPlanStatus.class) + private Integer takeStatus; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 起始时间 + */ + @ApiModelProperty("创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @ApiModelProperty("创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/TakeStockPlanSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/TakeStockPlanSelectorVo.java new file mode 100644 index 0000000..116d191 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/TakeStockPlanSelectorVo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockPlanType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class TakeStockPlanSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 是否正在进行盘点 + */ + @ApiModelProperty("是否正在进行盘点") + @TypeMismatch(message = "是否正在进行盘点格式有误!") + private Boolean taking; + + /** + * 盘点类别 + */ + @ApiModelProperty("盘点类别") + @TypeMismatch(message = "盘点类别格式有误!") + @IsEnum(message = "盘点类别格式有误!", enumClass = TakeStockPlanType.class) + private Integer takeType; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + @TypeMismatch(message = "盘点状态格式有误!") + @IsEnum(message = "盘点状态格式有误!", enumClass = TakeStockPlanStatus.class) + private Integer takeStatus; + + /** + * 创建时间 起始时间 + */ + @ApiModelProperty("创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @ApiModelProperty("创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/UpdateTakeStockPlanVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/UpdateTakeStockPlanVo.java new file mode 100644 index 0000000..1648f15 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/plan/UpdateTakeStockPlanVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.vo.stock.take.plan; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateTakeStockPlanVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "请输入仓库ID!") + private String scId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + @NotBlank(message = "请输入备注!") + private String description; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/CreatePreTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/CreatePreTakeStockSheetVo.java new file mode 100644 index 0000000..d62dab2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/CreatePreTakeStockSheetVo.java @@ -0,0 +1,85 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreatePreTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "请选择仓库!") + private String scId; + + /** + * 预先盘点状态 + */ + @ApiModelProperty(value = "预先盘点状态", required = true) + @NotNull(message = "请选择预先盘点状态!") + @IsEnum(message = "预先盘点状态格式错误!", enumClass = PreTakeStockSheetStatus.class) + @TypeMismatch(message = "预先盘点状态格式错误!") + private Integer takeStatus; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 商品 + */ + @ApiModelProperty(value = "商品", required = true) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + Set checkSet = new HashSet<>(); + PreTakeStockSheetStatus takeStatus = EnumUtil.getByCode(PreTakeStockSheetStatus.class, + this.getTakeStatus()); + for (int i = 0; i < this.getProducts().size(); i++) { + PreTakeStockProductVo product = this.getProducts().get(i); + if (checkSet.contains(product.getProductId())) { + throw new InputErrorException("第" + (i + 1) + "行商品已存在列表中,请勿重复添加!"); + } + + checkSet.add(product.getProductId()); + + if (takeStatus == PreTakeStockSheetStatus.FIRST_TAKE) { + if (product.getFirstNum() == null) { + throw new InputErrorException("第" + (i + 1) + "行商品的初盘数量不允许为空!"); + } + } else if (takeStatus == PreTakeStockSheetStatus.SECOND_TAKE) { + if (product.getSecondNum() == null) { + throw new InputErrorException("第" + (i + 1) + "行商品的复盘数量不允许为空!"); + } + } else if (takeStatus == PreTakeStockSheetStatus.RAND_TAKE) { + if (product.getRandNum() == null) { + throw new InputErrorException("第" + (i + 1) + "行商品的抽盘数量不允许为空!"); + } + } else { + throw new InputErrorException("预先盘点状态格式错误!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockProductVo.java new file mode 100644 index 0000000..dbfe575 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockProductVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class PreTakeStockProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 初盘数量 + */ + @ApiModelProperty("初盘数量") + private Integer firstNum; + + /** + * 复盘数量 + */ + @ApiModelProperty("复盘数量") + private Integer secondNum; + + /** + * 抽盘数量 + */ + @ApiModelProperty("抽盘数量") + private Integer randNum; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockSheetSelectorVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockSheetSelectorVo.java new file mode 100644 index 0000000..e3dca38 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/PreTakeStockSheetSelectorVo.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class PreTakeStockSheetSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + @TypeMismatch(message = "预先盘点状态格式有误!") + @IsEnum(message = "预先盘点状态格式有误!", enumClass = PreTakeStockSheetStatus.class) + private Integer takeStatus; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockProductVo.java new file mode 100644 index 0000000..f6ef478 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockProductVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryPreTakeStockProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockSheetVo.java new file mode 100644 index 0000000..8acfeab --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/QueryPreTakeStockSheetVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.PreTakeStockSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryPreTakeStockSheetVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + @TypeMismatch(message = "预先盘点状态格式有误!") + @IsEnum(message = "预先盘点状态格式有误!", enumClass = PreTakeStockSheetStatus.class) + private Integer takeStatus; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/UpdatePreTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/UpdatePreTakeStockSheetVo.java new file mode 100644 index 0000000..301c48c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/pre/UpdatePreTakeStockSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.sc.vo.stock.take.pre; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdatePreTakeStockSheetVo extends CreatePreTakeStockSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApprovePassTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApprovePassTakeStockSheetVo.java new file mode 100644 index 0000000..f9a4c69 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApprovePassTakeStockSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApproveRefuseTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApproveRefuseTakeStockSheetVo.java new file mode 100644 index 0000000..bf2c35d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/ApproveRefuseTakeStockSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/BatchApprovePassTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/BatchApprovePassTakeStockSheetVo.java new file mode 100644 index 0000000..5b19aa2 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/BatchApprovePassTakeStockSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotEmpty(message = "ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/BatchApproveRefuseTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/BatchApproveRefuseTakeStockSheetVo.java new file mode 100644 index 0000000..70779af --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/BatchApproveRefuseTakeStockSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotEmpty(message = "ID不能为空!") + private List ids; + + /** + * 拒绝原因 + */ + @ApiModelProperty(value = "拒绝原因", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/CreateTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/CreateTakeStockSheetVo.java new file mode 100644 index 0000000..e97f415 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/CreateTakeStockSheetVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 盘点任务ID + */ + @ApiModelProperty(value = "盘点任务ID", required = true) + @NotBlank(message = "请选择关联盘点任务!") + private String planId; + + /** + * 预先盘点单ID + */ + @ApiModelProperty("预先盘点单ID") + private String preSheetId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetProductVo.java new file mode 100644 index 0000000..096124d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryTakeStockSheetProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; + + /** + * 盘点任务ID + */ + @ApiModelProperty(value = "盘点任务ID", required = true) + @NotBlank(message = "盘点任务ID不能为空!") + private String planId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetVo.java new file mode 100644 index 0000000..4163bf6 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/QueryTakeStockSheetVo.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.TakeStockPlanStatus; +import com.lframework.xingyun.sc.enums.TakeStockSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryTakeStockSheetVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 盘点任务ID + */ + @ApiModelProperty("盘点任务ID") + private String planId; + + /** + * 预先盘点单ID + */ + @ApiModelProperty("预先盘点单ID") + private String preSheetId; + + /** + * 仓库ID + */ + @ApiModelProperty("仓库ID") + private String scId; + + /** + * 盘点状态 + */ + @ApiModelProperty("盘点状态") + @TypeMismatch(message = "盘点状态格式有误!") + @IsEnum(message = "盘点状态格式有误!", enumClass = TakeStockPlanStatus.class) + private Integer takeStatus; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @TypeMismatch(message = "状态格式有误!") + @IsEnum(message = "状态格式有误!", enumClass = TakeStockSheetStatus.class) + private Integer status; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 起始时间 + */ + @ApiModelProperty("审核时间 起始时间") + @TypeMismatch(message = "审核时间起始时间格式有误!") + private LocalDateTime approveTimeStart; + + /** + * 审核时间 截止时间 + */ + @ApiModelProperty("审核时间 截止时间") + @TypeMismatch(message = "审核时间截止时间格式有误!") + private LocalDateTime approveTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/TakeStockSheetProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/TakeStockSheetProductVo.java new file mode 100644 index 0000000..00b5e94 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/TakeStockSheetProductVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class TakeStockSheetProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 盘点数量 + */ + @ApiModelProperty(value = "盘点数量", required = true) + @NotNull(message = "盘点数量不能为空!") + @TypeMismatch(message = "盘点数量格式有误!") + private Integer takeNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/UpdateTakeStockSheetVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/UpdateTakeStockSheetVo.java new file mode 100644 index 0000000..9efd3bc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/take/sheet/UpdateTakeStockSheetVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.take.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class UpdateTakeStockSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApprovePassScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApprovePassScTransferOrderVo.java new file mode 100644 index 0000000..906b04c --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApprovePassScTransferOrderVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApprovePassScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApproveRefuseScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApproveRefuseScTransferOrderVo.java new file mode 100644 index 0000000..3afacc7 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ApproveRefuseScTransferOrderVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty("拒绝理由") + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/BatchApprovePassScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/BatchApprovePassScTransferOrderVo.java new file mode 100644 index 0000000..dd3bbbc --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/BatchApprovePassScTransferOrderVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApprovePassScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库调拨单ID + */ + @ApiModelProperty(value = "仓库调拨单ID", required = true) + @NotEmpty(message = "仓库调拨单ID不能为空!") + private List ids; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/BatchApproveRefuseScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/BatchApproveRefuseScTransferOrderVo.java new file mode 100644 index 0000000..0ef7367 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/BatchApproveRefuseScTransferOrderVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class BatchApproveRefuseScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 仓库调拨单ID + */ + @ApiModelProperty(value = "仓库调拨单ID", required = true) + @NotEmpty(message = "仓库调拨ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/CreateScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/CreateScTransferOrderVo.java new file mode 100644 index 0000000..3222000 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/CreateScTransferOrderVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 转出仓库ID + */ + @ApiModelProperty(value = "转出仓库ID", required = true) + @NotBlank(message = "转出仓库ID不能为空!") + private String sourceScId; + + /** + * 转入仓库ID + */ + @ApiModelProperty(value = "转入仓库ID", required = true) + @NotBlank(message = "转入仓库ID不能为空!") + private String targetScId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "商品信息", required = true) + @Valid + @NotEmpty(message = "请录入商品!") + private List products; + + public void validate() { + + int orderNo = 1; + for (ScTransferProductVo product : this.products) { + if (NumberUtil.le(product.getTransferNum(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行商品的调拨数量必须大于0!"); + } + } + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderDetailReceiveVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderDetailReceiveVo.java new file mode 100644 index 0000000..17f3a55 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderDetailReceiveVo.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryScTransferOrderDetailReceiveVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "调拨单ID", required = true) + @NotBlank(message = "调拨单ID不能为空!") + private String orderId; + + @ApiModelProperty(value = "明细ID", required = true) + @NotBlank(message = "明细ID不能为空!") + private String detailId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderVo.java new file mode 100644 index 0000000..9bcba9b --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferOrderVo.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.ScTransferOrderStatus; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryScTransferOrderVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 转出仓库ID + */ + @ApiModelProperty("转出仓库ID") + private String sourceScId; + + /** + * 转入仓库ID + */ + @ApiModelProperty("转入仓库ID") + private String targetScId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @TypeMismatch(message = "状态格式有误!") + @IsEnum(message = "状态格式有误!", enumClass = ScTransferOrderStatus.class) + private Integer status; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 起始时间 + */ + @ApiModelProperty("修改时间 起始时间") + @TypeMismatch(message = "修改时间起始时间格式有误!") + private LocalDateTime updateTimeStart; + + /** + * 修改时间 截止时间 + */ + @ApiModelProperty("修改时间 截止时间") + @TypeMismatch(message = "修改时间截止时间格式有误!") + private LocalDateTime updateTimeEnd; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 起始时间 + */ + @ApiModelProperty("审核时间 起始时间") + @TypeMismatch(message = "审核时间起始时间格式有误!") + private LocalDateTime approveTimeStart; + + /** + * 审核时间 截止时间 + */ + @ApiModelProperty("审核时间 截止时间") + @TypeMismatch(message = "审核时间截止时间格式有误!") + private LocalDateTime approveTimeEnd; + +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferProductVo.java new file mode 100644 index 0000000..c14cc64 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/QueryScTransferProductVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QueryScTransferProductVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 仓库ID + */ + @ApiModelProperty(value = "仓库ID", required = true) + @NotBlank(message = "仓库ID不能为空!") + private String scId; + + /** + * 检索关键字 + */ + @ApiModelProperty("检索关键字") + private String condition; + + /** + * 类目ID + */ + @ApiModelProperty("类目ID") + private String categoryId; + + /** + * 品牌ID + */ + @ApiModelProperty("品牌ID") + private String brandId; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ReceiveScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ReceiveScTransferOrderVo.java new file mode 100644 index 0000000..478ddba --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ReceiveScTransferOrderVo.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ReceiveScTransferOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 商品信息 + */ + @ApiModelProperty(value = "收货商品", required = true) + @Valid + @NotEmpty(message = "收货商品不能为空!") + private List products; + + @Data + public static class ReceiveScTransferProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 收货数量 + */ + @ApiModelProperty(value = "收货数量", required = true) + @NotNull(message = "收货数量不能为空!") + @TypeMismatch(message = "收货数量格式有误!") + private Integer receiveNum; + } +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ScTransferProductVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ScTransferProductVo.java new file mode 100644 index 0000000..0e3605d --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/ScTransferProductVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ScTransferProductVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 商品ID + */ + @ApiModelProperty(value = "商品ID", required = true) + @NotBlank(message = "商品ID不能为空!") + private String productId; + + /** + * 调拨数量 + */ + @ApiModelProperty(value = "调拨数量", required = true) + @NotNull(message = "调拨数量不能为空!") + @TypeMismatch(message = "调拨数量格式有误!") + private Integer transferNum; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/UpdateScTransferOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/UpdateScTransferOrderVo.java new file mode 100644 index 0000000..75ad5ad --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/stock/transfer/UpdateScTransferOrderVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.sc.vo.stock.transfer; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class UpdateScTransferOrderVo extends CreateScTransferOrderVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; +} diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/ydool/YdoolApproveOrderVo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/ydool/YdoolApproveOrderVo.java new file mode 100644 index 0000000..8247321 --- /dev/null +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/ydool/YdoolApproveOrderVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.sc.vo.ydool; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +public class YdoolApproveOrderVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + /** + * 订单ID 前端给的是order_id + */ + @ApiModelProperty(value = "订单ID", required = true,name = "order_id") + @NotBlank(message = "订单ID不能为空!") + @JsonProperty("order_id") // 映射前端字段名 + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String msg; + + /** + * 是否通过 + */ + @ApiModelProperty(value = "是否通过", required = true) + @NotBlank(message = "是否通过不能为空!") + private String status; +} diff --git a/xingyun-sc/src/main/java/lombok.config b/xingyun-sc/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-sc/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/mappers/logistics/LogisticsSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/logistics/LogisticsSheetMapper.xml new file mode 100644 index 0000000..6936f24 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/logistics/LogisticsSheetMapper.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + o.* + FROM tbl_logistics_sheet AS o + + + + SELECT + o.id, + o.code, + o.logistics_no, + o.logistics_company_id, + o.sender_name, + o.sender_telephone, + o.sender_province_id, + o.sender_city_id, + o.sender_district_id, + o.sender_address, + o.receiver_name, + o.receiver_telephone, + o.receiver_province_id, + o.receiver_city_id, + o.receiver_district_id, + o.receiver_address, + o.status, + o.description, + o.total_weight, + o.total_volume, + o.total_amount, + o.delivery_by, + o.delivery_time, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + d.id AS detail_id, + d.sheet_id AS detail_sheet_id, + d.biz_id AS detail_biz_id, + d.biz_type AS detail_biz_type + FROM tbl_logistics_sheet AS o + LEFT JOIN tbl_logistics_sheet_detail AS d ON d.sheet_id = o.id + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderDetailMapper.xml new file mode 100644 index 0000000..c0e1168 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderDetailMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.order_id, + d.product_id, + d.order_num, + d.tax_price, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.receive_num + FROM tbl_purchase_order_detail AS d + + + UPDATE tbl_purchase_order_detail + SET receive_num = receive_num + #{num} + WHERE id = #{id} + AND (order_num - receive_num) >= #{num} + + + UPDATE tbl_purchase_order_detail + SET receive_num = receive_num - #{num} + WHERE id = #{id} + AND receive_num >= #{num} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderMapper.xml new file mode 100644 index 0000000..9702abe --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseOrderMapper.xml @@ -0,0 +1,348 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + o.id, + o.code, + o.sc_id, + o.supplier_id, + o.purchaser_id, + o.expect_arrive_date, + o.total_num, + o.total_gift_num, + o.total_amount, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason + FROM tbl_purchase_order AS o + + + + SELECT + o.id, + o.code, + o.sc_id, + o.supplier_id, + o.purchaser_id, + o.expect_arrive_date, + o.total_num, + o.total_gift_num, + o.total_amount, + o.description, + o.create_by, + o.create_by_id, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.tax_price AS detail_tax_price, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no + FROM tbl_purchase_order AS o + LEFT JOIN tbl_purchase_order_detail AS d ON d.order_id = o.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit, + purchase.price AS purchase_price, + g.tax_rate, + g.available + FROM base_data_product AS g + INNER JOIN base_data_product_purchase AS purchase ON purchase.id = g.id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/PurchaseReturnMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseReturnMapper.xml new file mode 100644 index 0000000..97c6720 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/PurchaseReturnMapper.xml @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_purchase_return AS r + LEFT JOIN tbl_receive_sheet AS s ON s.id = r.receive_sheet_id + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.update_by, + r.update_time, + r.approve_by, + r.approve_time, + r.status, + r.refuse_reason, + r.settle_status, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.return_num AS detail_return_num, + d.tax_price AS detail_tax_price, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.receive_sheet_detail_id AS detail_receive_sheet_detail_id + FROM tbl_purchase_return AS r + LEFT JOIN tbl_purchase_return_detail AS d ON d.return_id = r.id + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetDetailMapper.xml new file mode 100644 index 0000000..27c4f04 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetDetailMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.sheet_id, + d.product_id, + d.order_num, + d.tax_price, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.return_num + FROM tbl_receive_sheet_detail AS d + + + UPDATE tbl_receive_sheet_detail + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_receive_sheet_detail + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetMapper.xml new file mode 100644 index 0000000..2fc62bb --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/purchase/ReceiveSheetMapper.xml @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_date, + r.purchase_order_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_receive_sheet AS r + LEFT JOIN tbl_purchase_order AS o ON o.id = r.purchase_order_id + + + + SELECT + r.id, + r.code, + r.sc_id, + r.supplier_id, + r.purchaser_id, + r.payment_date, + r.receive_date, + r.purchase_order_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.update_by, + r.update_time, + r.approve_by, + r.approve_time, + r.status, + r.refuse_reason, + r.settle_status, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.tax_price AS detail_tax_price, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.purchase_order_detail_id AS detail_purchase_order_detail_id + FROM tbl_receive_sheet AS r + LEFT JOIN tbl_receive_sheet_detail AS d ON d.sheet_id = r.id + + + + SELECT + s.id, + s.sc_id, + s.supplier_id, + s.purchaser_id, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.tax_price AS detail_tax_price, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.return_num AS detail_return_num + FROM tbl_receive_sheet AS s + LEFT JOIN tbl_receive_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailLotMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailLotMapper.xml new file mode 100644 index 0000000..9f5d0e5 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailLotMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + SELECT + d.id, + d.detail_id, + d.order_num, + d.return_num, + d.cost_tax_amount, + d.settle_status, + d.order_no + FROM tbl_retail_out_sheet_detail_lot AS d + + + UPDATE tbl_retail_out_sheet_detail_lot + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_retail_out_sheet_detail_lot + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailMapper.xml new file mode 100644 index 0000000..69e54a3 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetDetailMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.sheet_id, + d.product_id, + d.order_num, + d.ori_price, + d.tax_price, + d.discount_rate, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.return_num + FROM tbl_retail_out_sheet_detail AS d + + + UPDATE tbl_retail_out_sheet_detail + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_retail_out_sheet_detail + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetMapper.xml new file mode 100644 index 0000000..61a80fc --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailOutSheetMapper.xml @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.sc_id, + s.member_id, + s.saler_id, + s.payment_date, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.approve_by, + s.approve_time, + s.status, + s.settle_status + FROM tbl_retail_out_sheet AS s + + + + SELECT + s.id, + s.code, + s.sc_id, + s.member_id, + s.saler_id, + s.payment_date, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_by_id, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + b.main_product_id AS detail_main_product_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.ori_price AS detail_ori_price, + d.tax_price AS detail_tax_price, + d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status + FROM tbl_retail_out_sheet AS s + LEFT JOIN tbl_retail_out_sheet_detail AS d ON d.sheet_id = s.id + LEFT JOIN tbl_retail_out_sheet_detail_bundle AS b ON b.sheet_id = s.id AND b.product_detail_id = d.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit, + retail.price AS retail_price, + g.sale_tax_rate, + g.available + FROM base_data_product AS g + INNER JOIN base_data_product_retail AS retail ON retail.id = g.id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/retail/RetailReturnMapper.xml b/xingyun-sc/src/main/resources/mappers/retail/RetailReturnMapper.xml new file mode 100644 index 0000000..dc658d0 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/retail/RetailReturnMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.member_id, + r.saler_id, + r.payment_date, + r.out_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_retail_return AS r + LEFT JOIN tbl_retail_out_sheet AS s ON s.id = r.out_sheet_id + + + + SELECT r.id, r.code, r.sc_id, r.member_id, r.saler_id, r.payment_date, r.out_sheet_id, r.total_num, r.total_gift_num, + r.total_amount, r.description, r.create_by, r.create_time, r.update_by, r.update_time, r.approve_by, r.approve_time, + r.status, r.refuse_reason, r.settle_status, d.id AS detail_id, d.product_id AS detail_product_id, + d.return_num AS detail_return_num, d.ori_price AS detail_ori_price, d.tax_price AS detail_tax_price, d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, d.tax_rate AS detail_tax_rate, d.description AS detail_description, d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status, d.out_sheet_detail_id AS detail_out_sheet_detail_id + FROM tbl_retail_return AS r + LEFT JOIN tbl_retail_return_detail AS d ON d.return_id = r.id + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOrderDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderDetailMapper.xml new file mode 100644 index 0000000..d99e57a --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderDetailMapper.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.order_id, + d.product_id, + d.order_num, + d.ori_price, + d.tax_price, + d.discount_rate, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.out_num + FROM tbl_sale_order_detail AS d + + + UPDATE tbl_sale_order_detail + SET out_num = out_num + #{num} + WHERE id = #{id} + AND (order_num - out_num) >= #{num} + + + UPDATE tbl_sale_order_detail + SET out_num = out_num - #{num} + WHERE id = #{id} + AND out_num >= #{num} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOrderMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderMapper.xml new file mode 100644 index 0000000..8a06c63 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOrderMapper.xml @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + o.id, + o.code, + o.sc_id, + o.customer_id, + o.saler_id, + o.total_num, + o.total_gift_num, + o.total_amount, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason + FROM tbl_sale_order AS o + + + + SELECT + o.id, + o.code, + o.sc_id, + o.customer_id, + o.saler_id, + o.total_num, + o.total_gift_num, + o.total_amount, + o.description, + o.create_by, + o.create_by_id, + o.create_time, + o.update_by, + o.update_time, + o.approve_by, + o.approve_time, + o.status, + o.refuse_reason, + d.id AS detail_id, + b.main_product_id AS detail_main_product_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.ori_price AS detail_ori_price, + d.tax_price AS detail_tax_price, + d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no + FROM tbl_sale_order AS o + LEFT JOIN tbl_sale_order_detail AS d ON d.order_id = o.id + LEFT JOIN tbl_sale_order_detail_bundle AS b ON b.order_id = o.id AND b.product_detail_id = d.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit, + sale.price AS sale_price, + g.sale_tax_rate, + g.available + FROM base_data_product AS g + INNER JOIN base_data_product_sale AS sale ON sale.id = g.id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailLotMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailLotMapper.xml new file mode 100644 index 0000000..359384a --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailLotMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + SELECT + d.id, + d.detail_id, + d.order_num, + d.return_num, + d.cost_tax_amount, + d.settle_status, + d.order_no + FROM tbl_sale_out_sheet_detail_lot AS d + + + UPDATE tbl_sale_out_sheet_detail_lot + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_sale_out_sheet_detail_lot + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailMapper.xml new file mode 100644 index 0000000..d21f766 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetDetailMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + SELECT + d.id, + d.sheet_id, + d.product_id, + d.order_num, + d.ori_price, + d.tax_price, + d.discount_rate, + d.is_gift, + d.tax_rate, + d.description, + d.order_no, + d.return_num + FROM tbl_sale_out_sheet_detail AS d + + + UPDATE tbl_sale_out_sheet_detail + SET return_num = return_num + #{num} + WHERE id = #{id} + AND (order_num - return_num) >= #{num} + + + UPDATE tbl_sale_out_sheet_detail + SET return_num = return_num - #{num} + WHERE id = #{id} + AND return_num >= #{num} + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetMapper.xml new file mode 100644 index 0000000..c7cc5ef --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleOutSheetMapper.xml @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.sc_id, + s.customer_id, + s.saler_id, + s.payment_date, + s.sale_order_id, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.approve_by, + s.approve_time, + s.status, + s.settle_status + FROM tbl_sale_out_sheet AS s + LEFT JOIN tbl_sale_order AS o ON o.id = s.sale_order_id + + + + SELECT + s.id, + s.code, + s.sc_id, + s.customer_id, + s.saler_id, + s.payment_date, + s.sale_order_id, + s.total_num, + s.total_gift_num, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + b.main_product_id AS detail_main_product_id, + d.product_id AS detail_product_id, + d.order_num AS detail_order_num, + d.ori_price AS detail_ori_price, + d.tax_price AS detail_tax_price, + d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, + d.tax_rate AS detail_tax_rate, + d.description AS detail_description, + d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status, + d.sale_order_detail_id AS detail_sale_order_detail_id + FROM tbl_sale_out_sheet AS s + LEFT JOIN tbl_sale_out_sheet_detail AS d ON d.sheet_id = s.id + LEFT JOIN tbl_sale_out_sheet_detail_bundle AS b ON b.sheet_id = s.id AND b.product_detail_id = d.id + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/sale/SaleReturnMapper.xml b/xingyun-sc/src/main/resources/mappers/sale/SaleReturnMapper.xml new file mode 100644 index 0000000..b7c3fc1 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/sale/SaleReturnMapper.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + r.id, + r.code, + r.sc_id, + r.customer_id, + r.saler_id, + r.payment_date, + r.out_sheet_id, + r.total_num, + r.total_gift_num, + r.total_amount, + r.description, + r.create_by, + r.create_time, + r.approve_by, + r.approve_time, + r.status, + r.settle_status + FROM tbl_sale_return AS r + LEFT JOIN tbl_sale_out_sheet AS s ON s.id = r.out_sheet_id + + + + SELECT r.id, r.code, r.sc_id, r.customer_id, r.saler_id, r.payment_date, r.out_sheet_id, r.total_num, r.total_gift_num, + r.total_amount, r.description, r.create_by, r.create_time, r.update_by, r.update_time, r.approve_by, r.approve_time, + r.status, r.refuse_reason, r.settle_status, d.id AS detail_id, d.product_id AS detail_product_id, + d.return_num AS detail_return_num, d.ori_price AS detail_ori_price, d.tax_price AS detail_tax_price, d.discount_rate AS detail_discount_rate, + d.is_gift AS detail_is_gift, d.tax_rate AS detail_tax_rate, d.description AS detail_description, d.order_no AS detail_order_no, + d.settle_status AS detail_settle_status, d.out_sheet_detail_id AS detail_out_sheet_detail_id + FROM tbl_sale_return AS r + LEFT JOIN tbl_sale_return_detail AS d ON d.return_id = r.id + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/ProductStockLogMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/ProductStockLogMapper.xml new file mode 100644 index 0000000..fec1db1 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/ProductStockLogMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + gsl.id, + gsl.product_id, + gsl.sc_id, + gsl.ori_stock_num, + gsl.cur_stock_num, + gsl.ori_tax_price, + gsl.cur_tax_price, + gsl.stock_num, + gsl.tax_amount, + gsl.create_by, + gsl.create_time, + gsl.biz_id, + gsl.biz_code, + gsl.biz_detail_id, + gsl.biz_type + FROM tbl_product_stock_log AS gsl + INNER JOIN base_data_product AS g ON g.id = gsl.product_id AND g.product_type = 1 + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/ProductStockMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/ProductStockMapper.xml new file mode 100644 index 0000000..ce64730 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/ProductStockMapper.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + SELECT + gs.id, + gs.product_id, + gs.sc_id, + gs.stock_num, + gs.tax_price, + gs.tax_amount + FROM tbl_product_stock AS gs + INNER JOIN base_data_product AS g ON g.id = gs.product_id AND g.product_type = 1 + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + + + + UPDATE tbl_product_stock + SET stock_num = stock_num + #{stockNum}, tax_amount = tax_amount + #{taxAmount} + ,tax_price = CASE WHEN stock_num = 0 THEN 0 ELSE tax_amount / stock_num END + WHERE product_id = #{productId} + AND sc_id = #{scId} + AND stock_num = #{oriStockNum} + AND tax_amount = #{oriTaxAmount} + + + UPDATE tbl_product_stock + SET stock_num = stock_num - #{stockNum}, tax_amount = tax_amount - #{taxAmount} + ,tax_price = CASE WHEN stock_num = 0 THEN tax_price ELSE tax_amount / stock_num END + WHERE product_id = #{productId} + AND sc_id = #{scId} + AND stock_num = #{oriStockNum} + AND tax_amount = #{oriTaxAmount} + AND stock_num >= #{stockNum} + + + UPDATE tbl_product_stock + SET tax_price = #{taxPrice}, tax_amount = tax_price * stock_num + WHERE product_id = #{productId} + AND sc_id = #{scId} + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustReasonMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustReasonMapper.xml new file mode 100644 index 0000000..b8a1626 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustReasonMapper.xml @@ -0,0 +1,44 @@ + + + + + + SELECT + tb.* + FROM tbl_stock_adjust_reason AS tb + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml new file mode 100644 index 0000000..63b5e7b --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_stock_adjust_sheet AS tb + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.biz_type, + tb.reason_id, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + tb.refuse_reason, + tb.create_by_id, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.stock_num AS detail_stock_num, + d.description AS detail_description + FROM tbl_stock_adjust_sheet AS tb + LEFT JOIN tbl_stock_adjust_sheet_detail AS d ON d.sheet_id = tb.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM base_data_product AS g + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/adjust/StockCostAdjustSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockCostAdjustSheetMapper.xml new file mode 100644 index 0000000..d924b78 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockCostAdjustSheetMapper.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.product_num, + tb.diff_amount, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + tb.refuse_reason + FROM tbl_stock_cost_adjust_sheet AS tb + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.product_num, + tb.diff_amount, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + tb.refuse_reason, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.purchase_price AS detail_purchase_price, + d.stock_num AS detail_stock_num, + d.ori_price AS detail_ori_price, + d.price AS detail_price, + d.diff_amount AS detail_diff_amount, + d.description AS detail_description + FROM tbl_stock_cost_adjust_sheet AS tb + LEFT JOIN tbl_stock_cost_adjust_sheet_detail AS d ON d.sheet_id = tb.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit, + purchase.price AS purchase_price, + s.tax_price AS ori_price, + s.stock_num + FROM tbl_product_stock AS s + INNER JOIN base_data_product AS g ON g.id = s.product_id AND g.product_type = 1 + INNER JOIN base_data_product_purchase AS purchase ON purchase.id = g.id + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/PreTaskStockSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/PreTaskStockSheetMapper.xml new file mode 100644 index 0000000..e5172ca --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/PreTaskStockSheetMapper.xml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_pre_take_stock_sheet AS tb + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.take_status, + tb.description, + tb.update_by, + tb.update_time, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.first_num AS detail_first_num, + d.second_num AS detail_second_num, + d.rand_num AS detail_rand_num + FROM tbl_pre_take_stock_sheet AS tb + LEFT JOIN tbl_pre_take_stock_sheet_detail AS d ON d.sheet_id = tb.id + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.take_status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM tbl_pre_take_stock_sheet AS tb + + + + SELECT + tb.product_id, + tb.first_num, + tb.second_num, + tb.rand_num, + sh.take_status + FROM tbl_pre_take_stock_sheet_detail AS tb + LEFT JOIN tbl_pre_take_stock_sheet AS sh ON sh.id = tb.sheet_id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM base_data_product AS g + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockConfigMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockConfigMapper.xml new file mode 100644 index 0000000..8b73d9e --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockConfigMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanDetailMapper.xml new file mode 100644 index 0000000..991cb9d --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanDetailMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.product_id, + tb.stock_num + FROM tbl_take_stock_plan_detail AS tb + + + + SELECT + tb.id, + tb.product_id, + tb.stock_num, + tb.take_num, + tb.total_out_num, + tb.total_in_num, + tb.description, + tb.order_no + FROM tbl_take_stock_plan_detail AS tb + + + UPDATE tbl_take_stock_plan_detail SET total_in_num = total_in_num + #{num} + WHERE plan_id IN (SELECT id from tbl_take_stock_plan WHERE sc_id = #{scId} AND take_status = 0) AND product_id = #{productId} + + + UPDATE tbl_take_stock_plan_detail SET total_out_num = total_out_num + #{num} + WHERE plan_id IN (SELECT id from tbl_take_stock_plan WHERE sc_id = #{scId} AND take_status = 0) AND product_id = #{productId} + + + UPDATE tbl_take_stock_plan_detail set ori_take_num = IFNULL(ori_take_num, 0) + #{num} + WHERE plan_id = #{planId} AND product_id = #{productId} + + + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanMapper.xml new file mode 100644 index 0000000..79a96e9 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockPlanMapper.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_take_stock_plan AS tb + + + + SELECT + tb.product_id, + tb.stock_num, + tb.total_out_num, + tb.total_in_num + FROM tbl_take_stock_plan_detail AS tb + + + + SELECT + tb.id, + tb.code, + tb.sc_id, + tb.take_type, + tb.take_status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM tbl_take_stock_plan AS tb + + + + SELECT + tb.id, + tb.product_id, + tb.ori_take_num, + tb.take_num, + tb.stock_num, + tb.total_in_num, + tb.total_out_num, + tb.description + FROM tbl_take_stock_plan_detail AS tb + WHERE tb.plan_id = #{id} + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockSheetMapper.xml new file mode 100644 index 0000000..865efc0 --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/take/TakeStockSheetMapper.xml @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.plan_id, + tb.pre_sheet_id, + tb.sc_id, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time + FROM tbl_take_stock_sheet AS tb + LEFT JOIN tbl_take_stock_plan AS plan ON plan.id = tb.plan_id + + + + SELECT + tb.id, + tb.code, + tb.plan_id, + tb.pre_sheet_id, + tb.sc_id, + tb.status, + tb.description, + tb.refuse_reason, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.take_num AS detail_take_num, + d.description AS detail_description + FROM tbl_take_stock_sheet AS tb + LEFT JOIN tbl_take_stock_sheet_detail AS d ON d.sheet_id = tb.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM base_data_product AS g + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderDetailMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderDetailMapper.xml new file mode 100644 index 0000000..867239b --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderDetailMapper.xml @@ -0,0 +1,16 @@ + + + + + UPDATE tbl_sc_transfer_order_detail SET receive_num = receive_num + #{receiveNum} + WHERE order_id = #{orderId} + AND product_id = #{productId} + AND transfer_num - receive_num >= #{receiveNum} + + + + diff --git a/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderMapper.xml new file mode 100644 index 0000000..acd5c4b --- /dev/null +++ b/xingyun-sc/src/main/resources/mappers/stock/transfer/ScTransferOrderMapper.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.* + FROM tbl_sc_transfer_order AS tb + + + + SELECT + tb.id, + tb.code, + tb.source_sc_id, + tb.target_sc_id, + tb.total_num, + tb.total_amount, + tb.status, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.approve_by, + tb.approve_time, + tb.refuse_reason, + d.id AS detail_id, + d.product_id AS detail_product_id, + d.transfer_num AS detail_transfer_num, + d.receive_num AS detail_receive_num, + d.description AS detail_description + FROM tbl_sc_transfer_order AS tb + LEFT JOIN tbl_sc_transfer_order_detail AS d ON d.order_id = tb.id + + + + SELECT + g.id, + g.code, + g.name, + c.id AS category_id, + c.name AS category_name, + b.id AS brand_id, + b.name AS brand_name, + g.sku_code, + g.external_code, + g.spec, + g.unit + FROM tbl_product_stock AS ps + INNER JOIN base_data_product AS g ON g.id = ps.product_id AND g.product_type = 1 + LEFT JOIN base_data_product_category AS c ON c.id = g.category_id + LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id + LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + + + + + + + + + diff --git a/xingyun-sc/src/main/resources/print/purchase-order.ftl b/xingyun-sc/src/main/resources/print/purchase-order.ftl new file mode 100644 index 0000000..7258bd8 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/purchase-order.ftl @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
采购订单
+
+
+
+ 供应商: +
+
+ ${supplierName!''} +
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 币种: +
+
+ R M B +
+
+
+
+ 类型: +
+
+ 采购 +
+
+
+
+
+
+ 采购员: +
+
+ ${purchaserName!''} +
+
+
+ + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 采购价 + + 采购数量 + + 采购金额 + + 仓库 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''}${detail.purchasePrice!''} + ${detail.purchaseNum!''} + ${detail.purchaseAmount!''} + ${scName!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 收货人签名: +
+
+ __________ +
+
+
+
+ 供应商签名: +
+
+ __________ +
+
+
+ + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/purchase-return.ftl b/xingyun-sc/src/main/resources/print/purchase-return.ftl new file mode 100644 index 0000000..30b5864 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/purchase-return.ftl @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
采购退货单
+
+
+
+ 供应商: +
+
+ ${supplierName!''} +
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 仓库编号: +
+
+ ${scCode!''} +
+
+
+
+ 类型: +
+
+ 退货单 +
+
+
+
+
+
+ 收货单编号: +
+
+ ${receiveSheetCode!''} +
+
+
+
+ 采购员: +
+
+ ${purchaserName!''} +
+
+
+
+ 付款日期: +
+
+ ${paymentDate!''} +
+
+
+ + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 采购价 + + 退货数量 + + 退货金额 + + 仓库 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''}${detail.purchasePrice!''}${detail.returnNum!''}${detail.returnAmount!''}${scName!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 签收人签名: +
+
+ __________ +
+
+
+
+ 供应商签名: +
+
+ __________ +
+
+
+ + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/receive-sheet.ftl b/xingyun-sc/src/main/resources/print/receive-sheet.ftl new file mode 100644 index 0000000..d660db7 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/receive-sheet.ftl @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
采购收货单
+
+
+
+ 供应商: +
+
+ ${supplierName!''} +
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 仓库编号: +
+
+ ${scCode!''} +
+
+
+
+ 类型: +
+
+ 收货单 +
+
+
+
+
+
+ 收货单编号: +
+
+ ${purchaseOrderCode!''} +
+
+
+
+ 采购员: +
+
+ ${purchaserName!''} +
+
+
+
+ 付款日期: +
+
+ ${paymentDate!''} +
+
+
+ + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 采购价 + + 收货数量 + + 收货金额 + + 仓库 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''}${detail.purchasePrice!''}${detail.receiveNum!''}${detail.receiveAmount!''}${scName!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 收货人签名: +
+
+ __________ +
+
+
+
+ 供应商签名: +
+
+ __________ +
+
+
+ + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/retail-out-sheet.ftl b/xingyun-sc/src/main/resources/print/retail-out-sheet.ftl new file mode 100644 index 0000000..dea44fa --- /dev/null +++ b/xingyun-sc/src/main/resources/print/retail-out-sheet.ftl @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
零售出库单
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 币种: +
+
+ R M B +
+
+
+
+ 类型: +
+
+ 出库单 +
+
+
+
+ +
+
+ 销售员: +
+
+ ${salerName!''} +
+
+
+
+ 付款日期: +
+
+ ${paymentDate!''} +
+
+
+ + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 价格 + + 出库数量 + + 出库金额 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''}${detail.taxPrice!''}${detail.outNum!''}${detail.outAmount!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 客户签名: +
+
+ __________ +
+
+
+ + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/retail-return.ftl b/xingyun-sc/src/main/resources/print/retail-return.ftl new file mode 100644 index 0000000..841a53d --- /dev/null +++ b/xingyun-sc/src/main/resources/print/retail-return.ftl @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
零售退货单
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 币种: +
+
+ R M B +
+
+
+
+ 类型: +
+
+ 退货单 +
+
+
+
+ +
+
+ 销售员: +
+
+ ${salerName!''} +
+
+
+
+ 付款日期: +
+
+ ${paymentDate!''} +
+
+
+ + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 供应商 + + 价格 + + 退货数量 + + 退货金额 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''} + ${detail.supplierName!''}${detail.taxPrice!''}${detail.returnNum!''}${detail.returnAmount!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 签收人签名: +
+
+ __________ +
+
+
+ + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/sale-order.ftl b/xingyun-sc/src/main/resources/print/sale-order.ftl new file mode 100644 index 0000000..6118a1d --- /dev/null +++ b/xingyun-sc/src/main/resources/print/sale-order.ftl @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
销售订单
+
+
+
+ 客户: +
+
+ ${customerName!''} +
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 币种: +
+
+ R M B +
+
+
+
+ 类型: +
+
+ 销售 +
+
+
+
+
+
+ 销售人: +
+
+ ${salerName!''} +
+
+
+ + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 价格 + + 销售数量 + + 销售金额 + + 仓库 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''}${detail.taxPrice!''}${detail.orderNum!''}${detail.orderAmount!''}${scName!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 发货人签名: +
+
+ __________ +
+
+
+
+ 客户签名: +
+
+ __________ +
+
+
+ + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/sale-out-sheet.ftl b/xingyun-sc/src/main/resources/print/sale-out-sheet.ftl new file mode 100644 index 0000000..e1a1409 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/sale-out-sheet.ftl @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
销售出库单
+
+
+
+ 客户: +
+
+ ${customerName!''} +
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 币种: +
+
+ R M B +
+
+
+
+ 类型: +
+
+ 出库单 +
+
+
+
+
+
+ 销售订单号: +
+
+ ${saleOrderCode!''} +
+
+
+
+ 销售员: +
+
+ ${salerName!''} +
+
+
+
+ 付款日期: +
+
+ ${paymentDate!''} +
+
+
+ + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 价格 + + 出库数量 + + 出库金额 + + 仓库 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''}${detail.taxPrice!''}${detail.outNum!''}${detail.outAmount!''}${scName!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 出库人签名: +
+
+ __________ +
+
+
+
+ 客户签名: +
+
+ __________ +
+
+
+ + + \ No newline at end of file diff --git a/xingyun-sc/src/main/resources/print/sale-return.ftl b/xingyun-sc/src/main/resources/print/sale-return.ftl new file mode 100644 index 0000000..c836e69 --- /dev/null +++ b/xingyun-sc/src/main/resources/print/sale-return.ftl @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + +
算窗
+
销售退货单
+
+
+
+ 客户: +
+
+ ${customerName!''} +
+
+
+
+ 单据日期: +
+
+ ${createTime!''} +
+
+
+
+ 单据编号: +
+
+ ${code!''} +
+
+
+
+ 币种: +
+
+ R M B +
+
+
+
+ 类型: +
+
+ 退货单 +
+
+
+
+
+
+ 销售员: +
+
+ ${salerName!''} +
+
+
+
+ 付款日期: +
+
+ ${paymentDate!''} +
+
+
+ + + + + + + + + + + + <#if details??> + <#list details as detail> + + + + + + + + + + + + + + + + + + + + + + + + +
+ 商品编号 + + 商品名称 + + 商品SKU编号 + + 商品外部编号 + + 供应商 + + 价格 + + 退货数量 + + 退货金额 + + 仓库 +
+ ${detail.productCode!''} + ${detail.productName!''} + ${detail.skuCode!''} + ${detail.externalCode!''} + ${detail.supplierName!''}${detail.taxPrice!''}${detail.returnNum!''}${detail.returnAmount!''}${scName!''}
+ 合计数量 + ${totalNum!''} + 合计金额 + ${totalAmount!''}
+ 合计 大写金额: ${bigTotalAmount!''} +
+
+
+
+ 备注: +
+
+ ${description!''} +
+
+
+
+
+
+ 制单人: +
+
+ ${createBy!''} +
+
+
+
+ 签收人签名: +
+
+ __________ +
+
+ +
+ + + \ No newline at end of file diff --git a/xingyun-settle/pom.xml b/xingyun-settle/pom.xml new file mode 100644 index 0000000..44e5562 --- /dev/null +++ b/xingyun-settle/pom.xml @@ -0,0 +1,26 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-settle + 【${project.artifactId}】结算服务层 + + + + com.lframework + xingyun-core + + + + com.lframework + xingyun-sc + + + diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/GetSettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/GetSettleCheckSheetBo.java new file mode 100644 index 0000000..73df52b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/GetSettleCheckSheetBo.java @@ -0,0 +1,277 @@ +package com.lframework.xingyun.settle.bo.check; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @ApiModelProperty("未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + @ApiModelProperty("明细") + private List details; + + public GetSettleCheckSheetBo() { + + } + + public GetSettleCheckSheetBo(SettleCheckSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleCheckSheetFullDto dto) { + + return super.convert(dto, GetSettleCheckSheetBo::getStatus, GetSettleCheckSheetBo::getDetails); + } + + @Override + protected void afterInit(SettleCheckSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String bizId; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @ApiModelProperty("计算类型") + private Integer calcType; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 单据金额 + */ + @ApiModelProperty("单据金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal payAmount; + + /** + * 单据备注 + */ + @ApiModelProperty("单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(SettleCheckSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public
BaseBo convert(SettleCheckSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto, SettleCheckSheetFullDto.SheetDetailDto::getBizType, + SettleCheckSheetFullDto.SheetDetailDto::getCalcType); + } + + @Override + protected void afterInit(SettleCheckSheetFullDto.SheetDetailDto dto) { + + SettleCheckSheetService settleCheckSheetService = ApplicationUtil.getBean( + SettleCheckSheetService.class); + SettleCheckBizItemDto item = settleCheckSheetService.getBizItem(dto.getBizId(), dto.getBizType()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.bizType = dto.getBizType().getCode(); + this.totalAmount = item.getTotalAmount(); + this.calcType = dto.getCalcType().getCode(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/QuerySettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/QuerySettleCheckSheetBo.java new file mode 100644 index 0000000..95fffd8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/QuerySettleCheckSheetBo.java @@ -0,0 +1,178 @@ +package com.lframework.xingyun.settle.bo.check; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @ApiModelProperty("未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QuerySettleCheckSheetBo() { + + } + + public QuerySettleCheckSheetBo(SettleCheckSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleCheckSheet dto) { + + return super.convert(dto, QuerySettleCheckSheetBo::getStatus, QuerySettleCheckSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SettleCheckSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/SettleCheckBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/SettleCheckBizItemBo.java new file mode 100644 index 0000000..461315b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/SettleCheckBizItemBo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.settle.bo.check; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class SettleCheckBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String code; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @ApiModelProperty("计算类型") + private Integer calcType; + + /** + * 对账金额 + */ + @ApiModelProperty("对账金额") + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public SettleCheckBizItemBo() { + + } + + public SettleCheckBizItemBo(SettleCheckBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleCheckBizItemDto dto) { + + return super.convert(dto, SettleCheckBizItemBo::getBizType, SettleCheckBizItemBo::getCalcType); + } + + @Override + protected void afterInit(SettleCheckBizItemDto dto) { + + this.bizType = dto.getBizType().getCode(); + this.calcType = dto.getCalcType().getCode(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/CustomerSettleCheckBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/CustomerSettleCheckBizItemBo.java new file mode 100644 index 0000000..7085896 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/CustomerSettleCheckBizItemBo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.settle.bo.check.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class CustomerSettleCheckBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String code; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @ApiModelProperty("计算类型") + private Integer calcType; + + /** + * 对账金额 + */ + @ApiModelProperty("对账金额") + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public CustomerSettleCheckBizItemBo() { + + } + + public CustomerSettleCheckBizItemBo(CustomerSettleCheckBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckBizItemDto dto) { + + return super.convert(dto, CustomerSettleCheckBizItemBo::getBizType, + CustomerSettleCheckBizItemBo::getCalcType); + } + + @Override + protected void afterInit(CustomerSettleCheckBizItemDto dto) { + + this.bizType = dto.getBizType().getCode(); + this.calcType = dto.getCalcType().getCode(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/GetCustomerSettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/GetCustomerSettleCheckSheetBo.java new file mode 100644 index 0000000..1db0c5e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/GetCustomerSettleCheckSheetBo.java @@ -0,0 +1,282 @@ +package com.lframework.xingyun.settle.bo.check.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetCustomerSettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @ApiModelProperty("未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + @ApiModelProperty("明细") + private List details; + + public GetCustomerSettleCheckSheetBo() { + + } + + public GetCustomerSettleCheckSheetBo(CustomerSettleCheckSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettleCheckSheetBo::getStatus, + GetCustomerSettleCheckSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettleCheckSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends + BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String bizId; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String bizCode; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + private Integer bizType; + + /** + * 计算类型 + */ + @ApiModelProperty("计算类型") + private Integer calcType; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 单据金额 + */ + @ApiModelProperty("单据金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal payAmount; + + /** + * 单据备注 + */ + @ApiModelProperty("单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(CustomerSettleCheckSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + CustomerSettleCheckSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto, CustomerSettleCheckSheetFullDto.SheetDetailDto::getBizType, + CustomerSettleCheckSheetFullDto.SheetDetailDto::getCalcType); + } + + @Override + protected void afterInit(CustomerSettleCheckSheetFullDto.SheetDetailDto dto) { + + CustomerSettleCheckSheetService settleCheckSheetService = ApplicationUtil.getBean( + CustomerSettleCheckSheetService.class); + CustomerSettleCheckBizItemDto item = settleCheckSheetService.getBizItem(dto.getBizId(), + dto.getBizType()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.bizType = dto.getBizType().getCode(); + this.totalAmount = item.getTotalAmount(); + this.calcType = dto.getCalcType().getCode(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/QueryCustomerSettleCheckSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/QueryCustomerSettleCheckSheetBo.java new file mode 100644 index 0000000..99cbc8d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/check/customer/QueryCustomerSettleCheckSheetBo.java @@ -0,0 +1,179 @@ +package com.lframework.xingyun.settle.bo.check.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettleCheckSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @ApiModelProperty("未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QueryCustomerSettleCheckSheetBo() { + + } + + public QueryCustomerSettleCheckSheetBo(CustomerSettleCheckSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckSheet dto) { + + return super.convert(dto, QueryCustomerSettleCheckSheetBo::getStatus, + QueryCustomerSettleCheckSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(CustomerSettleCheckSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + this.totalUnPayAmount = NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/GetSettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/GetSettleFeeSheetBo.java new file mode 100644 index 0000000..541d16e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/GetSettleFeeSheetBo.java @@ -0,0 +1,209 @@ +package com.lframework.xingyun.settle.bo.fee; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 单据类型 + */ + @ApiModelProperty("单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + private List details; + + public GetSettleFeeSheetBo() { + + } + + public GetSettleFeeSheetBo(SettleFeeSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleFeeSheetFullDto dto) { + + return super.convert(dto, GetSettleFeeSheetBo::getSheetType, GetSettleFeeSheetBo::getStatus, + GetSettleFeeSheetBo::getDetails); + } + + @Override + protected void afterInit(SettleFeeSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new SheetDetailBo(t, dto.getSheetType())) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String itemId; + + /** + * 项目名称 + */ + @ApiModelProperty("项目名称") + private String itemName; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; + + @JsonIgnore + private SettleFeeSheetType sheetType; + + public SheetDetailBo(SettleFeeSheetFullDto.SheetDetailDto dto, SettleFeeSheetType sheetType) { + + this.sheetType = sheetType; + + this.init(dto); + } + + @Override + protected void afterInit(SettleFeeSheetFullDto.SheetDetailDto dto) { + + if (this.sheetType == SettleFeeSheetType.RECEIVE) { + SettleInItemService settleInItemService = ApplicationUtil.getBean( + SettleInItemService.class); + SettleInItem item = settleInItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } else { + SettleOutItemService settleOutItemService = ApplicationUtil.getBean( + SettleOutItemService.class); + SettleOutItem item = settleOutItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/QuerySettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/QuerySettleFeeSheetBo.java new file mode 100644 index 0000000..c8e8ebc --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/QuerySettleFeeSheetBo.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.settle.bo.fee; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 单据类型 + */ + @ApiModelProperty("单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QuerySettleFeeSheetBo() { + + } + + public QuerySettleFeeSheetBo(SettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleFeeSheet dto) { + + return super.convert(dto, QuerySettleFeeSheetBo::getSheetType, QuerySettleFeeSheetBo::getStatus, + QuerySettleFeeSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SettleFeeSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/GetCustomerSettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/GetCustomerSettleFeeSheetBo.java new file mode 100644 index 0000000..ded7d00 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/GetCustomerSettleFeeSheetBo.java @@ -0,0 +1,212 @@ +package com.lframework.xingyun.settle.bo.fee.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetCustomerSettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 单据类型 + */ + @ApiModelProperty("单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + @ApiModelProperty("明细") + private List details; + + public GetCustomerSettleFeeSheetBo() { + + } + + public GetCustomerSettleFeeSheetBo(CustomerSettleFeeSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleFeeSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettleFeeSheetBo::getSheetType, + GetCustomerSettleFeeSheetBo::getStatus, + GetCustomerSettleFeeSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettleFeeSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(t -> new SheetDetailBo(t, dto.getSheetType())) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String itemId; + + /** + * 项目名称 + */ + @ApiModelProperty("项目名称") + private String itemName; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; + + @JsonIgnore + private CustomerSettleFeeSheetType sheetType; + + public SheetDetailBo(CustomerSettleFeeSheetFullDto.SheetDetailDto dto, + CustomerSettleFeeSheetType sheetType) { + + this.sheetType = sheetType; + + this.init(dto); + } + + @Override + protected void afterInit(CustomerSettleFeeSheetFullDto.SheetDetailDto dto) { + + if (this.sheetType == CustomerSettleFeeSheetType.RECEIVE) { + SettleInItemService settleInItemService = ApplicationUtil.getBean( + SettleInItemService.class); + SettleInItem item = settleInItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } else { + SettleOutItemService settleOutItemService = ApplicationUtil.getBean( + SettleOutItemService.class); + SettleOutItem item = settleOutItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/QueryCustomerSettleFeeSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/QueryCustomerSettleFeeSheetBo.java new file mode 100644 index 0000000..4aba376 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/fee/customer/QueryCustomerSettleFeeSheetBo.java @@ -0,0 +1,141 @@ +package com.lframework.xingyun.settle.bo.fee.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettleFeeSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 单据类型 + */ + @ApiModelProperty("单据类型") + private Integer sheetType; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QueryCustomerSettleFeeSheetBo() { + + } + + public QueryCustomerSettleFeeSheetBo(CustomerSettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleFeeSheet dto) { + + return super.convert(dto, QueryCustomerSettleFeeSheetBo::getSheetType, + QueryCustomerSettleFeeSheetBo::getStatus, + QueryCustomerSettleFeeSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(CustomerSettleFeeSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.sheetType = dto.getSheetType().getCode(); + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/GetSettleInItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/GetSettleInItemBo.java new file mode 100644 index 0000000..919c9a5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/GetSettleInItemBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.bo.item.in; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSettleInItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSettleInItemBo() { + + } + + public GetSettleInItemBo(SettleInItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/QuerySettleInItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/QuerySettleInItemBo.java new file mode 100644 index 0000000..2a03b0b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/QuerySettleInItemBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.settle.bo.item.in; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleInItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySettleInItemBo() { + + } + + public QuerySettleInItemBo(SettleInItem dto) { + + super(dto); + } + + @Override + protected void afterInit(SettleInItem dto) { + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/SettleInItemSelectorBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/SettleInItemSelectorBo.java new file mode 100644 index 0000000..144e2de --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/in/SettleInItemSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.bo.item.in; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SettleInItemSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SettleInItemSelectorBo() { + + } + + public SettleInItemSelectorBo(SettleInItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/GetSettleOutItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/GetSettleOutItemBo.java new file mode 100644 index 0000000..403be51 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/GetSettleOutItemBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.bo.item.out; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSettleOutItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSettleOutItemBo() { + + } + + public GetSettleOutItemBo(SettleOutItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/QuerySettleOutItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/QuerySettleOutItemBo.java new file mode 100644 index 0000000..1811fd7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/QuerySettleOutItemBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.settle.bo.item.out; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleOutItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySettleOutItemBo() { + + } + + public QuerySettleOutItemBo(SettleOutItem dto) { + + super(dto); + } + + @Override + protected void afterInit(SettleOutItem dto) { + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/SettleOutItemSelectorBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/SettleOutItemSelectorBo.java new file mode 100644 index 0000000..21219bf --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/item/out/SettleOutItemSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.bo.item.out; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SettleOutItemSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SettleOutItemSelectorBo() { + + } + + public SettleOutItemSelectorBo(SettleOutItem dto) { + + super(dto); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/GetSettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/GetSettlePreSheetBo.java new file mode 100644 index 0000000..d73e3a9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/GetSettlePreSheetBo.java @@ -0,0 +1,189 @@ +package com.lframework.xingyun.settle.bo.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + @ApiModelProperty("明细") + private List details; + + public GetSettlePreSheetBo() { + + } + + public GetSettlePreSheetBo(SettlePreSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettlePreSheetFullDto dto) { + + return super.convert(dto, GetSettlePreSheetBo::getStatus, GetSettlePreSheetBo::getDetails); + } + + @Override + protected void afterInit(SettlePreSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String itemId; + + /** + * 项目名称 + */ + @ApiModelProperty("项目名称") + private String itemName; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; + + public SheetDetailBo() { + + } + + public SheetDetailBo(SettlePreSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + protected void afterInit(SettlePreSheetFullDto.SheetDetailDto dto) { + + SettleOutItemService settleOutItemService = ApplicationUtil.getBean( + SettleOutItemService.class); + SettleOutItem item = settleOutItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/QuerySettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/QuerySettlePreSheetBo.java new file mode 100644 index 0000000..e598720 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/QuerySettlePreSheetBo.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.settle.bo.pre; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QuerySettlePreSheetBo() { + + } + + public QuerySettlePreSheetBo(SettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettlePreSheet dto) { + + return super.convert(dto, QuerySettlePreSheetBo::getStatus, QuerySettlePreSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(SettlePreSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/GetCustomerSettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/GetCustomerSettlePreSheetBo.java new file mode 100644 index 0000000..7b630a9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/GetCustomerSettlePreSheetBo.java @@ -0,0 +1,191 @@ +package com.lframework.xingyun.settle.bo.pre.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.service.SettleInItemService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetCustomerSettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + @ApiModelProperty("明细") + private List details; + + public GetCustomerSettlePreSheetBo() { + + } + + public GetCustomerSettlePreSheetBo(CustomerSettlePreSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettlePreSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettlePreSheetBo::getStatus, + GetCustomerSettlePreSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettlePreSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String itemId; + + /** + * 项目名称 + */ + @ApiModelProperty("项目名称") + private String itemName; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; + + public SheetDetailBo() { + + } + + public SheetDetailBo(CustomerSettlePreSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + protected void afterInit(CustomerSettlePreSheetFullDto.SheetDetailDto dto) { + + SettleInItemService settleInItemService = ApplicationUtil.getBean( + SettleInItemService.class); + SettleInItem item = settleInItemService.findById(dto.getItemId()); + this.itemName = item.getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/QueryCustomerSettlePreSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/QueryCustomerSettlePreSheetBo.java new file mode 100644 index 0000000..b7db261 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/pre/customer/QueryCustomerSettlePreSheetBo.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.settle.bo.pre.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettlePreSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + private Integer settleStatus; + + public QueryCustomerSettlePreSheetBo() { + + } + + public QueryCustomerSettlePreSheetBo(CustomerSettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettlePreSheet dto) { + + return super.convert(dto, QueryCustomerSettlePreSheetBo::getStatus, + QueryCustomerSettlePreSheetBo::getSettleStatus); + } + + @Override + protected void afterInit(CustomerSettlePreSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + this.settleStatus = dto.getSettleStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/GetSettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/GetSettleSheetBo.java new file mode 100644 index 0000000..f5aaaf4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/GetSettleSheetBo.java @@ -0,0 +1,266 @@ +package com.lframework.xingyun.settle.bo.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.service.SettleSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSettleSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + @ApiModelProperty("明细") + private List details; + + public GetSettleSheetBo() { + + } + + public GetSettleSheetBo(SettleSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleSheetFullDto dto) { + + return super.convert(dto, GetSettleSheetBo::getStatus, GetSettleSheetBo::getDetails); + } + + @Override + protected void afterInit(SettleSheetFullDto dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new).collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String bizId; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String bizCode; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ApiModelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @ApiModelProperty("未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 实付金额 + */ + @ApiModelProperty("实付金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal discountAmount; + + /** + * 单据备注 + */ + @ApiModelProperty("单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(SettleSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SettleSheetFullDto.SheetDetailDto dto) { + + SettleSheetService settleSheetService = ApplicationUtil.getBean(SettleSheetService.class); + SettleBizItemDto item = settleSheetService.getBizItem(dto.getBizId()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.totalPayAmount = item.getTotalPayAmount(); + this.totalPayedAmount = item.getTotalPayedAmount(); + this.totalDiscountAmount = item.getTotalDiscountAmount(); + this.totalUnPayAmount = item.getTotalUnPayAmount(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/QuerySettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/QuerySettleSheetBo.java new file mode 100644 index 0000000..86758c4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/QuerySettleSheetBo.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.settle.bo.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + public QuerySettleSheetBo() { + + } + + public QuerySettleSheetBo(SettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleSheet dto) { + + return super.convert(dto, QuerySettleSheetBo::getStatus); + } + + @Override + protected void afterInit(SettleSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/SettleBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/SettleBizItemBo.java new file mode 100644 index 0000000..699384f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/SettleBizItemBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.bo.sheet; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class SettleBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String code; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ApiModelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @ApiModelProperty("未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public SettleBizItemBo() { + + } + + public SettleBizItemBo(SettleBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleBizItemDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(SettleBizItemDto dto) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/CustomerSettleBizItemBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/CustomerSettleBizItemBo.java new file mode 100644 index 0000000..ff43257 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/CustomerSettleBizItemBo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.bo.sheet.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class CustomerSettleBizItemBo extends BaseBo { + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String code; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ApiModelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @ApiModelProperty("未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + public CustomerSettleBizItemBo() { + + } + + public CustomerSettleBizItemBo(CustomerSettleBizItemDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleBizItemDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(CustomerSettleBizItemDto dto) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/GetCustomerSettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/GetCustomerSettleSheetBo.java new file mode 100644 index 0000000..7928ebe --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/GetCustomerSettleSheetBo.java @@ -0,0 +1,270 @@ +package com.lframework.xingyun.settle.bo.sheet.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.service.CustomerSettleSheetService; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetCustomerSettleSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + /** + * 拒绝原因 + */ + @ApiModelProperty("拒绝原因") + private String refuseReason; + + @ApiModelProperty("明细") + private List details; + + public GetCustomerSettleSheetBo() { + + } + + public GetCustomerSettleSheetBo(CustomerSettleSheetFullDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleSheetFullDto dto) { + + return super.convert(dto, GetCustomerSettleSheetBo::getStatus, + GetCustomerSettleSheetBo::getDetails); + } + + @Override + protected void afterInit(CustomerSettleSheetFullDto dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + + if (!CollectionUtil.isEmpty(dto.getDetails())) { + this.details = dto.getDetails().stream().map(SheetDetailBo::new) + .collect(Collectors.toList()); + } + } + + @Data + public static class SheetDetailBo extends BaseBo { + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private String id; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String bizId; + + /** + * 单据号 + */ + @ApiModelProperty("单据号") + private String bizCode; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + @ApiModelProperty("已付金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ApiModelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付金额 + */ + @ApiModelProperty("未付金额") + private BigDecimal totalUnPayAmount; + + /** + * 实付金额 + */ + @ApiModelProperty("实付金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal discountAmount; + + /** + * 单据备注 + */ + @ApiModelProperty("单据备注") + private String description; + + public SheetDetailBo() { + + } + + public SheetDetailBo(CustomerSettleSheetFullDto.SheetDetailDto dto) { + + super(dto); + } + + @Override + public BaseBo convert( + CustomerSettleSheetFullDto.SheetDetailDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(CustomerSettleSheetFullDto.SheetDetailDto dto) { + + CustomerSettleSheetService settleSheetService = ApplicationUtil.getBean( + CustomerSettleSheetService.class); + CustomerSettleBizItemDto item = settleSheetService.getBizItem(dto.getBizId()); + this.bizCode = item.getCode(); + this.approveTime = item.getApproveTime(); + this.totalPayAmount = item.getTotalPayAmount(); + this.totalPayedAmount = item.getTotalPayedAmount(); + this.totalDiscountAmount = item.getTotalDiscountAmount(); + this.totalUnPayAmount = item.getTotalUnPayAmount(); + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/QueryCustomerSettleSheetBo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/QueryCustomerSettleSheetBo.java new file mode 100644 index 0000000..85d56d8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/bo/sheet/customer/QueryCustomerSettleSheetBo.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.settle.bo.sheet.customer; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettleSheetBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 单号 + */ + @ApiModelProperty("单号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 总金额 + */ + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime startTime; + + /** + * 截止时间 + */ + @ApiModelProperty("截止时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime endTime; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核时间 + */ + @ApiModelProperty("审核时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime approveTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Integer status; + + public QueryCustomerSettleSheetBo() { + + } + + public QueryCustomerSettleSheetBo(CustomerSettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleSheet dto) { + + return super.convert(dto, QueryCustomerSettleSheetBo::getStatus); + } + + @Override + protected void afterInit(CustomerSettleSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + this.customerCode = customer.getCode(); + this.customerName = customer.getName(); + + this.status = dto.getStatus().getCode(); + + UserService userService = ApplicationUtil.getBean(UserService.class); + + if (!StringUtil.isBlank(dto.getApproveBy())) { + this.approveBy = userService.findById(dto.getApproveBy()).getName(); + } + + this.startTime = DateUtil.toLocalDateTime(dto.getStartDate()); + this.endTime = DateUtil.toLocalDateTimeMax(dto.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/components/code/GenerateCodeTypePool.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/components/code/GenerateCodeTypePool.java new file mode 100644 index 0000000..5fd6003 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/components/code/GenerateCodeTypePool.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.settle.components.code; + +import com.lframework.starter.web.components.code.GenerateCodeType; + +public interface GenerateCodeTypePool { + + /** + * 对账单 + */ + GenerateCodeType SETTLE_CHECK_SHEET = GenerateCodeType.FLOW; + + /** + * 费用单 + */ + GenerateCodeType SETTLE_FEE_SHEET = GenerateCodeType.FLOW; + + /** + * 预付款单 + */ + GenerateCodeType SETTLE_PRE_SHEET = GenerateCodeType.FLOW; + + /** + * 结算单 + */ + GenerateCodeType SETTLE_SHEET = GenerateCodeType.FLOW; + + /** + * 客户对账单 + */ + GenerateCodeType CUSTOMER_SETTLE_CHECK_SHEET = GenerateCodeType.FLOW; + + /** + * 客户费用单 + */ + GenerateCodeType CUSTOMER_SETTLE_FEE_SHEET = GenerateCodeType.FLOW; + + /** + * 客户预付款单 + */ + GenerateCodeType CUSTOMER_SETTLE_PRE_SHEET = GenerateCodeType.FLOW; + + /** + * 客户结算单 + */ + GenerateCodeType CUSTOMER_SETTLE_SHEET = GenerateCodeType.FLOW; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleCheckSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleCheckSheetController.java new file mode 100644 index 0000000..1934555 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleCheckSheetController.java @@ -0,0 +1,281 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.check.customer.CustomerSettleCheckBizItemBo; +import com.lframework.xingyun.settle.bo.check.customer.GetCustomerSettleCheckSheetBo; +import com.lframework.xingyun.settle.bo.check.customer.QueryCustomerSettleCheckSheetBo; +import com.lframework.xingyun.settle.excel.check.customer.CustomerSettleCheckSheetExportModel; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import com.lframework.xingyun.settle.vo.check.customer.ApprovePassCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.ApproveRefuseCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.BatchApprovePassCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.BatchApproveRefuseCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.CreateCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerUnCheckBizItemVo; +import com.lframework.xingyun.settle.vo.check.customer.UpdateCustomerSettleCheckSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 客户对账单 + * + * @author zmj + */ +@Api(tags = "客户对账单") +@Validated +@RestController +@RequestMapping("/customer/settle/checksheet") +public class CustomerSettleCheckSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettleCheckSheetService customerSettleCheckSheetService; + + /** + * 客户对账单列表 + */ + @ApiOperation("客户对账单列表") + @HasPermission({"customer-settle:check-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettleCheckSheetVo vo) { + + PageResult pageResult = customerSettleCheckSheetService.query( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettleCheckSheetBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"customer-settle:check-sheet:export"}) + @PostMapping("/export") + public void export(@Valid QueryCustomerSettleCheckSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("客户对账单信息", + CustomerSettleCheckSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = customerSettleCheckSheetService.query( + pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(CustomerSettleCheckSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:check-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户对账单ID不能为空!") String id) { + + CustomerSettleCheckSheetFullDto data = customerSettleCheckSheetService.getDetail(id); + + GetCustomerSettleCheckSheetBo result = new GetCustomerSettleCheckSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户对账单 + */ + @ApiOperation("创建客户对账单") + @HasPermission({"customer-settle:check-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettleCheckSheetVo vo) { + + vo.validate(); + + String id = customerSettleCheckSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户对账单 + */ + @ApiOperation("修改客户对账单") + @HasPermission({"customer-settle:check-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettleCheckSheetVo vo) { + + vo.validate(); + + customerSettleCheckSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户对账单 + */ + @ApiOperation("审核通过客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass( + @RequestBody @Valid ApprovePassCustomerSettleCheckSheetVo vo) { + + customerSettleCheckSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过客户对账单 + */ + @ApiOperation("批量审核通过客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassCustomerSettleCheckSheetVo vo) { + + customerSettleCheckSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户对账单 + */ + @ApiOperation("直接审核通过客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass( + @RequestBody @Valid CreateCustomerSettleCheckSheetVo vo) { + + customerSettleCheckSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户对账单 + */ + @ApiOperation("审核拒绝客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettleCheckSheetVo vo) { + + customerSettleCheckSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝客户对账单 + */ + @ApiOperation("批量审核拒绝客户对账单") + @HasPermission({"customer-settle:check-sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseCustomerSettleCheckSheetVo vo) { + + customerSettleCheckSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户对账单 + */ + @ApiOperation("删除客户对账单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:check-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户对账单ID不能为空!") String id) { + + customerSettleCheckSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除客户对账单 + */ + @ApiOperation("批量删除客户对账单") + @HasPermission({"customer-settle:check-sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的客户对账单!") List ids) { + + customerSettleCheckSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未对账的业务单据 + */ + @ApiOperation("查询未对账的业务单据") + @HasPermission({"customer-settle:check-sheet:add", "customer-settle:check-sheet:modify"}) + @GetMapping("/uncheck-items") + public InvokeResult> getUnCheckItems( + @Valid QueryCustomerUnCheckBizItemVo vo) { + + List results = customerSettleCheckSheetService.getUnCheckBizItems( + vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(CustomerSettleCheckBizItemBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleFeeSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleFeeSheetController.java new file mode 100644 index 0000000..dbfa204 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleFeeSheetController.java @@ -0,0 +1,258 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.fee.customer.GetCustomerSettleFeeSheetBo; +import com.lframework.xingyun.settle.bo.fee.customer.QueryCustomerSettleFeeSheetBo; +import com.lframework.xingyun.settle.excel.fee.customer.CustomerSettleFeeSheetExportModel; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetService; +import com.lframework.xingyun.settle.vo.fee.customer.ApprovePassCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.ApproveRefuseCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.BatchApprovePassCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.BatchApproveRefuseCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.CreateCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.QueryCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.UpdateCustomerSettleFeeSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 客户费用单 + * + * @author zmj + */ +@Api(tags = "客户费用单") +@Validated +@RestController +@RequestMapping("/customer/settle/feesheet") +public class CustomerSettleFeeSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettleFeeSheetService customerSettleFeeSheetService; + + /** + * 客户费用单列表 + */ + @ApiOperation("客户费用单列表") + @HasPermission({"customer-settle:fee-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettleFeeSheetVo vo) { + + PageResult pageResult = customerSettleFeeSheetService.query( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettleFeeSheetBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"customer-settle:fee-sheet:export"}) + @PostMapping("/export") + public void export(@Valid QueryCustomerSettleFeeSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("客户费用单信息", + CustomerSettleFeeSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = customerSettleFeeSheetService.query( + pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(CustomerSettleFeeSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:fee-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户费用单ID不能为空!") String id) { + + CustomerSettleFeeSheetFullDto data = customerSettleFeeSheetService.getDetail(id); + + GetCustomerSettleFeeSheetBo result = new GetCustomerSettleFeeSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户费用单 + */ + @ApiOperation("创建客户费用单") + @HasPermission({"customer-settle:fee-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettleFeeSheetVo vo) { + + vo.validate(); + + String id = customerSettleFeeSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户费用单 + */ + @ApiOperation("修改客户费用单") + @HasPermission({"customer-settle:fee-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettleFeeSheetVo vo) { + + vo.validate(); + + customerSettleFeeSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户费用单 + */ + @ApiOperation("审核通过客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass( + @RequestBody @Valid ApprovePassCustomerSettleFeeSheetVo vo) { + + customerSettleFeeSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过客户费用单 + */ + @ApiOperation("批量审核通过客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassCustomerSettleFeeSheetVo vo) { + + customerSettleFeeSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户费用单 + */ + @ApiOperation("直接审核通过客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass( + @RequestBody @Valid CreateCustomerSettleFeeSheetVo vo) { + + customerSettleFeeSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户费用单 + */ + @ApiOperation("审核拒绝客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettleFeeSheetVo vo) { + + customerSettleFeeSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝客户费用单 + */ + @ApiOperation("批量审核拒绝客户费用单") + @HasPermission({"customer-settle:fee-sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseCustomerSettleFeeSheetVo vo) { + + customerSettleFeeSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户费用单 + */ + @ApiOperation("删除客户费用单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:fee-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户费用单ID不能为空!") String id) { + + customerSettleFeeSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除客户费用单 + */ + @ApiOperation("批量删除客户费用单") + @HasPermission({"customer-settle:fee-sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的客户费用单!") List ids) { + + customerSettleFeeSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettlePreSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettlePreSheetController.java new file mode 100644 index 0000000..dad1111 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettlePreSheetController.java @@ -0,0 +1,258 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.pre.customer.GetCustomerSettlePreSheetBo; +import com.lframework.xingyun.settle.bo.pre.customer.QueryCustomerSettlePreSheetBo; +import com.lframework.xingyun.settle.excel.pre.customer.CustomerSettlePreSheetExportModel; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.customer.ApprovePassCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.ApproveRefuseCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.BatchApprovePassCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.BatchApproveRefuseCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.CreateCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.QueryCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.UpdateCustomerSettlePreSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 客户预付款单 + * + * @author zmj + */ +@Api(tags = "客户预付款单") +@Validated +@RestController +@RequestMapping("/customer/settle/presheet") +public class CustomerSettlePreSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettlePreSheetService settlePreSheetService; + + /** + * 客户预付款单列表 + */ + @ApiOperation("客户预付款单列表") + @HasPermission({"customer-settle:pre-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettlePreSheetVo vo) { + + PageResult pageResult = settlePreSheetService.query( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettlePreSheetBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"customer-settle:pre-sheet:export"}) + @PostMapping("/export") + public void export(@Valid QueryCustomerSettlePreSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("客户预付款单信息", + CustomerSettlePreSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = settlePreSheetService.query( + pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(CustomerSettlePreSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:pre-sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户预付款单ID不能为空!") String id) { + + CustomerSettlePreSheetFullDto data = settlePreSheetService.getDetail(id); + + GetCustomerSettlePreSheetBo result = new GetCustomerSettlePreSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户预付款单 + */ + @ApiOperation("创建客户预付款单") + @HasPermission({"customer-settle:pre-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettlePreSheetVo vo) { + + vo.validate(); + + String id = settlePreSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户预付款单 + */ + @ApiOperation("修改客户预付款单") + @HasPermission({"customer-settle:pre-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettlePreSheetVo vo) { + + vo.validate(); + + settlePreSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户预付款单 + */ + @ApiOperation("审核通过客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass( + @RequestBody @Valid ApprovePassCustomerSettlePreSheetVo vo) { + + settlePreSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过客户预付款单 + */ + @ApiOperation("批量审核通过客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassCustomerSettlePreSheetVo vo) { + + settlePreSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户预付款单 + */ + @ApiOperation("直接审核通过客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass( + @RequestBody @Valid CreateCustomerSettlePreSheetVo vo) { + + settlePreSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户预付款单 + */ + @ApiOperation("审核拒绝客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettlePreSheetVo vo) { + + settlePreSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝客户预付款单 + */ + @ApiOperation("批量审核拒绝客户预付款单") + @HasPermission({"customer-settle:pre-sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseCustomerSettlePreSheetVo vo) { + + settlePreSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户预付款单 + */ + @ApiOperation("删除客户预付款单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:pre-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户预付款单ID不能为空!") String id) { + + settlePreSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除客户预付款单 + */ + @ApiOperation("批量删除客户预付款单") + @HasPermission({"customer-settle:pre-sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的客户预付款单!") List ids) { + + settlePreSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleSheetController.java new file mode 100644 index 0000000..6b0fe61 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/CustomerSettleSheetController.java @@ -0,0 +1,278 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.sheet.customer.CustomerSettleBizItemBo; +import com.lframework.xingyun.settle.bo.sheet.customer.GetCustomerSettleSheetBo; +import com.lframework.xingyun.settle.bo.sheet.customer.QueryCustomerSettleSheetBo; +import com.lframework.xingyun.settle.excel.sheet.customer.CustomerSettleSheetExportModel; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.service.CustomerSettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.customer.ApprovePassCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.ApproveRefuseCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.BatchApprovePassCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.BatchApproveRefuseCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.CreateCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerUnSettleBizItemVo; +import com.lframework.xingyun.settle.vo.sheet.customer.UpdateCustomerSettleSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 客户结算单 + * + * @author zmj + */ +@Api(tags = "客户结算单") +@Validated +@RestController +@RequestMapping("/customer/settle/sheet") +public class CustomerSettleSheetController extends DefaultBaseController { + + @Autowired + private CustomerSettleSheetService customerSettleSheetService; + + /** + * 客户结算单列表 + */ + @ApiOperation("客户结算单列表") + @HasPermission({"customer-settle:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryCustomerSettleSheetVo vo) { + + PageResult pageResult = customerSettleSheetService.query( + getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryCustomerSettleSheetBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"customer-settle:sheet:export"}) + @PostMapping("/export") + public void export(@Valid QueryCustomerSettleSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("客户结算单信息", + CustomerSettleSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = customerSettleSheetService.query( + pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream() + .map(CustomerSettleSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:sheet:query"}) + @GetMapping + public InvokeResult findById( + @NotBlank(message = "客户结算单ID不能为空!") String id) { + + CustomerSettleSheetFullDto data = customerSettleSheetService.getDetail(id); + + GetCustomerSettleSheetBo result = new GetCustomerSettleSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建客户结算单 + */ + @ApiOperation("创建客户结算单") + @HasPermission({"customer-settle:sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateCustomerSettleSheetVo vo) { + + vo.validate(); + + String id = customerSettleSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改客户结算单 + */ + @ApiOperation("修改客户结算单") + @HasPermission({"customer-settle:sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateCustomerSettleSheetVo vo) { + + vo.validate(); + + customerSettleSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过客户结算单 + */ + @ApiOperation("审核通过客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassCustomerSettleSheetVo vo) { + + customerSettleSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过客户结算单 + */ + @ApiOperation("批量审核通过客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass( + @RequestBody @Valid BatchApprovePassCustomerSettleSheetVo vo) { + + customerSettleSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过客户结算单 + */ + @ApiOperation("直接审核通过客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass( + @RequestBody @Valid CreateCustomerSettleSheetVo vo) { + + customerSettleSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝客户结算单 + */ + @ApiOperation("审核拒绝客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse( + @RequestBody @Valid ApproveRefuseCustomerSettleSheetVo vo) { + + customerSettleSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝客户结算单 + */ + @ApiOperation("批量审核拒绝客户结算单") + @HasPermission({"customer-settle:sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse( + @RequestBody @Valid BatchApproveRefuseCustomerSettleSheetVo vo) { + + customerSettleSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除客户结算单 + */ + @ApiOperation("删除客户结算单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"customer-settle:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "客户结算单ID不能为空!") String id) { + + customerSettleSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除客户结算单 + */ + @ApiOperation("批量删除客户结算单") + @HasPermission({"customer-settle:sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的客户结算单!") List ids) { + + customerSettleSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未结算的业务单据 + */ + @ApiOperation("查询未结算的业务单据") + @HasPermission({"customer-settle:sheet:add", "customer-settle:sheet:modify"}) + @GetMapping("/unsettle-items") + public InvokeResult> getUnSettleItems( + @Valid QueryCustomerUnSettleBizItemVo vo) { + + List results = customerSettleSheetService.getUnSettleBizItems(vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(CustomerSettleBizItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleCheckSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleCheckSheetController.java new file mode 100644 index 0000000..02140e2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleCheckSheetController.java @@ -0,0 +1,267 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.check.GetSettleCheckSheetBo; +import com.lframework.xingyun.settle.bo.check.QuerySettleCheckSheetBo; +import com.lframework.xingyun.settle.bo.check.SettleCheckBizItemBo; +import com.lframework.xingyun.settle.excel.check.SettleCheckSheetExportModel; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import com.lframework.xingyun.settle.vo.check.ApprovePassSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.ApproveRefuseSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.BatchApprovePassSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.BatchApproveRefuseSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.CreateSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.QuerySettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.QueryUnCheckBizItemVo; +import com.lframework.xingyun.settle.vo.check.UpdateSettleCheckSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 供应商对账单 + * + * @author zmj + */ +@Api(tags = "供应商对账单") +@Validated +@RestController +@RequestMapping("/settle/checksheet") +public class SettleCheckSheetController extends DefaultBaseController { + + @Autowired + private SettleCheckSheetService settleCheckSheetService; + + /** + * 供应商对账单列表 + */ + @ApiOperation("供应商对账单列表") + @HasPermission({"settle:check-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleCheckSheetVo vo) { + + PageResult pageResult = settleCheckSheetService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleCheckSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"settle:check-sheet:export"}) + @PostMapping("/export") + public void export(@Valid QuerySettleCheckSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("供应商对账单信息", + SettleCheckSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = settleCheckSheetService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SettleCheckSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:check-sheet:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "供应商对账单ID不能为空!") String id) { + + SettleCheckSheetFullDto data = settleCheckSheetService.getDetail(id); + + GetSettleCheckSheetBo result = new GetSettleCheckSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商对账单 + */ + @ApiOperation("创建供应商对账单") + @HasPermission({"settle:check-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettleCheckSheetVo vo) { + + vo.validate(); + + String id = settleCheckSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商对账单 + */ + @ApiOperation("修改供应商对账单") + @HasPermission({"settle:check-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettleCheckSheetVo vo) { + + vo.validate(); + + settleCheckSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商对账单 + */ + @ApiOperation("审核通过供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettleCheckSheetVo vo) { + + settleCheckSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过供应商对账单 + */ + @ApiOperation("批量审核通过供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass(@RequestBody @Valid BatchApprovePassSettleCheckSheetVo vo) { + + settleCheckSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商对账单 + */ + @ApiOperation("直接审核通过供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettleCheckSheetVo vo) { + + settleCheckSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商对账单 + */ + @ApiOperation("审核拒绝供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettleCheckSheetVo vo) { + + settleCheckSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝供应商对账单 + */ + @ApiOperation("批量审核拒绝供应商对账单") + @HasPermission({"settle:check-sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse(@RequestBody @Valid BatchApproveRefuseSettleCheckSheetVo vo) { + + settleCheckSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商对账单 + */ + @ApiOperation("删除供应商对账单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:check-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商对账单ID不能为空!") String id) { + + settleCheckSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除供应商对账单 + */ + @ApiOperation("批量删除供应商对账单") + @HasPermission({"settle:check-sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的供应商对账单!") List ids) { + + settleCheckSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未对账的业务单据 + */ + @ApiOperation("查询未对账的业务单据") + @HasPermission({"settle:check-sheet:add", "settle:check-sheet:modify"}) + @GetMapping("/uncheck-items") + public InvokeResult> getUnCheckItems(@Valid QueryUnCheckBizItemVo vo) { + + List results = settleCheckSheetService.getUnCheckBizItems(vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(SettleCheckBizItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleFeeSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleFeeSheetController.java new file mode 100644 index 0000000..1db988c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleFeeSheetController.java @@ -0,0 +1,247 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.fee.GetSettleFeeSheetBo; +import com.lframework.xingyun.settle.bo.fee.QuerySettleFeeSheetBo; +import com.lframework.xingyun.settle.excel.fee.SettleFeeSheetExportModel; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.service.SettleFeeSheetService; +import com.lframework.xingyun.settle.vo.fee.ApprovePassSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.ApproveRefuseSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.BatchApprovePassSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.BatchApproveRefuseSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.CreateSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.QuerySettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.UpdateSettleFeeSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 供应商费用单 + * + * @author zmj + */ +@Api(tags = "供应商费用单") +@Validated +@RestController +@RequestMapping("/settle/feesheet") +public class SettleFeeSheetController extends DefaultBaseController { + + @Autowired + private SettleFeeSheetService settleFeeSheetService; + + /** + * 供应商费用单列表 + */ + @ApiOperation("供应商费用单列表") + @HasPermission({"settle:fee-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleFeeSheetVo vo) { + + PageResult pageResult = settleFeeSheetService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleFeeSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"settle:fee-sheet:export"}) + @PostMapping("/export") + public void export(@Valid QuerySettleFeeSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("供应商费用单信息", + SettleFeeSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = settleFeeSheetService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SettleFeeSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:fee-sheet:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "供应商费用单ID不能为空!") String id) { + + SettleFeeSheetFullDto data = settleFeeSheetService.getDetail(id); + + GetSettleFeeSheetBo result = new GetSettleFeeSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商费用单 + */ + @ApiOperation("创建供应商费用单") + @HasPermission({"settle:fee-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettleFeeSheetVo vo) { + + vo.validate(); + + String id = settleFeeSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商费用单 + */ + @ApiOperation("修改供应商费用单") + @HasPermission({"settle:fee-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettleFeeSheetVo vo) { + + vo.validate(); + + settleFeeSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商费用单 + */ + @ApiOperation("审核通过供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettleFeeSheetVo vo) { + + settleFeeSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过供应商费用单 + */ + @ApiOperation("批量审核通过供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass(@RequestBody @Valid BatchApprovePassSettleFeeSheetVo vo) { + + settleFeeSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商费用单 + */ + @ApiOperation("直接审核通过供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettleFeeSheetVo vo) { + + settleFeeSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商费用单 + */ + @ApiOperation("审核拒绝供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettleFeeSheetVo vo) { + + settleFeeSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝供应商费用单 + */ + @ApiOperation("批量审核拒绝供应商费用单") + @HasPermission({"settle:fee-sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse(@RequestBody @Valid BatchApproveRefuseSettleFeeSheetVo vo) { + + settleFeeSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商费用单 + */ + @ApiOperation("删除供应商费用单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:fee-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商费用单ID不能为空!") String id) { + + settleFeeSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除供应商费用单 + */ + @ApiOperation("批量删除供应商费用单") + @HasPermission({"settle:fee-sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的供应商费用单!") List ids) { + + settleFeeSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleInItemController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleInItemController.java new file mode 100644 index 0000000..0829e87 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleInItemController.java @@ -0,0 +1,186 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.item.in.GetSettleInItemBo; +import com.lframework.xingyun.settle.bo.item.in.QuerySettleInItemBo; +import com.lframework.xingyun.settle.excel.item.in.SettleInItemExportModel; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.vo.item.in.CreateSettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.UpdateSettleInItemVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 收入项目 + * + * @author zmj + */ +@Api(tags = "收入项目") +@Validated +@RestController +@RequestMapping("/settle/item/in") +public class SettleInItemController extends DefaultBaseController { + + @Autowired + private SettleInItemService settleInItemService; + + /** + * 收入项目列表 + */ + @ApiOperation("收入项目列表") + @HasPermission({"settle:in-item:query","settle:in-item:add","settle:in-item:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleInItemVo vo) { + + PageResult pageResult = settleInItemService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleInItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询收入项目 + */ + @ApiOperation("查询收入项目") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:in-item:query","settle:in-item:add","settle:in-item:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SettleInItem data = settleInItemService.findById(id); + if (data == null) { + throw new DefaultClientException("收入项目不存在!"); + } + + GetSettleInItemBo result = new GetSettleInItemBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出收入项目 + */ + @ApiOperation("导出收入项目") + @HasPermission({"settle:in-item:export"}) + @PostMapping("/export") + public void export(@Valid QuerySettleInItemVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("收入项目信息", + SettleInItemExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = settleInItemService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SettleInItemExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 批量停用收入项目 + */ + @ApiOperation("批量停用收入项目") + @HasPermission({"settle:in-item:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的收入项目!") @RequestBody List ids) { + + settleInItemService.batchUnable(ids); + + for (String id : ids) { + settleInItemService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用收入项目 + */ + @ApiOperation("批量启用收入项目") + @HasPermission({"settle:in-item:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的收入项目!") @RequestBody List ids) { + + settleInItemService.batchEnable(ids); + + for (String id : ids) { + settleInItemService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增收入项目 + */ + @ApiOperation("新增收入项目") + @HasPermission({"settle:in-item:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSettleInItemVo vo) { + + settleInItemService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改收入项目 + */ + @ApiOperation("修改收入项目") + @HasPermission({"settle:in-item:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSettleInItemVo vo) { + + settleInItemService.update(vo); + + settleInItemService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleOutItemController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleOutItemController.java new file mode 100644 index 0000000..1d9a28f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleOutItemController.java @@ -0,0 +1,186 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.item.out.GetSettleOutItemBo; +import com.lframework.xingyun.settle.bo.item.out.QuerySettleOutItemBo; +import com.lframework.xingyun.settle.excel.item.out.SettleOutItemExportModel; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.item.out.CreateSettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.UpdateSettleOutItemVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 支出项目 + * + * @author zmj + */ +@Api(tags = "支出项目") +@Validated +@RestController +@RequestMapping("/settle/item/out") +public class SettleOutItemController extends DefaultBaseController { + + @Autowired + private SettleOutItemService settleOutItemService; + + /** + * 支出项目列表 + */ + @ApiOperation("支出项目列表") + @HasPermission({"settle:out-item:query","settle:out-item:add","settle:out-item:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleOutItemVo vo) { + + PageResult pageResult = settleOutItemService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleOutItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询支出项目 + */ + @ApiOperation("查询支出项目") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:out-item:query","settle:out-item:add","settle:out-item:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SettleOutItem data = settleOutItemService.findById(id); + if (data == null) { + throw new DefaultClientException("支出项目不存在!"); + } + + GetSettleOutItemBo result = new GetSettleOutItemBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 导出支出项目 + */ + @ApiOperation("导出支出项目") + @HasPermission({"settle:out-item:export"}) + @PostMapping("/export") + public void export(@Valid QuerySettleOutItemVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("支出项目信息", + SettleOutItemExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = settleOutItemService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SettleOutItemExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 批量停用支出项目 + */ + @ApiOperation("批量停用支出项目") + @HasPermission({"settle:out-item:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要停用的支出项目!") @RequestBody List ids) { + + settleOutItemService.batchUnable(ids); + + for (String id : ids) { + settleOutItemService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用支出项目 + */ + @ApiOperation("批量启用支出项目") + @HasPermission({"settle:out-item:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @NotEmpty(message = "请选择需要启用的支出项目!") @RequestBody List ids) { + + settleOutItemService.batchEnable(ids); + + for (String id : ids) { + settleOutItemService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增支出项目 + */ + @ApiOperation("新增支出项目") + @HasPermission({"settle:out-item:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSettleOutItemVo vo) { + + settleOutItemService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改支出项目 + */ + @ApiOperation("修改支出项目") + @HasPermission({"settle:out-item:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSettleOutItemVo vo) { + + settleOutItemService.update(vo); + + settleOutItemService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettlePreSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettlePreSheetController.java new file mode 100644 index 0000000..c4866bf --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettlePreSheetController.java @@ -0,0 +1,247 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.pre.GetSettlePreSheetBo; +import com.lframework.xingyun.settle.bo.pre.QuerySettlePreSheetBo; +import com.lframework.xingyun.settle.excel.pre.SettlePreSheetExportModel; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.service.SettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.ApprovePassSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.ApproveRefuseSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.BatchApprovePassSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.BatchApproveRefuseSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.CreateSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.QuerySettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.UpdateSettlePreSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 供应商预付款单 + * + * @author zmj + */ +@Api(tags = "供应商预付款单") +@Validated +@RestController +@RequestMapping("/settle/presheet") +public class SettlePreSheetController extends DefaultBaseController { + + @Autowired + private SettlePreSheetService settlePreSheetService; + + /** + * 供应商预付款单列表 + */ + @ApiOperation("供应商预付款单列表") + @HasPermission({"settle:pre-sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettlePreSheetVo vo) { + + PageResult pageResult = settlePreSheetService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettlePreSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"settle:pre-sheet:export"}) + @PostMapping("/export") + public void export(@Valid QuerySettlePreSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("供应商预付款单信息", + SettlePreSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = settlePreSheetService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SettlePreSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:pre-sheet:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "供应商预付款单ID不能为空!") String id) { + + SettlePreSheetFullDto data = settlePreSheetService.getDetail(id); + + GetSettlePreSheetBo result = new GetSettlePreSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商预付款单 + */ + @ApiOperation("创建供应商预付款单") + @HasPermission({"settle:pre-sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettlePreSheetVo vo) { + + vo.validate(); + + String id = settlePreSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商预付款单 + */ + @ApiOperation("修改供应商预付款单") + @HasPermission({"settle:pre-sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettlePreSheetVo vo) { + + vo.validate(); + + settlePreSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商预付款单 + */ + @ApiOperation("审核通过供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettlePreSheetVo vo) { + + settlePreSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过供应商预付款单 + */ + @ApiOperation("批量审核通过供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass(@RequestBody @Valid BatchApprovePassSettlePreSheetVo vo) { + + settlePreSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商预付款单 + */ + @ApiOperation("直接审核通过供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettlePreSheetVo vo) { + + settlePreSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商预付款单 + */ + @ApiOperation("审核拒绝供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettlePreSheetVo vo) { + + settlePreSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝供应商预付款单 + */ + @ApiOperation("批量审核拒绝供应商预付款单") + @HasPermission({"settle:pre-sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse(@RequestBody @Valid BatchApproveRefuseSettlePreSheetVo vo) { + + settlePreSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商预付款单 + */ + @ApiOperation("删除供应商预付款单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:pre-sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商预付款单ID不能为空!") String id) { + + settlePreSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除供应商预付款单 + */ + @ApiOperation("批量删除供应商预付款单") + @HasPermission({"settle:pre-sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的供应商预付款单!") List ids) { + + settlePreSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSelectorController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSelectorController.java new file mode 100644 index 0000000..d345eb3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSelectorController.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.settle.bo.item.in.SettleInItemSelectorBo; +import com.lframework.xingyun.settle.bo.item.out.SettleOutItemSelectorBo; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据选择器 + * + * @author zmj + */ +@Api(tags = "数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class SettleSelectorController extends DefaultBaseController { + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private SettleOutItemService settleOutItemService; + + /** + * 收入项目 + */ + @ApiOperation("收入项目") + @GetMapping("/settle/item/in") + public InvokeResult> selector( + @Valid SettleInItemSelectorVo vo) { + + PageResult pageResult = settleInItemService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + + results = datas.stream().map(SettleInItemSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载收入项目 + */ + @ApiOperation("加载收入项目") + @PostMapping("/settle/item/in/load") + public InvokeResult> loadSettleInItem( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> settleInItemService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(SettleInItemSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + /** + * 支出项目 + */ + @ApiOperation("支出项目") + @GetMapping("/settle/item/out") + public InvokeResult> selector( + @Valid SettleOutItemSelectorVo vo) { + + PageResult pageResult = settleOutItemService.selector(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SettleOutItemSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载支出项目 + */ + @ApiOperation("加载支出项目") + @PostMapping("/settle/item/out/load") + public InvokeResult> loadSettleOutItem( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> settleOutItemService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(SettleOutItemSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSheetController.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSheetController.java new file mode 100644 index 0000000..1aa7e32 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/controller/SettleSheetController.java @@ -0,0 +1,267 @@ +package com.lframework.xingyun.settle.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.ExcelUtil; +import com.lframework.xingyun.settle.bo.sheet.GetSettleSheetBo; +import com.lframework.xingyun.settle.bo.sheet.QuerySettleSheetBo; +import com.lframework.xingyun.settle.bo.sheet.SettleBizItemBo; +import com.lframework.xingyun.settle.excel.sheet.SettleSheetExportModel; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.service.SettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.ApprovePassSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.ApproveRefuseSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.BatchApprovePassSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.BatchApproveRefuseSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.CreateSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.QuerySettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.QueryUnSettleBizItemVo; +import com.lframework.xingyun.settle.vo.sheet.UpdateSettleSheetVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 供应商结算单 + * + * @author zmj + */ +@Api(tags = "供应商结算单") +@Validated +@RestController +@RequestMapping("/settle/sheet") +public class SettleSheetController extends DefaultBaseController { + + @Autowired + private SettleSheetService settleSheetService; + + /** + * 供应商结算单列表 + */ + @ApiOperation("供应商结算单列表") + @HasPermission({"settle:sheet:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySettleSheetVo vo) { + + PageResult pageResult = settleSheetService.query(getPageIndex(vo), getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySettleSheetBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 导出 + */ + @ApiOperation("导出") + @HasPermission({"settle:sheet:export"}) + @PostMapping("/export") + public void export(@Valid QuerySettleSheetVo vo) { + + ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("供应商结算单信息", + SettleSheetExportModel.class); + + try { + int pageIndex = 1; + while (true) { + PageResult pageResult = settleSheetService.query(pageIndex, getExportSize(), vo); + List datas = pageResult.getDatas(); + List models = datas.stream().map(SettleSheetExportModel::new) + .collect(Collectors.toList()); + builder.doWrite(models); + + if (!pageResult.isHasNext()) { + break; + } + pageIndex++; + } + } finally { + builder.finish(); + } + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:sheet:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "供应商结算单ID不能为空!") String id) { + + SettleSheetFullDto data = settleSheetService.getDetail(id); + + GetSettleSheetBo result = new GetSettleSheetBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 创建供应商结算单 + */ + @ApiOperation("创建供应商结算单") + @HasPermission({"settle:sheet:add"}) + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateSettleSheetVo vo) { + + vo.validate(); + + String id = settleSheetService.create(vo); + + return InvokeResultBuilder.success(id); + } + + /** + * 修改供应商结算单 + */ + @ApiOperation("修改供应商结算单") + @HasPermission({"settle:sheet:modify"}) + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateSettleSheetVo vo) { + + vo.validate(); + + settleSheetService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核通过供应商结算单 + */ + @ApiOperation("审核通过供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PatchMapping("/approve/pass") + public InvokeResult approvePass(@RequestBody @Valid ApprovePassSettleSheetVo vo) { + + settleSheetService.approvePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核通过供应商结算单 + */ + @ApiOperation("批量审核通过供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PatchMapping("/approve/pass/batch") + public InvokeResult batchApprovePass(@RequestBody @Valid BatchApprovePassSettleSheetVo vo) { + + settleSheetService.batchApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 直接审核通过供应商结算单 + */ + @ApiOperation("直接审核通过供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PostMapping("/approve/pass/direct") + public InvokeResult directApprovePass(@RequestBody @Valid CreateSettleSheetVo vo) { + + settleSheetService.directApprovePass(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 审核拒绝供应商结算单 + */ + @ApiOperation("审核拒绝供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PatchMapping("/approve/refuse") + public InvokeResult approveRefuse(@RequestBody @Valid ApproveRefuseSettleSheetVo vo) { + + settleSheetService.approveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 批量审核拒绝供应商结算单 + */ + @ApiOperation("批量审核拒绝供应商结算单") + @HasPermission({"settle:sheet:approve"}) + @PatchMapping("/approve/refuse/batch") + public InvokeResult batchApproveRefuse(@RequestBody @Valid BatchApproveRefuseSettleSheetVo vo) { + + settleSheetService.batchApproveRefuse(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 删除供应商结算单 + */ + @ApiOperation("删除供应商结算单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"settle:sheet:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotBlank(message = "供应商结算单ID不能为空!") String id) { + + settleSheetService.deleteById(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量删除供应商结算单 + */ + @ApiOperation("批量删除供应商结算单") + @HasPermission({"settle:sheet:delete"}) + @DeleteMapping("/batch") + public InvokeResult deleteByIds( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "请选择需要删除的供应商结算单!") List ids) { + + settleSheetService.deleteByIds(ids); + + return InvokeResultBuilder.success(); + } + + /** + * 查询未结算的业务单据 + */ + @ApiOperation("查询未结算的业务单据") + @HasPermission({"settle:sheet:add", "settle:sheet:modify"}) + @GetMapping("/unsettle-items") + public InvokeResult> getUnCheckItems(@Valid QueryUnSettleBizItemVo vo) { + + List results = settleSheetService.getUnSettleBizItems(vo); + List datas = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(results)) { + datas = results.stream().map(SettleBizItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(datas); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckBizItemDto.java new file mode 100644 index 0000000..a963b6e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckBizItemDto.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.settle.dto.check; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetCalcType; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class SettleCheckBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 业务类型 + */ + private SettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private SettleCheckSheetCalcType calcType; + + /** + * 对账金额 + */ + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckSheetFullDto.java new file mode 100644 index 0000000..fc1b810 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/SettleCheckSheetFullDto.java @@ -0,0 +1,155 @@ +package com.lframework.xingyun.settle.dto.check; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetCalcType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class SettleCheckSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private SettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private SettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckBizItemDto.java new file mode 100644 index 0000000..37765c0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckBizItemDto.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.settle.dto.check.customer; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetCalcType; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class CustomerSettleCheckBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 业务类型 + */ + private CustomerSettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private CustomerSettleCheckSheetCalcType calcType; + + /** + * 对账金额 + */ + private BigDecimal totalAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckSheetFullDto.java new file mode 100644 index 0000000..d59f035 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/check/customer/CustomerSettleCheckSheetFullDto.java @@ -0,0 +1,155 @@ +package com.lframework.xingyun.settle.dto.check.customer; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetCalcType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class CustomerSettleCheckSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private CustomerSettleCheckSheetBizType bizType; + + /** + * 计算类型 + */ + private CustomerSettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/SettleFeeSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/SettleFeeSheetFullDto.java new file mode 100644 index 0000000..d10393a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/SettleFeeSheetFullDto.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.settle.dto.fee; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class SettleFeeSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 单据类型 + */ + private SettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/customer/CustomerSettleFeeSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/customer/CustomerSettleFeeSheetFullDto.java new file mode 100644 index 0000000..e772a88 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/fee/customer/CustomerSettleFeeSheetFullDto.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.settle.dto.fee.customer; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class CustomerSettleFeeSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 单据类型 + */ + private CustomerSettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/SettlePreSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/SettlePreSheetFullDto.java new file mode 100644 index 0000000..4be15ab --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/SettlePreSheetFullDto.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.settle.dto.pre; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class SettlePreSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/customer/CustomerSettlePreSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/customer/CustomerSettlePreSheetFullDto.java new file mode 100644 index 0000000..fc6fad5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/pre/customer/CustomerSettlePreSheetFullDto.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.settle.dto.pre.customer; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class CustomerSettlePreSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleBizItemDto.java new file mode 100644 index 0000000..c5a02fe --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleBizItemDto.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.settle.dto.sheet; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class SettleBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleSheetFullDto.java new file mode 100644 index 0000000..e671d4a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/SettleSheetFullDto.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.settle.dto.sheet; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class SettleSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleBizItemDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleBizItemDto.java new file mode 100644 index 0000000..3784042 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleBizItemDto.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.settle.dto.sheet.customer; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class CustomerSettleBizItemDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + private String id; + + /** + * 单据号 + */ + private String code; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + private BigDecimal totalUnPayAmount; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleSheetFullDto.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleSheetFullDto.java new file mode 100644 index 0000000..21fb87b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/dto/sheet/customer/CustomerSettleSheetFullDto.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.settle.dto.sheet.customer; + +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import lombok.Data; + +@Data +public class CustomerSettleSheetFullDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始日期 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 修改人ID + */ + private String updateBy; + + /** + * 修改时间 + */ + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 明细 + */ + private List details; + + @Data + public static class SheetDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 明细ID + */ + private String id; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheet.java new file mode 100644 index 0000000..27c3bbd --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheet.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_check_sheet") +public class CustomerSettleCheckSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheetDetail.java new file mode 100644 index 0000000..3d6caf9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleCheckSheetDetail.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetCalcType; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_check_sheet_detail") +public class CustomerSettleCheckSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 对账单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private CustomerSettleCheckSheetBizType bizType; + + /** + * 计算方式 + */ + private CustomerSettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheet.java new file mode 100644 index 0000000..99bcfa1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheet.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("customer_settle_fee_sheet") +public class CustomerSettleFeeSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 单据类型 + */ + private CustomerSettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheetDetail.java new file mode 100644 index 0000000..710a277 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleFeeSheetDetail.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("customer_settle_fee_sheet_detail") +public class CustomerSettleFeeSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 费用单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheet.java new file mode 100644 index 0000000..7e1fd49 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheet.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_pre_sheet") +public class CustomerSettlePreSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheetDetail.java new file mode 100644 index 0000000..abdf41c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettlePreSheetDetail.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("customer_settle_pre_sheet_detail") +public class CustomerSettlePreSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 预付款单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheet.java new file mode 100644 index 0000000..3f6bdf6 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheet.java @@ -0,0 +1,123 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("customer_settle_sheet") +public class CustomerSettleSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 客户ID + */ + private String customerId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private CustomerSettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheetDetail.java new file mode 100644 index 0000000..2be6847 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/CustomerSettleSheetDetail.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("customer_settle_sheet_detail") +public class CustomerSettleSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 结算单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheet.java new file mode 100644 index 0000000..95b5f16 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheet.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_check_sheet") +public class SettleCheckSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 应付金额 + */ + private BigDecimal totalPayAmount; + + /** + * 已付金额 + */ + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleCheckSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheetDetail.java new file mode 100644 index 0000000..1f40734 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleCheckSheetDetail.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetCalcType; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_check_sheet_detail") +public class SettleCheckSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 对账单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 业务类型 + */ + private SettleCheckSheetBizType bizType; + + /** + * 计算方式 + */ + private SettleCheckSheetCalcType calcType; + + /** + * 应付金额 + */ + private BigDecimal payAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheet.java new file mode 100644 index 0000000..22bfa07 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheet.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("settle_fee_sheet") +public class SettleFeeSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 单据类型 + */ + private SettleFeeSheetType sheetType; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleFeeSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheetDetail.java new file mode 100644 index 0000000..334c67c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleFeeSheetDetail.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-30 + */ +@Data +@TableName("settle_fee_sheet_detail") +public class SettleFeeSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 费用单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleInItem.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleInItem.java new file mode 100644 index 0000000..1033115 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleInItem.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-28 + */ +@Data +@TableName("settle_in_item") +public class SettleInItem extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SettleInItem"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleOutItem.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleOutItem.java new file mode 100644 index 0000000..8389547 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleOutItem.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-11-28 + */ +@Data +@TableName("settle_out_item") +public class SettleOutItem extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SettleOutItem"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheet.java new file mode 100644 index 0000000..898da61 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheet.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_pre_sheet") +public class SettlePreSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettlePreSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; + + /** + * 结算状态 + */ + private SettleStatus settleStatus; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheetDetail.java new file mode 100644 index 0000000..3d8f427 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettlePreSheetDetail.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-02 + */ +@Data +@TableName("settle_pre_sheet_detail") +public class SettlePreSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 预付款单ID + */ + private String sheetId; + + /** + * 项目ID + */ + private String itemId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheet.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheet.java new file mode 100644 index 0000000..f47b517 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheet.java @@ -0,0 +1,123 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("settle_sheet") +public class SettleSheet extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 单号 + */ + private String code; + + /** + * 供应商ID + */ + private String supplierId; + + /** + * 总金额 + */ + private BigDecimal totalAmount; + + /** + * 已优惠金额 + */ + private BigDecimal totalDiscountAmount; + + /** + * 起始时间 + */ + private LocalDate startDate; + + /** + * 截止日期 + */ + private LocalDate endDate; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 审核人 + */ + private String approveBy; + + /** + * 审核时间 + */ + private LocalDateTime approveTime; + + /** + * 状态 + */ + private SettleSheetStatus status; + + /** + * 拒绝原因 + */ + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheetDetail.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheetDetail.java new file mode 100644 index 0000000..43a485d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/entity/SettleSheetDetail.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.settle.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.math.BigDecimal; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-05 + */ +@Data +@TableName("settle_sheet_detail") +public class SettleSheetDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 结算单ID + */ + private String sheetId; + + /** + * 单据ID + */ + private String bizId; + + /** + * 实付金额 + */ + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + private BigDecimal discountAmount; + + /** + * 备注 + */ + private String description; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetBizType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetBizType.java new file mode 100644 index 0000000..3c9ab05 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetBizType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum CustomerSettleCheckSheetBizType implements BaseEnum { + OUT_SHEET(1, "销售出库单"), SALE_RETURN(2, "销售退单"), SETTLE_FEE_SHEET(3, "客户费用单"), SETTLE_PRE_SHEET(4, + "客户预收款单"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleCheckSheetBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetCalcType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetCalcType.java new file mode 100644 index 0000000..f8f9b72 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetCalcType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum CustomerSettleCheckSheetCalcType implements BaseEnum { + ADD(1, "加"), SUB(2, "减"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleCheckSheetCalcType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetStatus.java new file mode 100644 index 0000000..c472394 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleCheckSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum CustomerSettleCheckSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleCheckSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetStatus.java new file mode 100644 index 0000000..bb4cf0c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum CustomerSettleFeeSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleFeeSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetType.java new file mode 100644 index 0000000..c4cd96d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleFeeSheetType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum CustomerSettleFeeSheetType implements BaseEnum { + RECEIVE(1, "应收款"), PAY(2, "应付款"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleFeeSheetType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettlePreSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettlePreSheetStatus.java new file mode 100644 index 0000000..c8295c0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettlePreSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum CustomerSettlePreSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettlePreSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleSheetStatus.java new file mode 100644 index 0000000..f39af1d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/CustomerSettleSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum CustomerSettleSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + CustomerSettleSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetBizType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetBizType.java new file mode 100644 index 0000000..804c14d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetBizType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleCheckSheetBizType implements BaseEnum { + RECEIVE_SHEET(1, "采购收货单"), PURCHASE_RETURN(2, "采购退单"), SETTLE_FEE_SHEET(3, "供应商费用单"), SETTLE_PRE_SHEET(4, + "供应商预付款单"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleCheckSheetBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetCalcType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetCalcType.java new file mode 100644 index 0000000..0c2ce1f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetCalcType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleCheckSheetCalcType implements BaseEnum { + ADD(1, "加"), SUB(2, "减"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleCheckSheetCalcType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetStatus.java new file mode 100644 index 0000000..12616fa --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleCheckSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleCheckSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleCheckSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetStatus.java new file mode 100644 index 0000000..ffb73ae --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleFeeSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleFeeSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetType.java new file mode 100644 index 0000000..e8eb25d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleFeeSheetType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleFeeSheetType implements BaseEnum { + RECEIVE(1, "应收款"), PAY(2, "应付款"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleFeeSheetType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleOpLogType.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleOpLogType.java new file mode 100644 index 0000000..5b05b7a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleOpLogType.java @@ -0,0 +1,7 @@ +package com.lframework.xingyun.settle.enums; + +public interface SettleOpLogType { + + // 结算业务 + int SETTLE = 3000; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettlePreSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettlePreSheetStatus.java new file mode 100644 index 0000000..bd09760 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettlePreSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettlePreSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettlePreSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleSheetStatus.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleSheetStatus.java new file mode 100644 index 0000000..1b72626 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/enums/SettleSheetStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SettleSheetStatus implements BaseEnum { + CREATED(0, "待审核"), APPROVE_PASS(3, "审核通过"), APPROVE_REFUSE(6, "审核拒绝"); + + @EnumValue + private final Integer code; + + private final String desc; + + SettleSheetStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportModel.java new file mode 100644 index 0000000..24d89b6 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/SettleCheckSheetExportModel.java @@ -0,0 +1,167 @@ +package com.lframework.xingyun.settle.excel.check; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class SettleCheckSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 单据金额 + */ + @ExcelProperty("单据金额") + private BigDecimal totalAmount; + + /** + * 应付总金额 + */ + @ExcelProperty("应付总金额") + private BigDecimal totalPayAmount; + + /** + * 已付款金额 + */ + @ExcelProperty("已付款金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ExcelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @ExcelProperty("未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettleCheckSheetExportModel() { + + } + + public SettleCheckSheetExportModel(SettleCheckSheet dto) { + + super(dto); + } + + @Override + public
BaseBo convert(SettleCheckSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettleCheckSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalPayAmount(dto.getTotalPayAmount()); + this.setTotalPayedAmount(dto.getTotalPayedAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setTotalUnPayAmount( + NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), dto.getTotalDiscountAmount())); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettleCheckSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportModel.java new file mode 100644 index 0000000..5393bab --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/check/customer/CustomerSettleCheckSheetExportModel.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.settle.excel.check.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class CustomerSettleCheckSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 单据金额 + */ + @ExcelProperty("单据金额") + private BigDecimal totalAmount; + + /** + * 应付总金额 + */ + @ExcelProperty("应付总金额") + private BigDecimal totalPayAmount; + + /** + * 已付款金额 + */ + @ExcelProperty("已付款金额") + private BigDecimal totalPayedAmount; + + /** + * 已优惠金额 + */ + @ExcelProperty("已优惠金额") + private BigDecimal totalDiscountAmount; + + /** + * 未付款金额 + */ + @ExcelProperty("未付款金额") + private BigDecimal totalUnPayAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettleCheckSheetExportModel() { + + } + + public CustomerSettleCheckSheetExportModel(CustomerSettleCheckSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleCheckSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettleCheckSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalPayAmount(dto.getTotalPayAmount()); + this.setTotalPayedAmount(dto.getTotalPayedAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setTotalUnPayAmount( + NumberUtil.sub(dto.getTotalPayAmount(), dto.getTotalPayedAmount(), + dto.getTotalDiscountAmount())); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettleCheckSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportModel.java new file mode 100644 index 0000000..5866a86 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/SettleFeeSheetExportModel.java @@ -0,0 +1,137 @@ +package com.lframework.xingyun.settle.excel.fee; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class SettleFeeSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettleFeeSheetExportModel() { + + } + + public SettleFeeSheetExportModel(SettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleFeeSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettleFeeSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettleFeeSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportModel.java new file mode 100644 index 0000000..d6c9106 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/fee/customer/CustomerSettleFeeSheetExportModel.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.settle.excel.fee.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class CustomerSettleFeeSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettleFeeSheetExportModel() { + + } + + public CustomerSettleFeeSheetExportModel(CustomerSettleFeeSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleFeeSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettleFeeSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettleFeeSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportModel.java new file mode 100644 index 0000000..bbadeb8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/in/SettleInItemExportModel.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.excel.item.in; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.settle.entity.SettleInItem; +import lombok.Data; + +@Data +public class SettleInItemExportModel extends BaseBo implements ExcelModel { + + @ExcelProperty("编号") + private String code; + + @ExcelProperty("名称") + private String name; + + @ExcelProperty("备注") + private String description; + + public SettleInItemExportModel() { + + } + + public SettleInItemExportModel(SettleInItem dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleInItem dto) { + + return this; + } + + @Override + protected void afterInit(SettleInItem dto) { + + this.setCode(dto.getCode()); + this.setName(dto.getName()); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportModel.java new file mode 100644 index 0000000..2ed281f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/item/out/SettleOutItemExportModel.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.settle.excel.item.out; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import lombok.Data; + +@Data +public class SettleOutItemExportModel extends BaseBo implements ExcelModel { + + @ExcelProperty("编号") + private String code; + + @ExcelProperty("名称") + private String name; + + @ExcelProperty("备注") + private String description; + + public SettleOutItemExportModel() { + + } + + public SettleOutItemExportModel(SettleOutItem dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleOutItem dto) { + + return this; + } + + @Override + protected void afterInit(SettleOutItem dto) { + + this.setCode(dto.getCode()); + this.setName(dto.getName()); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportModel.java new file mode 100644 index 0000000..e27cc9b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/SettlePreSheetExportModel.java @@ -0,0 +1,137 @@ +package com.lframework.xingyun.settle.excel.pre; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class SettlePreSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettlePreSheetExportModel() { + + } + + public SettlePreSheetExportModel(SettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettlePreSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettlePreSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettlePreSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportModel.java new file mode 100644 index 0000000..ccaec83 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/pre/customer/CustomerSettlePreSheetExportModel.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.settle.excel.pre.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class CustomerSettlePreSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 单据总金额 + */ + @ExcelProperty("单据总金额") + private BigDecimal totalAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 结算状态 + */ + @ExcelProperty("结算状态") + private String settleStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettlePreSheetExportModel() { + + } + + public CustomerSettlePreSheetExportModel(CustomerSettlePreSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettlePreSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettlePreSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettlePreSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setSettleStatus(EnumUtil.getDesc(SettleStatus.class, dto.getSettleStatus())); + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportModel.java new file mode 100644 index 0000000..0ba7fa4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/SettleSheetExportModel.java @@ -0,0 +1,136 @@ +package com.lframework.xingyun.settle.excel.sheet; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Supplier; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class SettleSheetExportModel extends BaseBo implements ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 供应商编号 + */ + @ExcelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ExcelProperty("供应商名称") + private String supplierName; + + /** + * 实付总金额 + */ + @ExcelProperty("实付总金额") + private BigDecimal totalAmount; + + /** + * 优惠总金额 + */ + @ExcelProperty("优惠总金额") + private BigDecimal totalDiscountAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public SettleSheetExportModel() { + + } + + public SettleSheetExportModel(SettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(SettleSheet dto) { + + return this; + } + + @Override + protected void afterInit(SettleSheet dto) { + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(dto.getSupplierId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setSupplierCode(supplier.getCode()); + this.setSupplierName(supplier.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(SettleSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportModel.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportModel.java new file mode 100644 index 0000000..b192681 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/excel/sheet/customer/CustomerSettleSheetExportModel.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.settle.excel.sheet.customer; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.excel.ExcelModel; +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.basedata.entity.Customer; +import com.lframework.xingyun.basedata.service.customer.CustomerService; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +@Data +public class CustomerSettleSheetExportModel extends BaseBo implements + ExcelModel { + + /** + * 业务单据号 + */ + @ExcelProperty("业务单据号") + private String code; + + /** + * 客户编号 + */ + @ApiModelProperty("客户编号") + private String customerCode; + + /** + * 客户名称 + */ + @ApiModelProperty("客户名称") + private String customerName; + + /** + * 实付总金额 + */ + @ExcelProperty("实付总金额") + private BigDecimal totalAmount; + + /** + * 优惠总金额 + */ + @ExcelProperty("优惠总金额") + private BigDecimal totalDiscountAmount; + + /** + * 操作时间 + */ + @ExcelProperty("操作时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date createTime; + + /** + * 操作人 + */ + @ExcelProperty("操作人") + private String createBy; + + /** + * 审核状态 + */ + @ExcelProperty("审核状态") + private String status; + + /** + * 审核时间 + */ + @ExcelProperty("审核时间") + @DateTimeFormat(StringPool.DATE_TIME_PATTERN) + private Date approveTime; + + /** + * 审核人 + */ + @ExcelProperty("审核人") + private String approveBy; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String description; + + public CustomerSettleSheetExportModel() { + + } + + public CustomerSettleSheetExportModel(CustomerSettleSheet dto) { + + super(dto); + } + + @Override + public BaseBo convert(CustomerSettleSheet dto) { + + return this; + } + + @Override + protected void afterInit(CustomerSettleSheet dto) { + + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); + Customer customer = customerService.findById(dto.getCustomerId()); + + UserService userService = ApplicationUtil.getBean(UserService.class); + UserDto approveBy = null; + if (!StringUtil.isBlank(dto.getApproveBy())) { + approveBy = userService.findById(dto.getApproveBy()); + } + + this.setCode(dto.getCode()); + this.setCustomerCode(customer.getCode()); + this.setCustomerName(customer.getName()); + this.setTotalAmount(dto.getTotalAmount()); + this.setTotalDiscountAmount(dto.getTotalDiscountAmount()); + this.setCreateTime(DateUtil.toDate(dto.getCreateTime())); + this.setStatus(EnumUtil.getDesc(CustomerSettleSheetStatus.class, dto.getStatus())); + if (approveBy != null) { + this.setApproveBy(approveBy.getName()); + } + + if (dto.getApproveTime() != null) { + this.setApproveTime(DateUtil.toDate(dto.getApproveTime())); + } + this.setDescription(dto.getDescription()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetDetailServiceImpl.java new file mode 100644 index 0000000..78b0521 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetDetailServiceImpl.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettleCheckSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettleCheckSheetDetailServiceImpl + extends + BaseMpServiceImpl + implements CustomerSettleCheckSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetServiceImpl.java new file mode 100644 index 0000000..9ddaaa8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleCheckSheetServiceImpl.java @@ -0,0 +1,856 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.entity.SaleOutSheet; +import com.lframework.xingyun.sc.entity.SaleReturn; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.service.sale.SaleOutSheetService; +import com.lframework.xingyun.sc.service.sale.SaleReturnService; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetCalcType; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.CustomerSettleCheckSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetService; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetService; +import com.lframework.xingyun.settle.vo.check.customer.ApprovePassCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.ApproveRefuseCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.BatchApprovePassCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.BatchApproveRefuseCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.CreateCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.CustomerSettleCheckSheetItemVo; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerUnCheckBizItemVo; +import com.lframework.xingyun.settle.vo.check.customer.UpdateCustomerSettleCheckSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class CustomerSettleCheckSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleCheckSheetService { + + @Autowired + private CustomerSettleCheckSheetDetailService customerSettleCheckSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private SaleOutSheetService saleOutSheetService; + + @Autowired + private SaleReturnService saleReturnService; + + @Autowired + private CustomerSettleFeeSheetService customerSettleFeeSheetService; + + @Autowired + private CustomerSettlePreSheetService customerSettlePreSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleCheckSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettleCheckSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettleCheckSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = new CustomerSettleCheckSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode( + generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_CHECK_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleCheckSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户对账单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户对账单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleCheckSheetDetail::getOrderNo); + List sheetDetails = customerSettleCheckSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()); + customerSettleCheckSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleCheckSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleCheckSheetStatus.CREATED); + statusList.add(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getApproveBy, null) + .set(CustomerSettleCheckSheet::getApproveTime, null) + .set(CustomerSettleCheckSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettleCheckSheet::getId, sheet.getId()) + .in(CustomerSettleCheckSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户对账单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户对账单无法审核通过!"); + } + + sheet.setStatus(CustomerSettleCheckSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleCheckSheetStatus.CREATED); + statusList.add(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .eq(CustomerSettleCheckSheet::getId, sheet.getId()) + .in(CustomerSettleCheckSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettleCheckSheetVo approveVo = new ApprovePassCustomerSettleCheckSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户对账单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户对账单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户对账单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleCheckSheetStatus.CREATED); + statusList.add(CustomerSettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .eq(CustomerSettleCheckSheet::getId, sheet.getId()) + .in(CustomerSettleCheckSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassCustomerSettleCheckSheetVo approveVo = new ApprovePassCustomerSettleCheckSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户对账单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseCustomerSettleCheckSheetVo vo) { + + CustomerSettleCheckSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseCustomerSettleCheckSheetVo approveVo = new ApproveRefuseCustomerSettleCheckSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户对账单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除客户对账单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettleCheckSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户对账单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleCheckSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleCheckSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户对账单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户对账单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleCheckSheetDetail::getOrderNo); + List sheetDetails = customerSettleCheckSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, sheet.getId()); + customerSettleCheckSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + CustomerSettleCheckSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个客户对账单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Override + public CustomerSettleCheckBizItemDto getBizItem(String id, + CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + + switch (bizType) { + case OUT_SHEET: { + SaleOutSheet outSheet = saleOutSheetService.getById(id); + + result.setId(outSheet.getId()); + result.setCode(outSheet.getCode()); + result.setTotalAmount(outSheet.getTotalAmount()); + result.setApproveTime(outSheet.getApproveTime()); + result.setCalcType(CustomerSettleCheckSheetCalcType.ADD); + break; + } + case SALE_RETURN: { + SaleReturn saleReturn = saleReturnService.getById(id); + + result.setId(saleReturn.getId()); + result.setCode(saleReturn.getCode()); + result.setTotalAmount(saleReturn.getTotalAmount()); + result.setApproveTime(saleReturn.getApproveTime()); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_FEE_SHEET: { + CustomerSettleFeeSheet feeSheet = customerSettleFeeSheetService.getById(id); + + result.setId(feeSheet.getId()); + result.setCode(feeSheet.getCode()); + result.setTotalAmount(feeSheet.getTotalAmount()); + result.setApproveTime(feeSheet.getApproveTime()); + result.setCalcType(feeSheet.getSheetType() == CustomerSettleFeeSheetType.RECEIVE ? + CustomerSettleCheckSheetCalcType.ADD : + CustomerSettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_PRE_SHEET: { + CustomerSettlePreSheet preSheet = customerSettlePreSheetService.getById(id); + + result.setId(preSheet.getId()); + result.setCode(preSheet.getCode()); + result.setTotalAmount(preSheet.getTotalAmount()); + result.setApproveTime(preSheet.getApproveTime()); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + + result.setBizType(bizType); + if (result.getCalcType() == CustomerSettleCheckSheetCalcType.SUB) { + result.setTotalAmount(result.getTotalAmount().negate()); + } + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id, CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case OUT_SHEET: { + int count = saleOutSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SALE_RETURN: { + int count = saleReturnService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = customerSettleFeeSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = customerSettlePreSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id, CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case OUT_SHEET: { + int count = saleOutSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SALE_RETURN: { + int count = saleReturnService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = customerSettleFeeSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = customerSettlePreSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id, CustomerSettleCheckSheetBizType bizType) { + + CustomerSettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case OUT_SHEET: { + int count = saleOutSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SALE_RETURN: { + int count = saleReturnService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = customerSettleFeeSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = customerSettlePreSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException( + "单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + default: { + throw new DefaultSysException("未知的CustomerSettleCheckSheetBizType"); + } + } + } + + @Override + public List getUnCheckBizItems( + QueryCustomerUnCheckBizItemVo vo) { + + List results = new ArrayList<>(); + + List outSheetList = saleOutSheetService.getApprovedList(vo.getCustomerId(), + vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List saleReturnList = saleReturnService.getApprovedList(vo.getCustomerId(), + vo.getStartTime(), vo.getEndTime(), SettleStatus.UN_SETTLE); + + List feeSheetList = customerSettleFeeSheetService.getApprovedList( + vo.getCustomerId(), vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List preSheetList = customerSettlePreSheetService.getApprovedList( + vo.getCustomerId(), vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + if (!CollectionUtil.isEmpty(outSheetList)) { + for (SaleOutSheet item : outSheetList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.OUT_SHEET); + result.setCalcType(CustomerSettleCheckSheetCalcType.ADD); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(saleReturnList)) { + for (SaleReturn item : saleReturnList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.SALE_RETURN); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(feeSheetList)) { + for (CustomerSettleFeeSheet item : feeSheetList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.SETTLE_FEE_SHEET); + result.setCalcType(item.getSheetType() == CustomerSettleFeeSheetType.RECEIVE ? + CustomerSettleCheckSheetCalcType.ADD : + CustomerSettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(preSheetList)) { + for (CustomerSettlePreSheet item : preSheetList) { + CustomerSettleCheckBizItemDto result = new CustomerSettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(CustomerSettleCheckSheetBizType.SETTLE_PRE_SHEET); + result.setCalcType(CustomerSettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + results.stream().filter(t -> t.getCalcType() == CustomerSettleCheckSheetCalcType.SUB) + .forEach(t -> t.setTotalAmount(t.getTotalAmount().negate())); + + return results; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE) + .eq(CustomerSettleCheckSheet::getId, id) + .eq(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(CustomerSettleCheckSheet::getId, id) + .in(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.SETTLED) + .eq(CustomerSettleCheckSheet::getId, id) + .in(CustomerSettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleCheckSheetDetail.class) + .eq(CustomerSettleCheckSheetDetail::getSheetId, id) + .orderByAsc(CustomerSettleCheckSheetDetail::getOrderNo); + List sheetDetails = customerSettleCheckSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemSettled(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + return count; + } + + @Override + public List getApprovedList(String customerId, + LocalDateTime startTime, LocalDateTime endTime) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setSettleAmount(String id, BigDecimal totalPayedAmount, + BigDecimal totalDiscountAmount) { + + CustomerSettleCheckSheet checkSheet = getBaseMapper().selectById(id); + BigDecimal remainTotalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), + checkSheet.getTotalPayedAmount(), checkSheet.getTotalDiscountAmount(), + totalPayedAmount, + totalDiscountAmount); + BigDecimal totalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), + checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount()); + if (NumberUtil.lt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余收款金额为" + totalPayAmount + "元,本次收款金额为" + + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + if (NumberUtil.gt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余收款金额为" + totalPayAmount + "元,本次收款金额为" + + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleCheckSheet.class) + .set(CustomerSettleCheckSheet::getTotalPayedAmount, + NumberUtil.add(totalPayedAmount, checkSheet.getTotalPayedAmount())) + .set(CustomerSettleCheckSheet::getTotalDiscountAmount, + NumberUtil.add(totalDiscountAmount, checkSheet.getTotalDiscountAmount())) + .eq(CustomerSettleCheckSheet::getId, id) + .eq(CustomerSettleCheckSheet::getTotalPayedAmount, checkSheet.getTotalPayedAmount()) + .eq(CustomerSettleCheckSheet::getTotalDiscountAmount, + checkSheet.getTotalDiscountAmount()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("结账单:" + checkSheet.getCode() + ",信息已过期,请刷新重试!"); + } + + if (NumberUtil.equal(remainTotalPayAmount, 0)) { + this.setSettled(id); + } + } + + private void create(CustomerSettleCheckSheet sheet, CreateCustomerSettleCheckSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalPayAmount = BigDecimal.ZERO; + + int orderNo = 0; + for (CustomerSettleCheckSheetItemVo itemVo : vo.getItems()) { + orderNo++; + CustomerSettleCheckBizItemDto item = this.getBizItem(itemVo.getId(), + EnumUtil.getByCode(CustomerSettleCheckSheetBizType.class, itemVo.getBizType())); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + CustomerSettleCheckSheetDetail detail = new CustomerSettleCheckSheetDetail(); + + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setBizType( + EnumUtil.getByCode(CustomerSettleCheckSheetBizType.class, itemVo.getBizType())); + detail.setCalcType(item.getCalcType()); + if (item.getCalcType() == CustomerSettleCheckSheetCalcType.ADD) { + if (NumberUtil.lt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应收金额不允许小于0!"); + } + } else { + if (NumberUtil.gt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应收金额不允许大于0!"); + } + } + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + customerSettleCheckSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, item.getTotalAmount()); + totalPayAmount = NumberUtil.add(totalPayAmount, itemVo.getPayAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId(), detail.getBizType()); + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalPayAmount(totalPayAmount); + sheet.setTotalPayedAmount(BigDecimal.ZERO); + sheet.setTotalDiscountAmount(BigDecimal.ZERO); + sheet.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR + : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetDetailServiceImpl.java new file mode 100644 index 0000000..8c8b20e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettleFeeSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettleFeeSheetDetailServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleFeeSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetServiceImpl.java new file mode 100644 index 0000000..91ef597 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleFeeSheetServiceImpl.java @@ -0,0 +1,464 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.CustomerSettleFeeSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettleFeeSheetService; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.fee.customer.ApprovePassCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.ApproveRefuseCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.BatchApprovePassCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.BatchApproveRefuseCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.CreateCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.CustomerSettleFeeSheetItemVo; +import com.lframework.xingyun.settle.vo.fee.customer.QueryCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.UpdateCustomerSettleFeeSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class CustomerSettleFeeSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleFeeSheetService { + + @Autowired + private CustomerSettleFeeSheetDetailService customerSettleFeeSheetDetailService; + + @Autowired + private SettleOutItemService settleOutItemService; + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleFeeSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettleFeeSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettleFeeSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = new CustomerSettleFeeSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_FEE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleFeeSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户费用单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户费用单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleFeeSheetDetail.class) + .eq(CustomerSettleFeeSheetDetail::getSheetId, sheet.getId()); + customerSettleFeeSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleFeeSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleFeeSheetStatus.CREATED); + statusList.add(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getApproveBy, null) + .set(CustomerSettleFeeSheet::getApproveTime, null) + .set(CustomerSettleFeeSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettleFeeSheet::getId, sheet.getId()) + .in(CustomerSettleFeeSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户费用单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户费用单无法审核通过!"); + } + + sheet.setStatus(CustomerSettleFeeSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleFeeSheetStatus.CREATED); + statusList.add(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .eq(CustomerSettleFeeSheet::getId, sheet.getId()) + .in(CustomerSettleFeeSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettleFeeSheetVo approveVo = new ApprovePassCustomerSettleFeeSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户费用单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户费用单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户费用单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleFeeSheetStatus.CREATED); + statusList.add(CustomerSettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .eq(CustomerSettleFeeSheet::getId, sheet.getId()) + .in(CustomerSettleFeeSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassCustomerSettleFeeSheetVo approveVo = new ApprovePassCustomerSettleFeeSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个客户费用单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseCustomerSettleFeeSheetVo vo) { + + CustomerSettleFeeSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseCustomerSettleFeeSheetVo approveVo = new ApproveRefuseCustomerSettleFeeSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个客户费用单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除客户费用单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettleFeeSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户费用单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleFeeSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleFeeSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户费用单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户费用单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleFeeSheetDetail.class) + .eq(CustomerSettleFeeSheetDetail::getSheetId, sheet.getId()); + customerSettleFeeSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + CustomerSettleFeeSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException( + "第" + orderNo + "个客户费用单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE) + .eq(CustomerSettleFeeSheet::getId, id) + .eq(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(CustomerSettleFeeSheet::getId, id) + .in(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettleFeeSheet.class) + .set(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.SETTLED) + .eq(CustomerSettleFeeSheet::getId, id) + .in(CustomerSettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(CustomerSettleFeeSheet sheet, CreateCustomerSettleFeeSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (CustomerSettleFeeSheetItemVo itemVo : vo.getItems()) { + if (vo.getSheetType() == CustomerSettleFeeSheetType.RECEIVE.getCode().intValue()) { + SettleInItem item = settleInItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } else { + SettleOutItem item = settleOutItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } + CustomerSettleFeeSheetDetail detail = new CustomerSettleFeeSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + customerSettleFeeSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setSheetType(EnumUtil.getByCode(CustomerSettleFeeSheetType.class, vo.getSheetType())); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetDetailServiceImpl.java new file mode 100644 index 0000000..bee9c3a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettlePreSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettlePreSheetDetailServiceImpl extends + BaseMpServiceImpl + implements CustomerSettlePreSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetServiceImpl.java new file mode 100644 index 0000000..9bec66d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettlePreSheetServiceImpl.java @@ -0,0 +1,446 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.CustomerSettlePreSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettlePreSheetService; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.vo.pre.customer.ApprovePassCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.ApproveRefuseCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.BatchApprovePassCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.BatchApproveRefuseCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.CreateCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.CustomerSettlePreSheetItemVo; +import com.lframework.xingyun.settle.vo.pre.customer.QueryCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.UpdateCustomerSettlePreSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class CustomerSettlePreSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettlePreSheetService { + + @Autowired + private CustomerSettlePreSheetDetailService settlePreSheetDetailService; + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettlePreSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettlePreSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettlePreSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建客户预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建预付款单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = new CustomerSettlePreSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_PRE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettlePreSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改客户预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改预付款单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户预付款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED + && sheet.getStatus() != CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户预付款单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户预付款单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettlePreSheetDetail.class) + .eq(CustomerSettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettlePreSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettlePreSheetStatus.CREATED); + statusList.add(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getApproveBy, null) + .set(CustomerSettlePreSheet::getApproveTime, null) + .set(CustomerSettlePreSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettlePreSheet::getId, sheet.getId()) + .in(CustomerSettlePreSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过客户预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户预付款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED + && sheet.getStatus() != CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户预付款单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户预付款单无法审核通过!"); + } + + sheet.setStatus(CustomerSettlePreSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettlePreSheetStatus.CREATED); + statusList.add(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .eq(CustomerSettlePreSheet::getId, sheet.getId()) + .in(CustomerSettlePreSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettlePreSheetVo approveVo = new ApprovePassCustomerSettlePreSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝客户预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户预付款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户预付款单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户预付款单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户预付款单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettlePreSheetStatus.CREATED); + statusList.add(CustomerSettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .eq(CustomerSettlePreSheet::getId, sheet.getId()) + .in(CustomerSettlePreSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassCustomerSettlePreSheetVo approveVo = new ApprovePassCustomerSettlePreSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户预付款单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseCustomerSettlePreSheetVo vo) { + + CustomerSettlePreSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseCustomerSettlePreSheetVo approveVo = new ApproveRefuseCustomerSettlePreSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户预付款单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除客户预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettlePreSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户预付款单不存在!"); + } + + if (sheet.getStatus() != CustomerSettlePreSheetStatus.CREATED + && sheet.getStatus() != CustomerSettlePreSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户预付款单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户预付款单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettlePreSheetDetail.class) + .eq(CustomerSettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + CustomerSettlePreSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户预付款单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE) + .eq(CustomerSettlePreSheet::getId, id) + .eq(CustomerSettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE) + .eq(CustomerSettlePreSheet::getId, id) + .in(CustomerSettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate( + CustomerSettlePreSheet.class) + .set(CustomerSettlePreSheet::getSettleStatus, SettleStatus.SETTLED) + .eq(CustomerSettlePreSheet::getId, id) + .in(CustomerSettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, + SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(customerId, startTime, endTime, settleStatus); + } + + private void create(CustomerSettlePreSheet sheet, CreateCustomerSettlePreSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (CustomerSettlePreSheetItemVo itemVo : vo.getItems()) { + SettleInItem item = settleInItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + CustomerSettlePreSheetDetail detail = new CustomerSettlePreSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + settlePreSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setTotalAmount(totalAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetDetailServiceImpl.java new file mode 100644 index 0000000..83084c0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; +import com.lframework.xingyun.settle.mappers.CustomerSettleSheetDetailMapper; +import com.lframework.xingyun.settle.service.CustomerSettleSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class CustomerSettleSheetDetailServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetServiceImpl.java new file mode 100644 index 0000000..ef25b82 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/CustomerSettleSheetServiceImpl.java @@ -0,0 +1,558 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.CustomerSettleSheetMapper; +import com.lframework.xingyun.settle.service.CustomerSettleCheckSheetService; +import com.lframework.xingyun.settle.service.CustomerSettleSheetDetailService; +import com.lframework.xingyun.settle.service.CustomerSettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.customer.ApprovePassCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.ApproveRefuseCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.BatchApprovePassCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.BatchApproveRefuseCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.CreateCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.CustomerSettleSheetItemVo; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerUnSettleBizItemVo; +import com.lframework.xingyun.settle.vo.sheet.customer.UpdateCustomerSettleSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class CustomerSettleSheetServiceImpl extends + BaseMpServiceImpl + implements CustomerSettleSheetService { + + @Autowired + private CustomerSettleSheetDetailService customerSettleSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private CustomerSettleCheckSheetService customerSettleCheckSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryCustomerSettleSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public CustomerSettleSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = new CustomerSettleSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.CUSTOMER_SETTLE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户结算单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("客户结算单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleSheetDetail::getOrderNo); + List sheetDetails = customerSettleSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()); + customerSettleSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(CustomerSettleSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleSheetStatus.CREATED); + statusList.add(CustomerSettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(CustomerSettleSheet.class) + .set(CustomerSettleSheet::getApproveBy, null).set(CustomerSettleSheet::getApproveTime, null) + .set(CustomerSettleSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(CustomerSettleSheet::getId, sheet.getId()) + .in(CustomerSettleSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户结算单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("客户结算单无法审核通过!"); + } + + sheet.setStatus(CustomerSettleSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleSheetStatus.CREATED); + statusList.add(CustomerSettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(CustomerSettleSheet.class) + .eq(CustomerSettleSheet::getId, sheet.getId()) + .in(CustomerSettleSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户结算单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleSheetDetail::getOrderNo); + List details = customerSettleSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleSheetDetail detail : details) { + customerSettleCheckSheetService.setSettleAmount(detail.getBizId(), detail.getPayAmount(), + detail.getDiscountAmount()); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateCustomerSettleSheetVo vo) { + + CustomerSettleSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassCustomerSettleSheetVo approveVo = new ApprovePassCustomerSettleSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseCustomerSettleSheetVo vo) { + + CustomerSettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED) { + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("客户结算单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("客户结算单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("客户结算单无法审核拒绝!"); + } + + sheet.setStatus(CustomerSettleSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(CustomerSettleSheetStatus.CREATED); + statusList.add(CustomerSettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(CustomerSettleSheet.class) + .eq(CustomerSettleSheet::getId, sheet.getId()) + .in(CustomerSettleSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("客户结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassCustomerSettleSheetVo vo) { + + CustomerSettleSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassCustomerSettleSheetVo approveVo = new ApprovePassCustomerSettleSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户结算单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseCustomerSettleSheetVo vo) { + + CustomerSettleSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseCustomerSettleSheetVo approveVo = new ApproveRefuseCustomerSettleSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户结算单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除客户结算单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + CustomerSettleSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("客户结算单不存在!"); + } + + if (sheet.getStatus() != CustomerSettleSheetStatus.CREATED + && sheet.getStatus() != CustomerSettleSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == CustomerSettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的客户结算单不允许执行删除操作!"); + } + + throw new DefaultClientException("客户结算单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()) + .orderByAsc(CustomerSettleSheetDetail::getOrderNo); + List sheetDetails = customerSettleSheetDetailService.list( + queryDetailWrapper); + for (CustomerSettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery( + CustomerSettleSheetDetail.class) + .eq(CustomerSettleSheetDetail::getSheetId, sheet.getId()); + customerSettleSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + CustomerSettleSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个客户结算单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Override + public CustomerSettleBizItemDto getBizItem(String id) { + + CustomerSettleCheckSheet checkSheet = customerSettleCheckSheetService.getById(id); + + CustomerSettleBizItemDto result = new CustomerSettleBizItemDto(); + result.setId(checkSheet.getId()); + result.setCode(checkSheet.getCode()); + result.setTotalPayAmount(checkSheet.getTotalPayAmount()); + result.setTotalPayedAmount(checkSheet.getTotalPayedAmount()); + result.setTotalDiscountAmount(checkSheet.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(checkSheet.getTotalPayAmount(), checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount())); + result.setApproveTime(checkSheet.getApproveTime()); + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id) { + + CustomerSettleCheckSheet item = customerSettleCheckSheetService.getById(id); + int count = customerSettleCheckSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id) { + + CustomerSettleCheckSheet item = customerSettleCheckSheetService.getById(id); + int count = customerSettleCheckSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id) { + + CustomerSettleCheckSheet item = customerSettleCheckSheetService.getById(id); + int count = customerSettleCheckSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,无法重复结算!"); + } + } + + @Override + public List getUnSettleBizItems(QueryCustomerUnSettleBizItemVo vo) { + + List results = new ArrayList<>(); + + List sheetList = customerSettleCheckSheetService.getApprovedList( + vo.getCustomerId(), + vo.getStartTime(), vo.getEndTime()); + + if (!CollectionUtil.isEmpty(sheetList)) { + for (CustomerSettleCheckSheet item : sheetList) { + CustomerSettleBizItemDto result = new CustomerSettleBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalPayAmount(item.getTotalPayAmount()); + result.setTotalPayedAmount(item.getTotalPayedAmount()); + result.setTotalDiscountAmount(item.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(item.getTotalPayAmount(), item.getTotalPayedAmount(), + item.getTotalDiscountAmount())); + result.setApproveTime(item.getApproveTime()); + + results.add(result); + } + } + + return results; + } + + private void create(CustomerSettleSheet sheet, CreateCustomerSettleSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalDiscountAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (CustomerSettleSheetItemVo itemVo : vo.getItems()) { + CustomerSettleBizItemDto item = this.getBizItem(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + + if (NumberUtil.lt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额不允许大于0!"); + } + + if (NumberUtil.gt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许大于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额、优惠金额不能同时等于0!"); + } + + if (NumberUtil.gt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException("第" + orderNo + "行实收金额与优惠金额相加不允许小于未收款金额!"); + } + } else if (NumberUtil.gt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额不允许小于0!"); + } + + if (NumberUtil.lt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许小于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额、优惠金额不能同时等于0!"); + } + if (NumberUtil.lt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException("第" + orderNo + "行实收金额与优惠金额相加不允许大于未收款金额!"); + } + } else { + // 单据应收款等于0 + if (!NumberUtil.equal(itemVo.getPayAmount(), 0) || !NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实收金额、优惠金额必须同时等于0!"); + } + } + + CustomerSettleSheetDetail detail = new CustomerSettleSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDiscountAmount(itemVo.getDiscountAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + customerSettleSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, itemVo.getPayAmount()); + totalDiscountAmount = NumberUtil.add(totalDiscountAmount, itemVo.getDiscountAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setCustomerId(vo.getCustomerId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalDiscountAmount(totalDiscountAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetDetailServiceImpl.java new file mode 100644 index 0000000..e540c35 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetDetailServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; +import com.lframework.xingyun.settle.mappers.SettleCheckSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettleCheckSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettleCheckSheetDetailServiceImpl + extends BaseMpServiceImpl + implements SettleCheckSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetServiceImpl.java new file mode 100644 index 0000000..96d593e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleCheckSheetServiceImpl.java @@ -0,0 +1,799 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.entity.PurchaseReturn; +import com.lframework.xingyun.sc.entity.ReceiveSheet; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.sc.service.purchase.PurchaseReturnService; +import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetCalcType; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.SettleCheckSheetMapper; +import com.lframework.xingyun.settle.service.SettleCheckSheetDetailService; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import com.lframework.xingyun.settle.service.SettleFeeSheetService; +import com.lframework.xingyun.settle.service.SettlePreSheetService; +import com.lframework.xingyun.settle.vo.check.ApprovePassSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.ApproveRefuseSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.BatchApprovePassSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.BatchApproveRefuseSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.CreateSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.QuerySettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.QueryUnCheckBizItemVo; +import com.lframework.xingyun.settle.vo.check.SettleCheckSheetItemVo; +import com.lframework.xingyun.settle.vo.check.UpdateSettleCheckSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SettleCheckSheetServiceImpl extends BaseMpServiceImpl + implements SettleCheckSheetService { + + @Autowired + private SettleCheckSheetDetailService settleCheckSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private ReceiveSheetService receiveSheetService; + + @Autowired + private PurchaseReturnService purchaseReturnService; + + @Autowired + private SettleFeeSheetService settleFeeSheetService; + + @Autowired + private SettlePreSheetService settlePreSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySettleCheckSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleCheckSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettleCheckSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = new SettleCheckSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_CHECK_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettleCheckSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改对账单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED + && sheet.getStatus() != SettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商对账单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商对账单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleCheckSheetDetail::getOrderNo); + List sheetDetails = settleCheckSheetDetailService.list(queryDetailWrapper); + for (SettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()); + settleCheckSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettleCheckSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettleCheckSheetStatus.CREATED); + statusList.add(SettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getApproveBy, null).set(SettleCheckSheet::getApproveTime, null) + .set(SettleCheckSheet::getRefuseReason, StringPool.EMPTY_STR).eq(SettleCheckSheet::getId, sheet.getId()) + .in(SettleCheckSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED + && sheet.getStatus() != SettleCheckSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商对账单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商对账单无法审核通过!"); + } + + sheet.setStatus(SettleCheckSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettleCheckSheetStatus.CREATED); + statusList.add(SettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .eq(SettleCheckSheet::getId, sheet.getId()).in(SettleCheckSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettleCheckSheetVo vo) { + + SettleCheckSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettleCheckSheetVo approveVo = new ApprovePassSettleCheckSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettleCheckSheetVo vo) { + + SettleCheckSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED) { + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商对账单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商对账单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商对账单无法审核拒绝!"); + } + + sheet.setStatus(SettleCheckSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettleCheckSheetStatus.CREATED); + statusList.add(SettleCheckSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .eq(SettleCheckSheet::getId, sheet.getId()).in(SettleCheckSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商对账单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassSettleCheckSheetVo vo) { + + SettleCheckSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassSettleCheckSheetVo approveVo = new ApprovePassSettleCheckSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商对账单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseSettleCheckSheetVo vo) { + + SettleCheckSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseSettleCheckSheetVo approveVo = new ApproveRefuseSettleCheckSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商对账单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除供应商对账单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettleCheckSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商对账单不存在!"); + } + + if (sheet.getStatus() != SettleCheckSheetStatus.CREATED + && sheet.getStatus() != SettleCheckSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettleCheckSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商对账单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商对账单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleCheckSheetDetail::getOrderNo); + List sheetDetails = settleCheckSheetDetailService.list(queryDetailWrapper); + for (SettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, sheet.getId()); + settleCheckSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + SettleCheckSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商对账单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Override + public SettleCheckBizItemDto getBizItem(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + + switch (bizType) { + case RECEIVE_SHEET: { + ReceiveSheet receiveSheet = receiveSheetService.getById(id); + + result.setId(receiveSheet.getId()); + result.setCode(receiveSheet.getCode()); + result.setTotalAmount(receiveSheet.getTotalAmount()); + result.setApproveTime(receiveSheet.getApproveTime()); + result.setCalcType(SettleCheckSheetCalcType.ADD); + break; + } + case PURCHASE_RETURN: { + PurchaseReturn purchaseReturn = purchaseReturnService.getById(id); + + result.setId(purchaseReturn.getId()); + result.setCode(purchaseReturn.getCode()); + result.setTotalAmount(purchaseReturn.getTotalAmount()); + result.setApproveTime(purchaseReturn.getApproveTime()); + result.setCalcType(SettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_FEE_SHEET: { + SettleFeeSheet feeSheet = settleFeeSheetService.getById(id); + + result.setId(feeSheet.getId()); + result.setCode(feeSheet.getCode()); + result.setTotalAmount(feeSheet.getTotalAmount()); + result.setApproveTime(feeSheet.getApproveTime()); + result.setCalcType(feeSheet.getSheetType() == SettleFeeSheetType.PAY ? + SettleCheckSheetCalcType.ADD : + SettleCheckSheetCalcType.SUB); + break; + } + case SETTLE_PRE_SHEET: { + SettlePreSheet preSheet = settlePreSheetService.getById(id); + + result.setId(preSheet.getId()); + result.setCode(preSheet.getCode()); + result.setTotalAmount(preSheet.getTotalAmount()); + result.setApproveTime(preSheet.getApproveTime()); + result.setCalcType(SettleCheckSheetCalcType.SUB); + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + + result.setBizType(bizType); + if (result.getCalcType() == SettleCheckSheetCalcType.SUB) { + result.setTotalAmount(result.getTotalAmount().negate()); + } + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case RECEIVE_SHEET: { + int count = receiveSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case PURCHASE_RETURN: { + int count = purchaseReturnService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = settleFeeSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = settlePreSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case RECEIVE_SHEET: { + int count = receiveSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case PURCHASE_RETURN: { + int count = purchaseReturnService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = settleFeeSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = settlePreSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,业务无法进行!"); + } + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id, SettleCheckSheetBizType bizType) { + + SettleCheckBizItemDto item = this.getBizItem(id, bizType); + + switch (bizType) { + case RECEIVE_SHEET: { + int count = receiveSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case PURCHASE_RETURN: { + int count = purchaseReturnService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_FEE_SHEET: { + int count = settleFeeSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + case SETTLE_PRE_SHEET: { + int count = settlePreSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "," + bizType.getDesc() + "已结算,无法重复结算!"); + } + break; + } + default: { + throw new DefaultSysException("未知的SettleCheckSheetBizType"); + } + } + } + + @Override + public List getUnCheckBizItems(QueryUnCheckBizItemVo vo) { + + List results = new ArrayList<>(); + + List receiveSheetList = receiveSheetService.getApprovedList(vo.getSupplierId(), vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List purchaseReturnList = purchaseReturnService.getApprovedList(vo.getSupplierId(), + vo.getStartTime(), vo.getEndTime(), SettleStatus.UN_SETTLE); + + List feeSheetList = settleFeeSheetService.getApprovedList(vo.getSupplierId(), vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + List preSheetList = settlePreSheetService.getApprovedList(vo.getSupplierId(), vo.getStartTime(), + vo.getEndTime(), SettleStatus.UN_SETTLE); + + if (!CollectionUtil.isEmpty(receiveSheetList)) { + for (ReceiveSheet item : receiveSheetList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.RECEIVE_SHEET); + result.setCalcType(SettleCheckSheetCalcType.ADD); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(purchaseReturnList)) { + for (PurchaseReturn item : purchaseReturnList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.PURCHASE_RETURN); + result.setCalcType(SettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(feeSheetList)) { + for (SettleFeeSheet item : feeSheetList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.SETTLE_FEE_SHEET); + result.setCalcType(item.getSheetType() == SettleFeeSheetType.PAY ? + SettleCheckSheetCalcType.ADD : + SettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + if (!CollectionUtil.isEmpty(preSheetList)) { + for (SettlePreSheet item : preSheetList) { + SettleCheckBizItemDto result = new SettleCheckBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalAmount(item.getTotalAmount()); + result.setApproveTime(item.getApproveTime()); + result.setBizType(SettleCheckSheetBizType.SETTLE_PRE_SHEET); + result.setCalcType(SettleCheckSheetCalcType.SUB); + + results.add(result); + } + } + + results.stream().filter(t -> t.getCalcType() == SettleCheckSheetCalcType.SUB) + .forEach(t -> t.setTotalAmount(t.getTotalAmount().negate())); + + return results; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(SettleCheckSheet::getId, id) + .eq(SettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getSettleStatus, SettleStatus.PART_SETTLE).eq(SettleCheckSheet::getId, id) + .in(SettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getSettleStatus, SettleStatus.SETTLED).eq(SettleCheckSheet::getId, id) + .in(SettleCheckSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleCheckSheetDetail.class) + .eq(SettleCheckSheetDetail::getSheetId, id).orderByAsc(SettleCheckSheetDetail::getOrderNo); + List sheetDetails = settleCheckSheetDetailService.list(queryDetailWrapper); + for (SettleCheckSheetDetail sheetDetail : sheetDetails) { + this.setBizItemSettled(sheetDetail.getBizId(), sheetDetail.getBizType()); + } + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setSettleAmount(String id, BigDecimal totalPayedAmount, BigDecimal totalDiscountAmount) { + + SettleCheckSheet checkSheet = getBaseMapper().selectById(id); + BigDecimal remainTotalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), + checkSheet.getTotalPayedAmount(), checkSheet.getTotalDiscountAmount(), totalPayedAmount, + totalDiscountAmount); + BigDecimal totalPayAmount = NumberUtil.sub(checkSheet.getTotalPayAmount(), checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount()); + if (NumberUtil.lt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余付款金额为" + totalPayAmount + "元,本次付款金额为" + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + if (NumberUtil.gt(checkSheet.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(remainTotalPayAmount, 0)) { + throw new DefaultClientException( + "对账单:" + checkSheet.getCode() + ",剩余付款金额为" + totalPayAmount + "元,本次付款金额为" + NumberUtil.add( + totalPayedAmount, totalDiscountAmount) + "元,无法结算!"); + } + } + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleCheckSheet.class) + .set(SettleCheckSheet::getTotalPayedAmount, + NumberUtil.add(totalPayedAmount, checkSheet.getTotalPayedAmount())) + .set(SettleCheckSheet::getTotalDiscountAmount, + NumberUtil.add(totalDiscountAmount, checkSheet.getTotalDiscountAmount())) + .eq(SettleCheckSheet::getId, id) + .eq(SettleCheckSheet::getTotalPayedAmount, checkSheet.getTotalPayedAmount()) + .eq(SettleCheckSheet::getTotalDiscountAmount, checkSheet.getTotalDiscountAmount()); + if (getBaseMapper().update(updateWrapper) != 1) { + throw new DefaultClientException("结账单:" + checkSheet.getCode() + ",信息已过期,请刷新重试!"); + } + + if (NumberUtil.equal(remainTotalPayAmount, 0)) { + this.setSettled(id); + } + } + + private void create(SettleCheckSheet sheet, CreateSettleCheckSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalPayAmount = BigDecimal.ZERO; + + int orderNo = 0; + for (SettleCheckSheetItemVo itemVo : vo.getItems()) { + orderNo++; + SettleCheckBizItemDto item = this.getBizItem(itemVo.getId(), + EnumUtil.getByCode(SettleCheckSheetBizType.class, itemVo.getBizType())); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + SettleCheckSheetDetail detail = new SettleCheckSheetDetail(); + + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setBizType(EnumUtil.getByCode(SettleCheckSheetBizType.class, itemVo.getBizType())); + detail.setCalcType(item.getCalcType()); + if (item.getCalcType() == SettleCheckSheetCalcType.ADD) { + if (NumberUtil.lt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应付金额不允许小于0!"); + } + } else { + if (NumberUtil.gt(itemVo.getPayAmount(), BigDecimal.ZERO)) { + throw new DefaultClientException("第" + orderNo + "行业务单据应付金额不允许大于0!"); + } + } + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + settleCheckSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, item.getTotalAmount()); + totalPayAmount = NumberUtil.add(totalPayAmount, itemVo.getPayAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId(), detail.getBizType()); + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalPayAmount(totalPayAmount); + sheet.setTotalPayedAmount(BigDecimal.ZERO); + sheet.setTotalDiscountAmount(BigDecimal.ZERO); + sheet.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetDetailServiceImpl.java new file mode 100644 index 0000000..cf9fb3e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetDetailServiceImpl.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; +import com.lframework.xingyun.settle.mappers.SettleFeeSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettleFeeSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettleFeeSheetDetailServiceImpl extends BaseMpServiceImpl + implements SettleFeeSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetServiceImpl.java new file mode 100644 index 0000000..6dbb10f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleFeeSheetServiceImpl.java @@ -0,0 +1,440 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.SettleFeeSheetMapper; +import com.lframework.xingyun.settle.service.SettleFeeSheetDetailService; +import com.lframework.xingyun.settle.service.SettleFeeSheetService; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.fee.ApprovePassSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.ApproveRefuseSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.BatchApprovePassSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.BatchApproveRefuseSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.CreateSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.QuerySettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.SettleFeeSheetItemVo; +import com.lframework.xingyun.settle.vo.fee.UpdateSettleFeeSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SettleFeeSheetServiceImpl extends BaseMpServiceImpl + implements SettleFeeSheetService { + + @Autowired + private SettleFeeSheetDetailService settleFeeSheetDetailService; + + @Autowired + private SettleOutItemService settleOutItemService; + + @Autowired + private SettleInItemService settleInItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySettleFeeSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleFeeSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettleFeeSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = new SettleFeeSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_FEE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettleFeeSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改费用单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED + && sheet.getStatus() != SettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商费用单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商费用单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleFeeSheetDetail.class) + .eq(SettleFeeSheetDetail::getSheetId, sheet.getId()); + settleFeeSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettleFeeSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettleFeeSheetStatus.CREATED); + statusList.add(SettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getApproveBy, null).set(SettleFeeSheet::getApproveTime, null) + .set(SettleFeeSheet::getRefuseReason, StringPool.EMPTY_STR).eq(SettleFeeSheet::getId, sheet.getId()) + .in(SettleFeeSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED + && sheet.getStatus() != SettleFeeSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商费用单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商费用单无法审核通过!"); + } + + sheet.setStatus(SettleFeeSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettleFeeSheetStatus.CREATED); + statusList.add(SettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .eq(SettleFeeSheet::getId, sheet.getId()).in(SettleFeeSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettleFeeSheetVo vo) { + + SettleFeeSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettleFeeSheetVo approveVo = new ApprovePassSettleFeeSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettleFeeSheetVo vo) { + + SettleFeeSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED) { + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商费用单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商费用单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商费用单无法审核拒绝!"); + } + + sheet.setStatus(SettleFeeSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettleFeeSheetStatus.CREATED); + statusList.add(SettleFeeSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .eq(SettleFeeSheet::getId, sheet.getId()).in(SettleFeeSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商费用单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassSettleFeeSheetVo vo) { + + SettleFeeSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassSettleFeeSheetVo approveVo = new ApprovePassSettleFeeSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商费用单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseSettleFeeSheetVo vo) { + + SettleFeeSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseSettleFeeSheetVo approveVo = new ApproveRefuseSettleFeeSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商费用单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除供应商费用单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettleFeeSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商费用单不存在!"); + } + + if (sheet.getStatus() != SettleFeeSheetStatus.CREATED + && sheet.getStatus() != SettleFeeSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettleFeeSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商费用单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商费用单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleFeeSheetDetail.class) + .eq(SettleFeeSheetDetail::getSheetId, sheet.getId()); + settleFeeSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + SettleFeeSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商费用单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(SettleFeeSheet::getId, id) + .eq(SettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getSettleStatus, SettleStatus.PART_SETTLE).eq(SettleFeeSheet::getId, id) + .in(SettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleFeeSheet.class) + .set(SettleFeeSheet::getSettleStatus, SettleStatus.SETTLED).eq(SettleFeeSheet::getId, id) + .in(SettleFeeSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(SettleFeeSheet sheet, CreateSettleFeeSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SettleFeeSheetItemVo itemVo : vo.getItems()) { + if (vo.getSheetType() == SettleFeeSheetType.RECEIVE.getCode().intValue()) { + SettleInItem item = settleInItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } else { + SettleOutItem item = settleOutItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + } + SettleFeeSheetDetail detail = new SettleFeeSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + settleFeeSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setSheetType(EnumUtil.getByCode(SettleFeeSheetType.class, vo.getSheetType())); + sheet.setTotalAmount(totalAmount); + sheet.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleInItemServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleInItemServiceImpl.java new file mode 100644 index 0000000..efe5e3c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleInItemServiceImpl.java @@ -0,0 +1,166 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.SettleInItemMapper; +import com.lframework.xingyun.settle.service.SettleInItemService; +import com.lframework.xingyun.settle.vo.item.in.CreateSettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.in.UpdateSettleInItemVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SettleInItemServiceImpl extends BaseMpServiceImpl + implements SettleInItemService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySettleInItemVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleInItemVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, SettleInItemSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SettleInItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SettleInItem findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "停用收入项目,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleInItem.class) + .set(SettleInItem::getAvailable, Boolean.FALSE).in(SettleInItem::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "启用收入项目,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleInItem.class) + .set(SettleInItem::getAvailable, Boolean.TRUE).in(SettleInItem::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "新增收入项目,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleInItemVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleInItem.class) + .eq(SettleInItem::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + SettleInItem data = new SettleInItem(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改收入项目,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleInItemVo vo) { + + SettleInItem data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("收入项目不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleInItem.class) + .eq(SettleInItem::getCode, vo.getCode()).ne(SettleInItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SettleInItem.class) + .set(SettleInItem::getCode, vo.getCode()).set(SettleInItem::getName, vo.getName()) + .set(SettleInItem::getAvailable, vo.getAvailable()).set(SettleInItem::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(SettleInItem::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = SettleInItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleOutItemServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleOutItemServiceImpl.java new file mode 100644 index 0000000..cca164a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleOutItemServiceImpl.java @@ -0,0 +1,166 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.mappers.SettleOutItemMapper; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.vo.item.out.CreateSettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.out.UpdateSettleOutItemVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SettleOutItemServiceImpl extends BaseMpServiceImpl + implements SettleOutItemService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySettleOutItemVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleOutItemVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, SettleOutItemSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SettleOutItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SettleOutItem findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "停用支出项目,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleOutItem.class) + .set(SettleOutItem::getAvailable, Boolean.FALSE).in(SettleOutItem::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "启用支出项目,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleOutItem.class) + .set(SettleOutItem::getAvailable, Boolean.TRUE).in(SettleOutItem::getId, ids); + getBaseMapper().update(updateWrapper); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "新增支出项目,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleOutItemVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleOutItem.class) + .eq(SettleOutItem::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + SettleOutItem data = new SettleOutItem(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setAvailable(Boolean.TRUE); + data.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改支出项目,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleOutItemVo vo) { + + SettleOutItem data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("支出项目不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(SettleOutItem.class) + .eq(SettleOutItem::getCode, vo.getCode()).ne(SettleOutItem::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SettleOutItem.class) + .set(SettleOutItem::getCode, vo.getCode()).set(SettleOutItem::getName, vo.getName()) + .set(SettleOutItem::getAvailable, vo.getAvailable()).set(SettleOutItem::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(SettleOutItem::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @CacheEvict(value = SettleOutItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetDetailServiceImpl.java new file mode 100644 index 0000000..8745c01 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetDetailServiceImpl.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; +import com.lframework.xingyun.settle.mappers.SettlePreSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettlePreSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettlePreSheetDetailServiceImpl extends BaseMpServiceImpl + implements SettlePreSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetServiceImpl.java new file mode 100644 index 0000000..eafaf65 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettlePreSheetServiceImpl.java @@ -0,0 +1,426 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import com.lframework.xingyun.settle.mappers.SettlePreSheetMapper; +import com.lframework.xingyun.settle.service.SettleOutItemService; +import com.lframework.xingyun.settle.service.SettlePreSheetDetailService; +import com.lframework.xingyun.settle.service.SettlePreSheetService; +import com.lframework.xingyun.settle.vo.pre.ApprovePassSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.ApproveRefuseSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.BatchApprovePassSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.BatchApproveRefuseSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.CreateSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.QuerySettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.SettlePreSheetItemVo; +import com.lframework.xingyun.settle.vo.pre.UpdateSettlePreSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SettlePreSheetServiceImpl extends BaseMpServiceImpl + implements SettlePreSheetService { + + @Autowired + private SettlePreSheetDetailService settlePreSheetDetailService; + + @Autowired + private SettleOutItemService settleOutItemService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySettlePreSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettlePreSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettlePreSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建预付款单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettlePreSheetVo vo) { + + SettlePreSheet sheet = new SettlePreSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_PRE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettlePreSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改预付款单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettlePreSheetVo vo) { + + SettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED + && sheet.getStatus() != SettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商预付款单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商预付款单无法修改!"); + } + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettlePreSheetDetail.class) + .eq(SettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettlePreSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettlePreSheetStatus.CREATED); + statusList.add(SettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getApproveBy, null).set(SettlePreSheet::getApproveTime, null) + .set(SettlePreSheet::getRefuseReason, StringPool.EMPTY_STR).eq(SettlePreSheet::getId, sheet.getId()) + .in(SettlePreSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettlePreSheetVo vo) { + + SettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED + && sheet.getStatus() != SettlePreSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商预付款单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商预付款单无法审核通过!"); + } + + sheet.setStatus(SettlePreSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettlePreSheetStatus.CREATED); + statusList.add(SettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .eq(SettlePreSheet::getId, sheet.getId()).in(SettlePreSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettlePreSheetVo vo) { + + SettlePreSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettlePreSheetVo approveVo = new ApprovePassSettlePreSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettlePreSheetVo vo) { + + SettlePreSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED) { + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商预付款单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商预付款单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商预付款单无法审核拒绝!"); + } + + sheet.setStatus(SettlePreSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettlePreSheetStatus.CREATED); + statusList.add(SettlePreSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .eq(SettlePreSheet::getId, sheet.getId()).in(SettlePreSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商预付款单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassSettlePreSheetVo vo) { + + SettlePreSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassSettlePreSheetVo approveVo = new ApprovePassSettlePreSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商预付款单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseSettlePreSheetVo vo) { + + SettlePreSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseSettlePreSheetVo approveVo = new ApproveRefuseSettlePreSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商预付款单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除供应商预付款单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettlePreSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商预付款单不存在!"); + } + + if (sheet.getStatus() != SettlePreSheetStatus.CREATED + && sheet.getStatus() != SettlePreSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettlePreSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商预付款单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商预付款单无法删除!"); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettlePreSheetDetail.class) + .eq(SettlePreSheetDetail::getSheetId, sheet.getId()); + settlePreSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + SettlePreSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商预付款单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setUnSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE).eq(SettlePreSheet::getId, id) + .eq(SettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setPartSettle(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getSettleStatus, SettleStatus.PART_SETTLE).eq(SettlePreSheet::getId, id) + .in(SettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public int setSettled(String id) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettlePreSheet.class) + .set(SettlePreSheet::getSettleStatus, SettleStatus.SETTLED).eq(SettlePreSheet::getId, id) + .in(SettlePreSheet::getSettleStatus, SettleStatus.UN_SETTLE, SettleStatus.PART_SETTLE); + int count = getBaseMapper().update(updateWrapper); + + return count; + } + + @Override + public List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime, + SettleStatus settleStatus) { + + return getBaseMapper().getApprovedList(supplierId, startTime, endTime, settleStatus); + } + + private void create(SettlePreSheet sheet, CreateSettlePreSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SettlePreSheetItemVo itemVo : vo.getItems()) { + SettleOutItem item = settleOutItemService.findById(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行项目不存在!"); + } + SettlePreSheetDetail detail = new SettlePreSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setItemId(itemVo.getId()); + detail.setAmount(itemVo.getAmount()); + detail.setOrderNo(orderNo); + + settlePreSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, detail.getAmount()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setTotalAmount(totalAmount); + sheet.setDescription(StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setSettleStatus(SettleStatus.UN_SETTLE); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetDetailServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetDetailServiceImpl.java new file mode 100644 index 0000000..80fa401 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetDetailServiceImpl.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.settle.impl; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; +import com.lframework.xingyun.settle.mappers.SettleSheetDetailMapper; +import com.lframework.xingyun.settle.service.SettleSheetDetailService; +import org.springframework.stereotype.Service; + +@Service +public class SettleSheetDetailServiceImpl extends BaseMpServiceImpl + implements SettleSheetDetailService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetServiceImpl.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetServiceImpl.java new file mode 100644 index 0000000..3c1debb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/impl/SettleSheetServiceImpl.java @@ -0,0 +1,542 @@ +package com.lframework.xingyun.settle.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.core.annations.OrderTimeLineLog; +import com.lframework.xingyun.core.enums.OrderTimeLineBizType; +import com.lframework.xingyun.settle.components.code.GenerateCodeTypePool; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; +import com.lframework.xingyun.settle.enums.SettleOpLogType; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import com.lframework.xingyun.settle.mappers.SettleSheetMapper; +import com.lframework.xingyun.settle.service.SettleCheckSheetService; +import com.lframework.xingyun.settle.service.SettleSheetDetailService; +import com.lframework.xingyun.settle.service.SettleSheetService; +import com.lframework.xingyun.settle.vo.sheet.ApprovePassSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.ApproveRefuseSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.BatchApprovePassSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.BatchApproveRefuseSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.CreateSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.QuerySettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.QueryUnSettleBizItemVo; +import com.lframework.xingyun.settle.vo.sheet.SettleSheetItemVo; +import com.lframework.xingyun.settle.vo.sheet.UpdateSettleSheetVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SettleSheetServiceImpl extends BaseMpServiceImpl + implements SettleSheetService { + + @Autowired + private SettleSheetDetailService settleSheetDetailService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private SettleCheckSheetService settleCheckSheetService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySettleSheetVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySettleSheetVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public SettleSheetFullDto getDetail(String id) { + + return getBaseMapper().getDetail(id); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "创建供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.CREATE, orderId = "#_result", name = "创建结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSettleSheetVo vo) { + + SettleSheet sheet = new SettleSheet(); + + sheet.setId(IdUtil.getId()); + sheet.setCode(generateCodeService.generate(GenerateCodeTypePool.SETTLE_SHEET)); + + this.create(sheet, vo); + + sheet.setStatus(SettleSheetStatus.CREATED); + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + + getBaseMapper().insert(sheet); + + return sheet.getId(); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "修改供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.UPDATE, orderId = "#vo.id", name = "修改结算单") + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSettleSheetVo vo) { + + SettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED + && sheet.getStatus() != SettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商结算单已审核通过,无法修改!"); + } else { + throw new DefaultClientException("供应商结算单无法修改!"); + } + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleSheetDetail::getOrderNo); + List sheetDetails = settleSheetDetailService.list(queryDetailWrapper); + for (SettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()); + settleSheetDetailService.remove(deleteDetailWrapper); + + this.create(sheet, vo); + + sheet.setStatus(SettleSheetStatus.CREATED); + + List statusList = new ArrayList<>(); + statusList.add(SettleSheetStatus.CREATED); + statusList.add(SettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleSheet.class) + .set(SettleSheet::getApproveBy, null).set(SettleSheet::getApproveTime, null) + .set(SettleSheet::getRefuseReason, StringPool.EMPTY_STR) + .eq(SettleSheet::getId, sheet.getId()) + .in(SettleSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核通过供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.id", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void approvePass(ApprovePassSettleSheetVo vo) { + + SettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED + && sheet.getStatus() != SettleSheetStatus.APPROVE_REFUSE) { + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商结算单已审核通过,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商结算单无法审核通过!"); + } + + sheet.setStatus(SettleSheetStatus.APPROVE_PASS); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + if (!StringUtil.isBlank(vo.getDescription())) { + sheet.setDescription(vo.getDescription()); + } + + List statusList = new ArrayList<>(); + statusList.add(SettleSheetStatus.CREATED); + statusList.add(SettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleSheet.class) + .eq(SettleSheet::getId, sheet.getId()).in(SettleSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商结算单信息已过期,请刷新重试!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleSheetDetail::getOrderNo); + List details = settleSheetDetailService.list(queryDetailWrapper); + for (SettleSheetDetail detail : details) { + settleCheckSheetService.setSettleAmount(detail.getBizId(), detail.getPayAmount(), + detail.getDiscountAmount()); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#_result", name = "直接审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public String directApprovePass(CreateSettleSheetVo vo) { + + SettleSheetService thisService = getThis(this.getClass()); + + String id = thisService.create(vo); + + ApprovePassSettleSheetVo approveVo = new ApprovePassSettleSheetVo(); + approveVo.setId(id); + + thisService.approvePass(approveVo); + + return id; + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "审核拒绝供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.id", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void approveRefuse(ApproveRefuseSettleSheetVo vo) { + + SettleSheet sheet = getBaseMapper().selectById(vo.getId()); + if (sheet == null) { + throw new DefaultClientException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED) { + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("供应商结算单已审核通过,不允许继续执行审核!"); + } + if (sheet.getStatus() == SettleSheetStatus.APPROVE_REFUSE) { + throw new DefaultClientException("供应商结算单已审核拒绝,不允许继续执行审核!"); + } + throw new DefaultClientException("供应商结算单无法审核拒绝!"); + } + + sheet.setStatus(SettleSheetStatus.APPROVE_REFUSE); + sheet.setApproveBy(SecurityUtil.getCurrentUser().getId()); + sheet.setApproveTime(LocalDateTime.now()); + sheet.setRefuseReason(vo.getRefuseReason()); + + List statusList = new ArrayList<>(); + statusList.add(SettleSheetStatus.CREATED); + statusList.add(SettleSheetStatus.APPROVE_REFUSE); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SettleSheet.class) + .eq(SettleSheet::getId, sheet.getId()).in(SettleSheet::getStatus, statusList); + if (getBaseMapper().updateAllColumn(sheet, updateWrapper) != 1) { + throw new DefaultClientException("供应商结算单信息已过期,请刷新重试!"); + } + + OpLogUtil.setVariable("code", sheet.getCode()); + OpLogUtil.setExtra(vo); + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_PASS, orderId = "#vo.ids", name = "审核通过") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApprovePass(BatchApprovePassSettleSheetVo vo) { + + SettleSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApprovePassSettleSheetVo approveVo = new ApprovePassSettleSheetVo(); + approveVo.setId(id); + try { + thisService.approvePass(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商结算单审核通过失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OrderTimeLineLog(type = OrderTimeLineBizType.APPROVE_RETURN, orderId = "#vo.ids", name = "审核拒绝,拒绝理由:{}", params = "#vo.refuseReason") + @Transactional(rollbackFor = Exception.class) + @Override + public void batchApproveRefuse(BatchApproveRefuseSettleSheetVo vo) { + + SettleSheetService thisService = getThis(this.getClass()); + int orderNo = 1; + for (String id : vo.getIds()) { + ApproveRefuseSettleSheetVo approveVo = new ApproveRefuseSettleSheetVo(); + approveVo.setId(id); + approveVo.setRefuseReason(vo.getRefuseReason()); + + try { + thisService.approveRefuse(approveVo); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商结算单审核拒绝失败,失败原因:" + e.getMsg()); + } + orderNo++; + } + } + + @OpLog(type = SettleOpLogType.SETTLE, name = "删除供应商结算单,单号:{}", params = "#code") + @OrderTimeLineLog(orderId = "#id", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Assert.notBlank(id); + SettleSheet sheet = getBaseMapper().selectById(id); + if (sheet == null) { + throw new InputErrorException("供应商结算单不存在!"); + } + + if (sheet.getStatus() != SettleSheetStatus.CREATED + && sheet.getStatus() != SettleSheetStatus.APPROVE_REFUSE) { + + if (sheet.getStatus() == SettleSheetStatus.APPROVE_PASS) { + throw new DefaultClientException("“审核通过”的供应商结算单不允许执行删除操作!"); + } + + throw new DefaultClientException("供应商结算单无法删除!"); + } + + //将所有的单据的结算状态更新 + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()).orderByAsc(SettleSheetDetail::getOrderNo); + List sheetDetails = settleSheetDetailService.list(queryDetailWrapper); + for (SettleSheetDetail sheetDetail : sheetDetails) { + this.setBizItemUnSettle(sheetDetail.getBizId()); + } + + // 删除明细 + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(SettleSheetDetail.class) + .eq(SettleSheetDetail::getSheetId, sheet.getId()); + settleSheetDetailService.remove(deleteDetailWrapper); + + // 删除单据 + getBaseMapper().deleteById(id); + + OpLogUtil.setVariable("code", sheet.getCode()); + } + + @OrderTimeLineLog(orderId = "#ids", delete = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByIds(List ids) { + + if (!CollectionUtil.isEmpty(ids)) { + int orderNo = 1; + for (String id : ids) { + + try { + SettleSheetService thisService = getThis(this.getClass()); + thisService.deleteById(id); + } catch (ClientException e) { + throw new DefaultClientException("第" + orderNo + "个供应商结算单删除失败,失败原因:" + e.getMsg()); + } + + orderNo++; + } + } + } + + @Override + public SettleBizItemDto getBizItem(String id) { + + SettleCheckSheet checkSheet = settleCheckSheetService.getById(id); + + SettleBizItemDto result = new SettleBizItemDto(); + result.setId(checkSheet.getId()); + result.setCode(checkSheet.getCode()); + result.setTotalPayAmount(checkSheet.getTotalPayAmount()); + result.setTotalPayedAmount(checkSheet.getTotalPayedAmount()); + result.setTotalDiscountAmount(checkSheet.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(checkSheet.getTotalPayAmount(), checkSheet.getTotalPayedAmount(), + checkSheet.getTotalDiscountAmount())); + result.setApproveTime(checkSheet.getApproveTime()); + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemUnSettle(String id) { + + SettleCheckSheet item = settleCheckSheetService.getById(id); + int count = settleCheckSheetService.setUnSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemPartSettle(String id) { + + SettleCheckSheet item = settleCheckSheetService.getById(id); + int count = settleCheckSheetService.setPartSettle(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,业务无法进行!"); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setBizItemSettled(String id) { + + SettleCheckSheet item = settleCheckSheetService.getById(id); + int count = settleCheckSheetService.setSettled(id); + if (count != 1) { + throw new DefaultClientException("单号:" + item.getCode() + "已结算,无法重复结算!"); + } + } + + @Override + public List getUnSettleBizItems(QueryUnSettleBizItemVo vo) { + + List results = new ArrayList<>(); + + List sheetList = settleCheckSheetService.getApprovedList(vo.getSupplierId(), + vo.getStartTime(), vo.getEndTime()); + + if (!CollectionUtil.isEmpty(sheetList)) { + for (SettleCheckSheet item : sheetList) { + SettleBizItemDto result = new SettleBizItemDto(); + result.setId(item.getId()); + result.setCode(item.getCode()); + result.setTotalPayAmount(item.getTotalPayAmount()); + result.setTotalPayedAmount(item.getTotalPayedAmount()); + result.setTotalDiscountAmount(item.getTotalDiscountAmount()); + result.setTotalUnPayAmount( + NumberUtil.sub(item.getTotalPayAmount(), item.getTotalPayedAmount(), + item.getTotalDiscountAmount())); + result.setApproveTime(item.getApproveTime()); + + results.add(result); + } + } + + return results; + } + + private void create(SettleSheet sheet, CreateSettleSheetVo vo) { + + BigDecimal totalAmount = BigDecimal.ZERO; + BigDecimal totalDiscountAmount = BigDecimal.ZERO; + + int orderNo = 1; + for (SettleSheetItemVo itemVo : vo.getItems()) { + SettleBizItemDto item = this.getBizItem(itemVo.getId()); + if (item == null) { + throw new DefaultClientException("第" + orderNo + "行业务单据不存在!"); + } + + if (NumberUtil.lt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.gt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额不允许大于0!"); + } + + if (NumberUtil.gt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许大于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额、优惠金额不能同时等于0!"); + } + + if (NumberUtil.gt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException("第" + orderNo + "行实付金额与优惠金额相加不允许小于未付款金额!"); + } + } else if (NumberUtil.gt(item.getTotalPayAmount(), 0)) { + if (NumberUtil.lt(itemVo.getPayAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额不允许小于0!"); + } + + if (NumberUtil.lt(itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行优惠金额不允许小于0!"); + } + + if (NumberUtil.equal(itemVo.getPayAmount(), 0) && NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额、优惠金额不能同时等于0!"); + } + if (NumberUtil.lt(item.getTotalUnPayAmount(), + NumberUtil.add(itemVo.getPayAmount(), itemVo.getDiscountAmount()))) { + throw new DefaultClientException("第" + orderNo + "行实付金额与优惠金额相加不允许大于未付款金额!"); + } + } else { + // 单据应付款等于0 + if (!NumberUtil.equal(itemVo.getPayAmount(), 0) || !NumberUtil.equal( + itemVo.getDiscountAmount(), 0)) { + throw new DefaultClientException("第" + orderNo + "行实付金额、优惠金额必须同时等于0!"); + } + } + + SettleSheetDetail detail = new SettleSheetDetail(); + detail.setId(IdUtil.getId()); + detail.setSheetId(sheet.getId()); + detail.setBizId(itemVo.getId()); + detail.setPayAmount(itemVo.getPayAmount()); + detail.setDiscountAmount(itemVo.getDiscountAmount()); + detail.setDescription(itemVo.getDescription()); + detail.setOrderNo(orderNo); + + settleSheetDetailService.save(detail); + + totalAmount = NumberUtil.add(totalAmount, itemVo.getPayAmount()); + totalDiscountAmount = NumberUtil.add(totalDiscountAmount, itemVo.getDiscountAmount()); + + //将所有的单据的结算状态更新 + this.setBizItemPartSettle(detail.getBizId()); + + orderNo++; + } + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + sheet.setSupplierId(vo.getSupplierId()); + sheet.setTotalAmount(totalAmount); + sheet.setTotalDiscountAmount(totalDiscountAmount); + sheet.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + sheet.setRefuseReason(StringPool.EMPTY_STR); + sheet.setStartDate(vo.getStartDate()); + sheet.setEndDate(vo.getEndDate()); + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetDetailMapper.java new file mode 100644 index 0000000..4f5acdb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetDetailMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettleCheckSheetDetailMapper extends + BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetMapper.java new file mode 100644 index 0000000..d96a5c7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleCheckSheetMapper.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerSettleCheckSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettleCheckSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleCheckSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetDetailMapper.java new file mode 100644 index 0000000..5a6a517 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetDetailMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface CustomerSettleFeeSheetDetailMapper extends + BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetMapper.java new file mode 100644 index 0000000..bc827c2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleFeeSheetMapper.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.customer.QueryCustomerSettleFeeSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface CustomerSettleFeeSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleFeeSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetDetailMapper.java new file mode 100644 index 0000000..42d733f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetDetailMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettlePreSheetDetailMapper extends + BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetMapper.java new file mode 100644 index 0000000..4704d95 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettlePreSheetMapper.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.customer.QueryCustomerSettlePreSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface CustomerSettlePreSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettlePreSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("customerId") String customerId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetDetailMapper.java new file mode 100644 index 0000000..f3dd876 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface CustomerSettleSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetMapper.java new file mode 100644 index 0000000..53134a3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/CustomerSettleSheetMapper.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerSettleSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface CustomerSettleSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QueryCustomerSettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleSheetFullDto getDetail(String id); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetDetailMapper.java new file mode 100644 index 0000000..d78755b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettleCheckSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetMapper.java new file mode 100644 index 0000000..12757af --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleCheckSheetMapper.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.vo.check.QuerySettleCheckSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettleCheckSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleCheckSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetDetailMapper.java new file mode 100644 index 0000000..7109be8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface SettleFeeSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetMapper.java new file mode 100644 index 0000000..b691858 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleFeeSheetMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.QuerySettleFeeSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-30 + */ +public interface SettleFeeSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleFeeSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleInItemMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleInItemMapper.java new file mode 100644 index 0000000..1b239f5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleInItemMapper.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-28 + */ +public interface SettleInItemMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QuerySettleInItemVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SettleInItemSelectorVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleOutItemMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleOutItemMapper.java new file mode 100644 index 0000000..d216516 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleOutItemMapper.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-11-28 + */ +public interface SettleOutItemMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QuerySettleOutItemVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SettleOutItemSelectorVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetDetailMapper.java new file mode 100644 index 0000000..4d25008 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettlePreSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetMapper.java new file mode 100644 index 0000000..7dfc974 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettlePreSheetMapper.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.QuerySettlePreSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-02 + */ +public interface SettlePreSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettlePreSheetFullDto getDetail(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(@Param("supplierId") String supplierId, + @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, + @Param("settleStatus") SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetDetailMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetDetailMapper.java new file mode 100644 index 0000000..b98472b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface SettleSheetDetailMapper extends BaseMapper { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetMapper.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetMapper.java new file mode 100644 index 0000000..85a2fbe --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/mappers/SettleSheetMapper.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.settle.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.vo.sheet.QuerySettleSheetVo; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-05 + */ +public interface SettleSheetMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "s", autoParse = true), + @Sort(value = "createTime", alias = "s", autoParse = true), + @Sort(value = "approveTime", alias = "s", autoParse = true), + }) + @DataPermissions(type = SysDataPermissionDataPermissionType.ORDER, value = { + @DataPermission(template = "order", alias = "s") + }) + List query(@Param("vo") QuerySettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleSheetFullDto getDetail(String id); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetDetailService.java new file mode 100644 index 0000000..92a1c1f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheetDetail; + +public interface CustomerSettleCheckSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetService.java new file mode 100644 index 0000000..1649dec --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleCheckSheetService.java @@ -0,0 +1,198 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.customer.CustomerSettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleCheckSheet; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import com.lframework.xingyun.settle.vo.check.customer.ApprovePassCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.ApproveRefuseCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.BatchApprovePassCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.BatchApproveRefuseCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.CreateCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerSettleCheckSheetVo; +import com.lframework.xingyun.settle.vo.check.customer.QueryCustomerUnCheckBizItemVo; +import com.lframework.xingyun.settle.vo.check.customer.UpdateCustomerSettleCheckSheetVo; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +public interface CustomerSettleCheckSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleCheckSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleCheckSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettleCheckSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettleCheckSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettleCheckSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettleCheckSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettleCheckSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassCustomerSettleCheckSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseCustomerSettleCheckSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 查询业务单据 + * + * @param id + * @param bizType + * @return + */ + CustomerSettleCheckBizItemDto getBizItem(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 更新业务单据未结算 + * + * @param id + * @param bizType + */ + void setBizItemUnSettle(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 更新业务单据结算中 + * + * @param id + * @param bizType + */ + void setBizItemPartSettle(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 更新业务单据已结算 + * + * @param id + * @param bizType + */ + void setBizItemSettled(String id, CustomerSettleCheckSheetBizType bizType); + + /** + * 查询未对账单据 + * + * @param vo + * @return + */ + List getUnCheckBizItems(QueryCustomerUnCheckBizItemVo vo); + + /** + * 更新结算状态-未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 更新结算状态-结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 更新结算状态-已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime); + + /** + * 设置结算金额 + * + * @param id + * @param totalPayedAmount + * @param totalDiscountAmount + */ + void setSettleAmount(String id, BigDecimal totalPayedAmount, BigDecimal totalDiscountAmount); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetDetailService.java new file mode 100644 index 0000000..304c19e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheetDetail; + +public interface CustomerSettleFeeSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetService.java new file mode 100644 index 0000000..fb0b7c1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleFeeSheetService.java @@ -0,0 +1,146 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.customer.CustomerSettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.customer.ApprovePassCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.ApproveRefuseCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.BatchApprovePassCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.BatchApproveRefuseCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.CreateCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.QueryCustomerSettleFeeSheetVo; +import com.lframework.xingyun.settle.vo.fee.customer.UpdateCustomerSettleFeeSheetVo; +import java.time.LocalDateTime; +import java.util.List; + +public interface CustomerSettleFeeSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleFeeSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleFeeSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettleFeeSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettleFeeSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettleFeeSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettleFeeSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettleFeeSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassCustomerSettleFeeSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseCustomerSettleFeeSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetDetailService.java new file mode 100644 index 0000000..9143854 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheetDetail; + +public interface CustomerSettlePreSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetService.java new file mode 100644 index 0000000..f6f4b78 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettlePreSheetService.java @@ -0,0 +1,146 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.customer.CustomerSettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.customer.ApprovePassCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.ApproveRefuseCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.BatchApprovePassCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.BatchApproveRefuseCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.CreateCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.QueryCustomerSettlePreSheetVo; +import com.lframework.xingyun.settle.vo.pre.customer.UpdateCustomerSettlePreSheetVo; +import java.time.LocalDateTime; +import java.util.List; + +public interface CustomerSettlePreSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettlePreSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettlePreSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettlePreSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettlePreSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettlePreSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettlePreSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettlePreSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassCustomerSettlePreSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseCustomerSettlePreSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param customerId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String customerId, LocalDateTime startTime, + LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetDetailService.java new file mode 100644 index 0000000..1da977c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetDetailService.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.CustomerSettleSheetDetail; + +public interface CustomerSettleSheetDetailService extends + BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetService.java new file mode 100644 index 0000000..6076f9a --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/CustomerSettleSheetService.java @@ -0,0 +1,147 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.customer.CustomerSettleSheetFullDto; +import com.lframework.xingyun.settle.entity.CustomerSettleSheet; +import com.lframework.xingyun.settle.vo.sheet.customer.ApprovePassCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.ApproveRefuseCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.BatchApprovePassCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.BatchApproveRefuseCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.CreateCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerSettleSheetVo; +import com.lframework.xingyun.settle.vo.sheet.customer.QueryCustomerUnSettleBizItemVo; +import com.lframework.xingyun.settle.vo.sheet.customer.UpdateCustomerSettleSheetVo; +import java.util.List; + +public interface CustomerSettleSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryCustomerSettleSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryCustomerSettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + CustomerSettleSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateCustomerSettleSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateCustomerSettleSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassCustomerSettleSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateCustomerSettleSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseCustomerSettleSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassCustomerSettleSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseCustomerSettleSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 查询业务单据 + * + * @param id + * @return + */ + CustomerSettleBizItemDto getBizItem(String id); + + /** + * 更新业务单据未结算 + * + * @param id + */ + void setBizItemUnSettle(String id); + + /** + * 更新业务单据结算中 + * + * @param id + */ + void setBizItemPartSettle(String id); + + /** + * 更新业务单据已结算 + * + * @param id + */ + void setBizItemSettled(String id); + + /** + * 查询未结算单据 + * + * @param vo + * @return + */ + List getUnSettleBizItems(QueryCustomerUnSettleBizItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetDetailService.java new file mode 100644 index 0000000..8abf17e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleCheckSheetDetail; + +public interface SettleCheckSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetService.java new file mode 100644 index 0000000..37e99b7 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleCheckSheetService.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.dto.check.SettleCheckBizItemDto; +import com.lframework.xingyun.settle.dto.check.SettleCheckSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleCheckSheet; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import com.lframework.xingyun.settle.vo.check.*; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +public interface SettleCheckSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleCheckSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleCheckSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleCheckSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleCheckSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleCheckSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettleCheckSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettleCheckSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettleCheckSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassSettleCheckSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseSettleCheckSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 查询业务单据 + * + * @param id + * @param bizType + * @return + */ + SettleCheckBizItemDto getBizItem(String id, SettleCheckSheetBizType bizType); + + /** + * 更新业务单据未结算 + * + * @param id + * @param bizType + */ + void setBizItemUnSettle(String id, SettleCheckSheetBizType bizType); + + /** + * 更新业务单据结算中 + * + * @param id + * @param bizType + */ + void setBizItemPartSettle(String id, SettleCheckSheetBizType bizType); + + /** + * 更新业务单据已结算 + * + * @param id + * @param bizType + */ + void setBizItemSettled(String id, SettleCheckSheetBizType bizType); + + /** + * 查询未对账单据 + * + * @param vo + * @return + */ + List getUnCheckBizItems(QueryUnCheckBizItemVo vo); + + /** + * 更新结算状态-未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 更新结算状态-结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 更新结算状态-已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime); + + /** + * 设置结算金额 + * + * @param id + * @param totalPayedAmount + * @param totalDiscountAmount + */ + void setSettleAmount(String id, BigDecimal totalPayedAmount, BigDecimal totalDiscountAmount); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetDetailService.java new file mode 100644 index 0000000..0b4bf03 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleFeeSheetDetail; + +public interface SettleFeeSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetService.java new file mode 100644 index 0000000..99e4dbe --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleFeeSheetService.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.fee.SettleFeeSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleFeeSheet; +import com.lframework.xingyun.settle.vo.fee.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface SettleFeeSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleFeeSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleFeeSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleFeeSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleFeeSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleFeeSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettleFeeSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettleFeeSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettleFeeSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassSettleFeeSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseSettleFeeSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleInItemService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleInItemService.java new file mode 100644 index 0000000..fcfbcbb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleInItemService.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleInItem; +import com.lframework.xingyun.settle.vo.item.in.CreateSettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.QuerySettleInItemVo; +import com.lframework.xingyun.settle.vo.item.in.SettleInItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.in.UpdateSettleInItemVo; + +import java.util.Collection; +import java.util.List; + +public interface SettleInItemService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleInItemVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleInItemVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SettleInItemSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleInItem findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleInItemVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleInItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleOutItemService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleOutItemService.java new file mode 100644 index 0000000..d75f1d3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleOutItemService.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleOutItem; +import com.lframework.xingyun.settle.vo.item.out.CreateSettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.QuerySettleOutItemVo; +import com.lframework.xingyun.settle.vo.item.out.SettleOutItemSelectorVo; +import com.lframework.xingyun.settle.vo.item.out.UpdateSettleOutItemVo; + +import java.util.Collection; +import java.util.List; + +public interface SettleOutItemService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleOutItemVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleOutItemVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SettleOutItemSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleOutItem findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleOutItemVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleOutItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetDetailService.java new file mode 100644 index 0000000..e397162 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettlePreSheetDetail; + +public interface SettlePreSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetService.java new file mode 100644 index 0000000..457f985 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettlePreSheetService.java @@ -0,0 +1,139 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.dto.pre.SettlePreSheetFullDto; +import com.lframework.xingyun.settle.entity.SettlePreSheet; +import com.lframework.xingyun.settle.vo.pre.*; + +import java.time.LocalDateTime; +import java.util.List; + +public interface SettlePreSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettlePreSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettlePreSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettlePreSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettlePreSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettlePreSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettlePreSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettlePreSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettlePreSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassSettlePreSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseSettlePreSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 设置成未结算 + * + * @param id + * @return + */ + int setUnSettle(String id); + + /** + * 设置成结算中 + * + * @param id + * @return + */ + int setPartSettle(String id); + + /** + * 设置成已结算 + * + * @param id + * @return + */ + int setSettled(String id); + + /** + * 查询已审核列表 + * + * @param supplierId + * @param startTime + * @param endTime + * @return + */ + List getApprovedList(String supplierId, LocalDateTime startTime, LocalDateTime endTime, + SettleStatus settleStatus); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetDetailService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetDetailService.java new file mode 100644 index 0000000..a0ed86f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetDetailService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.entity.SettleSheetDetail; + +public interface SettleSheetDetailService extends BaseMpService { + +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetService.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetService.java new file mode 100644 index 0000000..9a1be8d --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/service/SettleSheetService.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.settle.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.settle.dto.sheet.SettleBizItemDto; +import com.lframework.xingyun.settle.dto.sheet.SettleSheetFullDto; +import com.lframework.xingyun.settle.entity.SettleSheet; +import com.lframework.xingyun.settle.vo.sheet.*; + +import java.util.List; + +public interface SettleSheetService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySettleSheetVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySettleSheetVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SettleSheetFullDto getDetail(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSettleSheetVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSettleSheetVo vo); + + /** + * 审核通过 + * + * @param vo + */ + void approvePass(ApprovePassSettleSheetVo vo); + + /** + * 直接审核通过 + * + * @param vo + */ + String directApprovePass(CreateSettleSheetVo vo); + + /** + * 审核拒绝 + * + * @param vo + */ + void approveRefuse(ApproveRefuseSettleSheetVo vo); + + /** + * 批量审核通过 + * + * @param vo + */ + void batchApprovePass(BatchApprovePassSettleSheetVo vo); + + /** + * 批量审核拒绝 + * + * @param vo + */ + void batchApproveRefuse(BatchApproveRefuseSettleSheetVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 根据IDs删除 + * + * @param ids + */ + void deleteByIds(List ids); + + /** + * 查询业务单据 + * + * @param id + * @return + */ + SettleBizItemDto getBizItem(String id); + + /** + * 更新业务单据未结算 + * + * @param id + */ + void setBizItemUnSettle(String id); + + /** + * 更新业务单据结算中 + * + * @param id + */ + void setBizItemPartSettle(String id); + + /** + * 更新业务单据已结算 + * + * @param id + */ + void setBizItemSettled(String id); + + /** + * 查询未结算单据 + * + * @param vo + * @return + */ + List getUnSettleBizItems(QueryUnSettleBizItemVo vo); +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApprovePassSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApprovePassSettleCheckSheetVo.java new file mode 100644 index 0000000..f0a354e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApprovePassSettleCheckSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApproveRefuseSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApproveRefuseSettleCheckSheetVo.java new file mode 100644 index 0000000..11bc8de --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/ApproveRefuseSettleCheckSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/BatchApprovePassSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/BatchApprovePassSettleCheckSheetVo.java new file mode 100644 index 0000000..c195b45 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/BatchApprovePassSettleCheckSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "对账单ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/BatchApproveRefuseSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/BatchApproveRefuseSettleCheckSheetVo.java new file mode 100644 index 0000000..c130920 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/BatchApproveRefuseSettleCheckSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "对账单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/CreateSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/CreateSettleCheckSheetVo.java new file mode 100644 index 0000000..49593f4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/CreateSettleCheckSheetVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @ApiModelProperty(value = "起始日期", required = true) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @ApiModelProperty(value = "截止日期", required = true) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettleCheckSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行业务单据不能为空!"); + } + + if (item.getBizType() == null) { + throw new InputErrorException("第" + orderNo + "行业务类型不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行应付金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QuerySettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QuerySettleCheckSheetVo.java new file mode 100644 index 0000000..943eec3 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QuerySettleCheckSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleCheckSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleCheckSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettleCheckSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QueryUnCheckBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QueryUnCheckBizItemVo.java new file mode 100644 index 0000000..9740788 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/QueryUnCheckBizItemVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class QueryUnCheckBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @ApiModelProperty("截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/SettleCheckSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/SettleCheckSheetItemVo.java new file mode 100644 index 0000000..1794073 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/SettleCheckSheetItemVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.settle.vo.check; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.settle.enums.SettleCheckSheetBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SettleCheckSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + @IsEnum(message = "业务类型格式不正确!", enumClass = SettleCheckSheetBizType.class) + private Integer bizType; + + /** + * 应付金额 + */ + @ApiModelProperty("应付金额") + private BigDecimal payAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/UpdateSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/UpdateSettleCheckSheetVo.java new file mode 100644 index 0000000..9f24e5f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/UpdateSettleCheckSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.check; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleCheckSheetVo extends CreateSettleCheckSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApprovePassCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApprovePassCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..ba7268e --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApprovePassCustomerSettleCheckSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApproveRefuseCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApproveRefuseCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..429a549 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/ApproveRefuseCustomerSettleCheckSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/BatchApprovePassCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/BatchApprovePassCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..1f0b846 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/BatchApprovePassCustomerSettleCheckSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "对账单ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/BatchApproveRefuseCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/BatchApproveRefuseCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..de8a645 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/BatchApproveRefuseCustomerSettleCheckSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "对账单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CreateCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CreateCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..0728040 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CreateCustomerSettleCheckSheetVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateCustomerSettleCheckSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @ApiModelProperty(value = "起始日期", required = true) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @ApiModelProperty(value = "截止日期", required = true) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettleCheckSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行业务单据不能为空!"); + } + + if (item.getBizType() == null) { + throw new InputErrorException("第" + orderNo + "行业务类型不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行应收金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CustomerSettleCheckSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CustomerSettleCheckSheetItemVo.java new file mode 100644 index 0000000..51780c5 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/CustomerSettleCheckSheetItemVo.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class CustomerSettleCheckSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 业务类型 + */ + @ApiModelProperty("业务类型") + @IsEnum(message = "业务类型格式不正确!", enumClass = CustomerSettleCheckSheetBizType.class) + private Integer bizType; + + /** + * 应收金额 + */ + @ApiModelProperty("应收金额") + private BigDecimal payAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..ba480e4 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerSettleCheckSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleCheckSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettleCheckSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettleCheckSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerUnCheckBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerUnCheckBizItemVo.java new file mode 100644 index 0000000..6ac7b55 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/QueryCustomerUnCheckBizItemVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class QueryCustomerUnCheckBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @ApiModelProperty("截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/UpdateCustomerSettleCheckSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/UpdateCustomerSettleCheckSheetVo.java new file mode 100644 index 0000000..5c2a1ca --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/check/customer/UpdateCustomerSettleCheckSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.check.customer; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettleCheckSheetVo extends CreateCustomerSettleCheckSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApprovePassSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApprovePassSettleFeeSheetVo.java new file mode 100644 index 0000000..f8f59c0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApprovePassSettleFeeSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApproveRefuseSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApproveRefuseSettleFeeSheetVo.java new file mode 100644 index 0000000..93e29e1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/ApproveRefuseSettleFeeSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/BatchApprovePassSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/BatchApprovePassSettleFeeSheetVo.java new file mode 100644 index 0000000..75af822 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/BatchApprovePassSettleFeeSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "费用单ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/BatchApproveRefuseSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/BatchApproveRefuseSettleFeeSheetVo.java new file mode 100644 index 0000000..62ea2ae --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/BatchApproveRefuseSettleFeeSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "费用单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/CreateSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/CreateSettleFeeSheetVo.java new file mode 100644 index 0000000..e47cc35 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/CreateSettleFeeSheetVo.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.settle.enums.SettleFeeSheetType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 收支方式 + */ + @ApiModelProperty(value = "收支方式", required = true) + @NotNull(message = "收支方式不能为空!") + @IsEnum(message = "收支方式不能为空!", enumClass = SettleFeeSheetType.class) + private Integer sheetType; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettleFeeSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/QuerySettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/QuerySettleFeeSheetVo.java new file mode 100644 index 0000000..b898cd1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/QuerySettleFeeSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettleFeeSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleFeeSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettleFeeSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/SettleFeeSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/SettleFeeSheetItemVo.java new file mode 100644 index 0000000..b5d4ae0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/SettleFeeSheetItemVo.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.settle.vo.fee; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SettleFeeSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String id; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/UpdateSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/UpdateSettleFeeSheetVo.java new file mode 100644 index 0000000..266be51 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/UpdateSettleFeeSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.fee; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleFeeSheetVo extends CreateSettleFeeSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApprovePassCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApprovePassCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..c6be005 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApprovePassCustomerSettleFeeSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApproveRefuseCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApproveRefuseCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..936c5aa --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/ApproveRefuseCustomerSettleFeeSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/BatchApprovePassCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/BatchApprovePassCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..5dafc63 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/BatchApprovePassCustomerSettleFeeSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "费用单ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/BatchApproveRefuseCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/BatchApproveRefuseCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..e94cad2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/BatchApproveRefuseCustomerSettleFeeSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "费用单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CreateCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CreateCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..a3a8b76 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CreateCustomerSettleFeeSheetVo.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateCustomerSettleFeeSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 收支方式 + */ + @ApiModelProperty(value = "收支方式", required = true) + @NotNull(message = "收支方式不能为空!") + @IsEnum(message = "收支方式不能为空!", enumClass = CustomerSettleFeeSheetType.class) + private Integer sheetType; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettleFeeSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CustomerSettleFeeSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CustomerSettleFeeSheetItemVo.java new file mode 100644 index 0000000..3730990 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/CustomerSettleFeeSheetItemVo.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class CustomerSettleFeeSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String id; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/QueryCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/QueryCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..d8ec9ad --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/QueryCustomerSettleFeeSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettleFeeSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettleFeeSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettleFeeSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/UpdateCustomerSettleFeeSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/UpdateCustomerSettleFeeSheetVo.java new file mode 100644 index 0000000..65967cd --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/fee/customer/UpdateCustomerSettleFeeSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.fee.customer; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettleFeeSheetVo extends CreateCustomerSettleFeeSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/CreateSettleInItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/CreateSettleInItemVo.java new file mode 100644 index 0000000..d7797ee --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/CreateSettleInItemVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSettleInItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/QuerySettleInItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/QuerySettleInItemVo.java new file mode 100644 index 0000000..f44fddb --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/QuerySettleInItemVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySettleInItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/SettleInItemSelectorVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/SettleInItemSelectorVo.java new file mode 100644 index 0000000..9f44ca0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/SettleInItemSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SettleInItemSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/UpdateSettleInItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/UpdateSettleInItemVo.java new file mode 100644 index 0000000..00bc42b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/in/UpdateSettleInItemVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.settle.vo.item.in; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleInItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/CreateSettleOutItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/CreateSettleOutItemVo.java new file mode 100644 index 0000000..9658b56 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/CreateSettleOutItemVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSettleOutItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/QuerySettleOutItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/QuerySettleOutItemVo.java new file mode 100644 index 0000000..b27717f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/QuerySettleOutItemVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySettleOutItemVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/SettleOutItemSelectorVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/SettleOutItemSelectorVo.java new file mode 100644 index 0000000..f019142 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/SettleOutItemSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SettleOutItemSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/UpdateSettleOutItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/UpdateSettleOutItemVo.java new file mode 100644 index 0000000..3becb1c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/item/out/UpdateSettleOutItemVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.settle.vo.item.out; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleOutItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApprovePassSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApprovePassSettlePreSheetVo.java new file mode 100644 index 0000000..f5de560 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApprovePassSettlePreSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApproveRefuseSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApproveRefuseSettlePreSheetVo.java new file mode 100644 index 0000000..d96f83c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/ApproveRefuseSettlePreSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/BatchApprovePassSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/BatchApprovePassSettlePreSheetVo.java new file mode 100644 index 0000000..9422224 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/BatchApprovePassSettlePreSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "费用单ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/BatchApproveRefuseSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/BatchApproveRefuseSettlePreSheetVo.java new file mode 100644 index 0000000..ddf4c47 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/BatchApproveRefuseSettlePreSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + @NotNull(message = "费用单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/CreateSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/CreateSettlePreSheetVo.java new file mode 100644 index 0000000..18d0777 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/CreateSettlePreSheetVo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettlePreSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/QuerySettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/QuerySettlePreSheetVo.java new file mode 100644 index 0000000..74f9557 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/QuerySettlePreSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.SettlePreSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettlePreSheetVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettlePreSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/SettlePreSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/SettlePreSheetItemVo.java new file mode 100644 index 0000000..90e0ded --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/SettlePreSheetItemVo.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.settle.vo.pre; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SettlePreSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String id; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/UpdateSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/UpdateSettlePreSheetVo.java new file mode 100644 index 0000000..23fadae --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/UpdateSettlePreSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.pre; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettlePreSheetVo extends CreateSettlePreSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApprovePassCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApprovePassCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..127354b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApprovePassCustomerSettlePreSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApproveRefuseCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApproveRefuseCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..d8f6c15 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/ApproveRefuseCustomerSettlePreSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/BatchApprovePassCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/BatchApprovePassCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..7d8f071 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/BatchApprovePassCustomerSettlePreSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "费用单ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/BatchApproveRefuseCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/BatchApproveRefuseCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..af9d7a8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/BatchApproveRefuseCustomerSettlePreSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + @NotNull(message = "费用单ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CreateCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CreateCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..4279c39 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CreateCustomerSettlePreSheetVo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateCustomerSettlePreSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettlePreSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行项目不能为空!"); + } + + if (item.getAmount() == null) { + throw new InputErrorException("第" + orderNo + "行金额不能为空!"); + } + + if (NumberUtil.le(item.getAmount(), 0D)) { + throw new InputErrorException("第" + orderNo + "行金额必须大于0!"); + } + + if (!NumberUtil.isNumberPrecision(item.getAmount(), 2)) { + throw new InputErrorException("第" + orderNo + "行金额最多允许2位小数!"); + } + + if (this.items.stream().filter(t -> t.getId().equals(item.getId())).count() > 1) { + throw new InputErrorException("第" + orderNo + "行项目与其他行重复,请检查!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CustomerSettlePreSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CustomerSettlePreSheetItemVo.java new file mode 100644 index 0000000..2843780 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/CustomerSettlePreSheetItemVo.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class CustomerSettlePreSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + @ApiModelProperty("项目ID") + private String id; + + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/QueryCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/QueryCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..e8b7ab1 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/QueryCustomerSettlePreSheetVo.java @@ -0,0 +1,77 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.sc.enums.SettleStatus; +import com.lframework.xingyun.settle.enums.CustomerSettlePreSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettlePreSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettlePreSheetStatus.class) + private Integer status; + + /** + * 结算状态 + */ + @ApiModelProperty("结算状态") + @IsEnum(message = "结算状态格式不正确!", enumClass = SettleStatus.class) + private Integer settleStatus; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/UpdateCustomerSettlePreSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/UpdateCustomerSettlePreSheetVo.java new file mode 100644 index 0000000..376b335 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/pre/customer/UpdateCustomerSettlePreSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.pre.customer; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettlePreSheetVo extends CreateCustomerSettlePreSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApprovePassSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApprovePassSettleSheetVo.java new file mode 100644 index 0000000..809ad98 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApprovePassSettleSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApproveRefuseSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApproveRefuseSettleSheetVo.java new file mode 100644 index 0000000..13f5d49 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/ApproveRefuseSettleSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/BatchApprovePassSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/BatchApprovePassSettleSheetVo.java new file mode 100644 index 0000000..f9b3535 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/BatchApprovePassSettleSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/BatchApproveRefuseSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/BatchApproveRefuseSettleSheetVo.java new file mode 100644 index 0000000..ea6e69c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/BatchApproveRefuseSettleSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/CreateSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/CreateSettleSheetVo.java new file mode 100644 index 0000000..3703b56 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/CreateSettleSheetVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @ApiModelProperty(value = "起始日期", required = true) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @ApiModelProperty(value = "截止日期", required = true) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (SettleSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行对账单不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行实付金额不能为空!"); + } + + if (item.getDiscountAmount() == null) { + throw new InputErrorException("第" + orderNo + "行优惠金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QuerySettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QuerySettleSheetVo.java new file mode 100644 index 0000000..cfa73c8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QuerySettleSheetVo.java @@ -0,0 +1,69 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.settle.enums.SettleSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySettleSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 供应商ID + */ + @ApiModelProperty("供应商ID") + private String supplierId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = SettleSheetStatus.class) + private Integer status; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QueryUnSettleBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QueryUnSettleBizItemVo.java new file mode 100644 index 0000000..e771f1b --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/QueryUnSettleBizItemVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class QueryUnSettleBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 供应商ID + */ + @ApiModelProperty(value = "供应商ID", required = true) + @NotNull(message = "供应商ID不能为空!") + private String supplierId; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @ApiModelProperty("截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/SettleSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/SettleSheetItemVo.java new file mode 100644 index 0000000..312f7e9 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/SettleSheetItemVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class SettleSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 实付金额 + */ + @ApiModelProperty("实付金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal discountAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/UpdateSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/UpdateSettleSheetVo.java new file mode 100644 index 0000000..da5f4b0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/UpdateSettleSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.sheet; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSettleSheetVo extends CreateSettleSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApprovePassCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApprovePassCustomerSettleSheetVo.java new file mode 100644 index 0000000..73990d0 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApprovePassCustomerSettleSheetVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class ApprovePassCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApproveRefuseCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApproveRefuseCustomerSettleSheetVo.java new file mode 100644 index 0000000..1407de2 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/ApproveRefuseCustomerSettleSheetVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class ApproveRefuseCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/BatchApprovePassCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/BatchApprovePassCustomerSettleSheetVo.java new file mode 100644 index 0000000..dfc05ed --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/BatchApprovePassCustomerSettleSheetVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApprovePassCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private List ids; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/BatchApproveRefuseCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/BatchApproveRefuseCustomerSettleSheetVo.java new file mode 100644 index 0000000..4321730 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/BatchApproveRefuseCustomerSettleSheetVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class BatchApproveRefuseCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private List ids; + + /** + * 拒绝理由 + */ + @ApiModelProperty(value = "拒绝理由", required = true) + @NotBlank(message = "拒绝理由不能为空!") + private String refuseReason; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CreateCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CreateCustomerSettleSheetVo.java new file mode 100644 index 0000000..e5d7866 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CreateCustomerSettleSheetVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateCustomerSettleSheetVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 项目 + */ + @ApiModelProperty(value = "项目", required = true) + @NotEmpty(message = "项目不能为空!") + private List items; + + /** + * 起始日期 + */ + @ApiModelProperty(value = "起始日期", required = true) + @NotNull(message = "起始日期不能为空!") + private LocalDate startDate; + + /** + * 截止日期 + */ + @ApiModelProperty(value = "截止日期", required = true) + @NotNull(message = "截止日期不能为空!") + private LocalDate endDate; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public void validate() { + + int orderNo = 1; + for (CustomerSettleSheetItemVo item : this.items) { + if (StringUtil.isBlank(item.getId())) { + throw new InputErrorException("第" + orderNo + "行对账单不能为空!"); + } + + if (item.getPayAmount() == null) { + throw new InputErrorException("第" + orderNo + "行实收金额不能为空!"); + } + + if (item.getDiscountAmount() == null) { + throw new InputErrorException("第" + orderNo + "行优惠金额不能为空!"); + } + + orderNo++; + } + } +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CustomerSettleSheetItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CustomerSettleSheetItemVo.java new file mode 100644 index 0000000..fb52b4c --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/CustomerSettleSheetItemVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +@Data +public class CustomerSettleSheetItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单据ID + */ + @ApiModelProperty("单据ID") + private String id; + + /** + * 实收金额 + */ + @ApiModelProperty("实收金额") + private BigDecimal payAmount; + + /** + * 优惠金额 + */ + @ApiModelProperty("优惠金额") + private BigDecimal discountAmount; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerSettleSheetVo.java new file mode 100644 index 0000000..a77554f --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerSettleSheetVo.java @@ -0,0 +1,69 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.settle.enums.CustomerSettleSheetStatus; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryCustomerSettleSheetVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 业务单据号 + */ + @ApiModelProperty("业务单据号") + private String code; + + /** + * 客户ID + */ + @ApiModelProperty("客户ID") + private String customerId; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime createStartTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime createEndTime; + + /** + * 审核人 + */ + @ApiModelProperty("审核人") + private String approveBy; + + /** + * 审核起始时间 + */ + @ApiModelProperty("审核起始时间") + private LocalDateTime approveStartTime; + + /** + * 审核截止时间 + */ + @ApiModelProperty("审核截止时间") + private LocalDateTime approveEndTime; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + @IsEnum(message = "审核状态格式不正确!", enumClass = CustomerSettleSheetStatus.class) + private Integer status; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerUnSettleBizItemVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerUnSettleBizItemVo.java new file mode 100644 index 0000000..0eec7e8 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/QueryCustomerUnSettleBizItemVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class QueryCustomerUnSettleBizItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + @ApiModelProperty(value = "客户ID", required = true) + @NotNull(message = "客户ID不能为空!") + private String customerId; + + /** + * 起始时间 + */ + @ApiModelProperty("起始时间") + private LocalDateTime startTime; + + /** + * 截至时间 + */ + @ApiModelProperty("截至时间") + private LocalDateTime endTime; +} diff --git a/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/UpdateCustomerSettleSheetVo.java b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/UpdateCustomerSettleSheetVo.java new file mode 100644 index 0000000..c943951 --- /dev/null +++ b/xingyun-settle/src/main/java/com/lframework/xingyun/settle/vo/sheet/customer/UpdateCustomerSettleSheetVo.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.settle.vo.sheet.customer; + +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCustomerSettleSheetVo extends CreateCustomerSettleSheetVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; +} diff --git a/xingyun-settle/src/main/java/lombok.config b/xingyun-settle/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-settle/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettleCheckSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettleCheckSheetMapper.xml new file mode 100644 index 0000000..5dfd3da --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettleCheckSheetMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM customer_settle_check_sheet AS s + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.biz_type AS detail_biz_type, + d.calc_type AS detail_calc_type, + d.pay_amount AS detail_pay_amount, + d.description AS detail_description + FROM customer_settle_check_sheet AS s + LEFT JOIN customer_settle_check_sheet_detail AS d ON d.sheet_id = s.id + + diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettleFeeSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettleFeeSheetMapper.xml new file mode 100644 index 0000000..3737952 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettleFeeSheetMapper.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM customer_settle_fee_sheet AS s + + + SELECT s.id, + s.code, + s.customer_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM customer_settle_fee_sheet AS s + LEFT JOIN customer_settle_fee_sheet_detail AS d ON d.sheet_id = s.id + + diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettlePreSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettlePreSheetMapper.xml new file mode 100644 index 0000000..480df8d --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettlePreSheetMapper.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM customer_settle_pre_sheet AS s + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM customer_settle_pre_sheet AS s + LEFT JOIN customer_settle_pre_sheet_detail AS d ON d.sheet_id = s.id + + diff --git a/xingyun-settle/src/main/resources/mappers/CustomerSettleSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/CustomerSettleSheetMapper.xml new file mode 100644 index 0000000..597c250 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/CustomerSettleSheetMapper.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.pay_amount AS detail_pay_amount, + d.discount_amount AS detail_discount_amount, + d.description AS detail_description + FROM customer_settle_sheet AS s + LEFT JOIN customer_settle_sheet_detail AS d ON d.sheet_id = s.id + + + + SELECT s.id, + s.code, + s.customer_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason + FROM customer_settle_sheet AS s + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleCheckSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleCheckSheetMapper.xml new file mode 100644 index 0000000..2387483 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleCheckSheetMapper.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM settle_check_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_pay_amount, + s.total_payed_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.biz_type AS detail_biz_type, + d.calc_type AS detail_calc_type, + d.pay_amount AS detail_pay_amount, + d.description AS detail_description + FROM settle_check_sheet AS s + LEFT JOIN settle_check_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleFeeSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleFeeSheetMapper.xml new file mode 100644 index 0000000..1f6f616 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleFeeSheetMapper.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM settle_fee_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.sheet_type, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM settle_fee_sheet AS s + LEFT JOIN settle_fee_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleInItemMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleInItemMapper.xml new file mode 100644 index 0000000..32e6e72 --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleInItemMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM settle_in_item + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleOutItemMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleOutItemMapper.xml new file mode 100644 index 0000000..d00010a --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleOutItemMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + SELECT + id, + code, + name, + available, + description, + create_by, + create_time, + update_by, + update_time + FROM settle_out_item + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettlePreSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettlePreSheetMapper.xml new file mode 100644 index 0000000..1d02cdb --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettlePreSheetMapper.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status + FROM settle_pre_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + s.settle_status, + d.id AS detail_id, + d.item_id AS detail_item_id, + d.amount AS detail_amount + FROM settle_pre_sheet AS s + LEFT JOIN settle_pre_sheet_detail AS d ON d.sheet_id = s.id + + + + + + + + diff --git a/xingyun-settle/src/main/resources/mappers/SettleSheetMapper.xml b/xingyun-settle/src/main/resources/mappers/SettleSheetMapper.xml new file mode 100644 index 0000000..70990df --- /dev/null +++ b/xingyun-settle/src/main/resources/mappers/SettleSheetMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason + FROM settle_sheet AS s + + + + SELECT + s.id, + s.code, + s.supplier_id, + s.total_amount, + s.total_discount_amount, + s.start_date, + s.end_date, + s.description, + s.create_by, + s.create_time, + s.update_by, + s.update_time, + s.approve_by, + s.approve_time, + s.status, + s.refuse_reason, + d.id AS detail_id, + d.biz_id AS detail_biz_id, + d.pay_amount AS detail_pay_amount, + d.discount_amount AS detail_discount_amount, + d.description AS detail_description + FROM settle_sheet AS s + LEFT JOIN settle_sheet_detail AS d ON d.sheet_id = s.id + + + + + + diff --git a/xingyun-template-core/pom.xml b/xingyun-template-core/pom.xml new file mode 100644 index 0000000..47320cb --- /dev/null +++ b/xingyun-template-core/pom.xml @@ -0,0 +1,22 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-template-core + + 【${project.artifactId}】此Module与业务无关,提供业务Module与Template Module的交互能力 + + + + com.lframework + web-starter + + + \ No newline at end of file diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/OpLog.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/OpLog.java new file mode 100644 index 0000000..1724e18 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/OpLog.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.template.core.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 系统日志注解 + *

+ * 使用方法: 比如关于用户的日志可以分为“登录、退出登录” 此时type可以使用统一的字符串,这样可以将关于用户行为的日志全部查出 然后再根据不同的name将这些日志进一步细分 + * name同时也用于前端显示 在上述例子中,可以将type设置为“user.operation” 登录的name设置为“用户登录” 退出登录的name设置为“退出登录” + * + * @author zmj + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface OpLog { + + /** + * 日志类型 用于做业务区分 + * + * @return + */ + int type(); + + /** + * 日志名称 需要填充参数部分用{}占位,会根据params的值进行填充 + * + * @return + */ + String name() default ""; + + /** + * 需要保存的参数 Spel表达式 + * + * @return + */ + String[] params() default {}; + + /** + * 是否循环填充日志名称 会将params中的collection循环format + * + * @return + */ + boolean loopFormat() default false; + + /** + * 是否自动保存参数 + * + * @return + */ + boolean autoSaveParams() default false; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/permission/DataPermission.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/permission/DataPermission.java new file mode 100644 index 0000000..224c2f9 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/permission/DataPermission.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.template.core.annotations.permission; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataPermission { + + String template(); + + String alias(); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/permission/DataPermissions.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/permission/DataPermissions.java new file mode 100644 index 0000000..0a2a76e --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/permission/DataPermissions.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.template.core.annotations.permission; + +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataPermissions { + + SysDataPermissionDataPermissionType type(); + + DataPermission[] value(); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/sort/Sort.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/sort/Sort.java new file mode 100644 index 0000000..8e81cfb --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/sort/Sort.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.template.core.annotations.sort; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Sort { + + /** + * 传入列名 + * + * @return + */ + String value(); + + /** + * SQL列名 + * + * @return + */ + String alias() default ""; + + /** + * 是否自动解析 + *

+ * 如果自动解析,那么alias只需要指定表的别名即可,会直接将alias和转为下划线的value拼接作为SQL列名 + * + * @return + */ + boolean autoParse() default false; +} \ No newline at end of file diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/sort/Sorts.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/sort/Sorts.java new file mode 100644 index 0000000..89f70ac --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/annotations/sort/Sorts.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.template.core.annotations.sort; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Sorts { + + Sort[] value(); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/aop/OpLogAspector.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/aop/OpLogAspector.java new file mode 100644 index 0000000..9dd0c3d --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/aop/OpLogAspector.java @@ -0,0 +1,190 @@ +package com.lframework.xingyun.template.core.aop; + +import com.lframework.starter.common.utils.ArrayUtil; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.core.vo.CreateOpLogsVo; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.SpelUtil; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.expression.EvaluationContext; +import org.springframework.stereotype.Component; + +/** + * OpLog切面 + * + * @author zmj + */ +@Slf4j +@Aspect +@Component +@ConditionalOnProperty(value = "op-logs.enabled", matchIfMissing = true) +public class OpLogAspector { + + @Pointcut("@annotation(com.lframework.xingyun.template.core.annotations.OpLog)") + public void opLogCutPoint() { + + } + + @Around(value = "opLogCutPoint()") + public Object opLog(ProceedingJoinPoint joinPoint) throws Throwable { + + try { + //生成logId,多层嵌套时,隔离不同bean的数据 + String logId = IdUtil.getUUID(); + OpLogUtil.init(logId); + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + + Object value = joinPoint.proceed(); + + if (currentUser != null) { + try { + //获取方法的参数名和参数值 + MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); + List paramNameList = Arrays.asList(methodSignature.getParameterNames()); + List paramList = Arrays.asList(joinPoint.getArgs()); + + //将方法的参数名和参数值一一对应的放入上下文中 + EvaluationContext ctx = SpelUtil.buildContext(); + for (int i = 0; i < paramNameList.size(); i++) { + ctx.setVariable(paramNameList.get(i), paramList.get(i)); + } + + //将返回值放入上下文中 + ctx.setVariable("_result", value); + + Map variables = OpLogUtil.getVariables(); + if (!CollectionUtil.isEmpty(variables)) { + variables.forEach((k, v) -> { + ctx.setVariable(k, v); + }); + } + + // 解析SpEL表达式获取结果 + Object[] params; + OpLog opLog = methodSignature.getMethod().getAnnotation(OpLog.class); + if (!ArrayUtil.isEmpty(opLog.params())) { + params = new Object[opLog.params().length]; + for (int i = 0; i < opLog.params().length; i++) { + String param = opLog.params()[i]; + Object p = SpelUtil.parse(param, ctx); + params[i] = p; + } + } else { + params = new String[0]; + } + + List paramsList = new ArrayList<>(); + //循环format + if (opLog.loopFormat() && Arrays.stream(params).anyMatch(t -> t instanceof Collection)) { + String[] strParams = new String[params.length]; + //collectionIndex的索引 + List collectionIndexes = new ArrayList<>(); + for (int i = 0; i < params.length; i++) { + //先处理不是Collection的元素 + if (params[i] instanceof Collection) { + collectionIndexes.add(i); + continue; + } + strParams[i] = params[i] == null ? null : params[i].toString(); + } + + paramsList.add(strParams); + + if (!CollectionUtil.isEmpty(collectionIndexes)) { + //将所有的collection组合,例:collection1的size是2 collection2的size是3 则组合后的条数为2*3=6 + for (Integer collectionIndex : collectionIndexes) { + List tmpParamsList = new ArrayList<>(); + for (String[] paramsArr : paramsList) { + + Collection collection = (Collection) params[collectionIndex]; + for (Object o : collection) { + String[] tmp = new String[paramsArr.length]; + for (int j = 0; j < paramsArr.length; j++) { + if (j == collectionIndex) { + tmp[j] = o == null ? null : o.toString(); + } else { + tmp[j] = paramsArr[j]; + } + } + + tmpParamsList.add(tmp); + } + } + + paramsList.clear(); + paramsList.addAll(tmpParamsList); + } + } else { + paramsList.add(strParams); + } + } else { + String[] strParams = new String[params.length]; + for (int i = 0; i < params.length; i++) { + strParams[i] = params[i] == null ? null : params[i].toString(); + } + paramsList.add(strParams); + } + + List createOpLogsVoList = new ArrayList<>(); + for (String[] strArr : paramsList) { + String extra = OpLogUtil.getExtra(); + if (extra == null) { + if (opLog.autoSaveParams()) { + // 没有手动指定extra + if (CollectionUtil.isNotEmpty(paramNameList)) { + if (paramNameList.size() == 1) { + // 只有一个参数 + OpLogUtil.setExtra(ctx.lookupVariable(paramNameList.get(0))); + } else { + // 多个参数 + Map paramMap = new LinkedHashMap<>(paramNameList.size(), 1); + for (String paramName : paramNameList) { + paramMap.put(paramName, ctx.lookupVariable(paramName)); + } + OpLogUtil.setExtra(paramMap); + } + } + extra = OpLogUtil.getExtra(); + } + } + + String finalExtra = extra; + CreateOpLogsVo vo = new CreateOpLogsVo(); + vo.setName(StringUtil.format(opLog.name(), strArr)); + vo.setLogType(opLog.type()); + vo.setExtra(finalExtra); + vo.setIp(currentUser.getIp()); + createOpLogsVoList.add(vo); + } + + if (CollectionUtil.isNotEmpty(createOpLogsVoList)) { + OpLogUtil.addLogs(createOpLogsVoList); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + return value; + } finally { + OpLogUtil.clear(); + } + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/WebExceptionHandler.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/WebExceptionHandler.java new file mode 100644 index 0000000..e9c7dab --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/WebExceptionHandler.java @@ -0,0 +1,391 @@ +package com.lframework.xingyun.template.core.components; + +import cn.dev33.satoken.exception.NotPermissionException; +import com.lframework.starter.common.exceptions.BaseException; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.common.exceptions.SysException; +import com.lframework.starter.common.exceptions.impl.AccessDeniedException; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.Response; +import com.lframework.starter.web.resp.ResponseErrorBuilder; +import com.lframework.starter.web.utils.ResponseUtil; +import java.util.Map; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.UnexpectedTypeException; + +import com.lframework.xingyun.template.core.utils.WebUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.tomcat.util.http.fileupload.FileUploadException; +import org.springframework.beans.TypeMismatchException; +import org.springframework.core.MethodParameter; +import org.springframework.http.HttpStatus; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.validation.BindException; +import org.springframework.validation.FieldError; +import org.springframework.validation.ObjectError; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException; +import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; + +/** + * 异常处理器 + * + * @author zmj + */ +@Slf4j +@RestControllerAdvice +public class WebExceptionHandler { + + /** + * 处理系统异常 + * + * @param e + * @return + */ + @ExceptionHandler(ClientException.class) + public Response handle(ClientException e, HandlerMethod method) { + + this.logException(e, method); + + this.setResponseCode(e); + + return InvokeResultBuilder.fail(e); + } + + /** + * 处理系统异常 + * + * @param e + * @return + */ + @ExceptionHandler(SysException.class) + public Response handle(SysException e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new DefaultSysException(); + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(ex); + } + + /** + * 处理传入参数类型转换错误异常 + * + * @param e + * @param method + * @return + */ + @ExceptionHandler(UnexpectedTypeException.class) + public Response handle(UnexpectedTypeException e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new InputErrorException(); + + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(ex); + } + + @ExceptionHandler(BindException.class) + public Response handle(BindException e, HandlerMethod method) { + + this.logException(e, method); + + InputErrorException exception = null; + + if (e.getErrorCount() > 0) { + ObjectError objectError = e.getAllErrors().get(0); + + if (objectError instanceof FieldError && "typeMismatch".equals(objectError.getCode())) { + String fieldName = ((FieldError) objectError).getField(); + + Class targetClazz = e.getBindingResult().getTarget().getClass(); + + TypeMismatch typeMismatch = null; + try { + typeMismatch = targetClazz.getDeclaredField(fieldName).getAnnotation(TypeMismatch.class); + } catch (NoSuchFieldException exp) { + throw new DefaultSysException(exp.getMessage()); + } + if (typeMismatch != null) { + exception = new InputErrorException(typeMismatch.message()); + } + } + } + if (exception == null) { + for (ObjectError error : e.getAllErrors()) { + exception = new InputErrorException(error.getDefaultMessage()); + break; + } + + if (exception == null) { + exception = new InputErrorException(); + } + } + + this.setResponseCode(exception); + + return getBuilder(method.getBean()).fail(exception); + } + + @ExceptionHandler(MethodArgumentNotValidException.class) + public Response methodArgumentNotValidException(MethodArgumentNotValidException e, + HandlerMethod method) { + + this.logException(e, method); + InputErrorException exception = null; + for (ObjectError error : e.getBindingResult().getAllErrors()) { + exception = new InputErrorException(error.getDefaultMessage()); + break; + } + + if (exception == null) { + throw new InputErrorException(); + } + + this.setResponseCode(exception); + + return getBuilder(method.getBean()).fail(exception); + } + + /** + * 处理未通过校验异常 + * + * @param e + * @param method + * @return + */ + @ExceptionHandler(ConstraintViolationException.class) + public Response handle(ConstraintViolationException e, HandlerMethod method) { + + this.logException(e, method); + + InputErrorException exception = null; + for (ConstraintViolation constraintViolation : e.getConstraintViolations()) { + exception = new InputErrorException(constraintViolation.getMessage()); + break; + } + + if (exception == null) { + throw new InputErrorException(); + } + + this.setResponseCode(exception); + + return getBuilder(method.getBean()).fail(exception); + } + + /** + * 处理由于传入参数类型不匹配导致的异常 + * + * @param e + * @param method + * @return + */ + @ExceptionHandler(TypeMismatchException.class) + public Response methodArgumentTypeMismatchException(TypeMismatchException e, + HandlerMethod method) { + + this.logException(e, method); + + MethodParameter methodParameter = null; + if (e instanceof MethodArgumentConversionNotSupportedException) { + methodParameter = ((MethodArgumentConversionNotSupportedException) e).getParameter(); + } else if (e instanceof MethodArgumentTypeMismatchException) { + methodParameter = ((MethodArgumentTypeMismatchException) e).getParameter(); + } + + BaseException ex = null; + if (methodParameter != null) { + TypeMismatch typeMismatch = methodParameter.getMethod() + .getParameters()[methodParameter.getParameterIndex()].getAnnotation(TypeMismatch.class); + if (typeMismatch != null) { + ex = new InputErrorException(typeMismatch.message()); + } + } + + if (ex == null) { + ex = new InputErrorException(); + } + + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(ex); + } + + /** + * 处理由于传入参数类型不匹配导致的异常 + * + * @param e + * @param method + * @return + */ + @ExceptionHandler(HttpMessageNotReadableException.class) + public Response invalidFormatException(HttpMessageNotReadableException e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new InputErrorException(); + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(ex); + } + + /** + * 处理由于传入方式错误导致的异常 + * + * @param e + * @param method + * @return + */ + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public Response httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e, + HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new DefaultSysException(); + + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(); + } + + @ExceptionHandler(FileUploadException.class) + public Response fileUploadExceptionHandler(FileUploadException e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new DefaultClientException("文件上传失败!"); + + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(ex); + } + + /** + * 处理Exception + * + * @param e + * @param method + * @return + */ + @ExceptionHandler(Exception.class) + public Response exceptionHandler(Exception e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new DefaultSysException(); + + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(ex); + } + + /** + * 处理Throwable + * + * @param e + * @param method + * @return + */ + @ExceptionHandler(Throwable.class) + public Response throwableHandle(Throwable e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new InputErrorException(); + + this.setResponseCode(ex); + + return getBuilder(method.getBean()).fail(ex); + } + + /** + * 处理无权限异常 + * + * @param e + * @return + */ + @ExceptionHandler(AccessDeniedException.class) + public Response handle(AccessDeniedException e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new AccessDeniedException(); + this.setResponseCode(ex); + + return this.getBuilder(method.getBean()).fail(ex); + } + + @ExceptionHandler(NotPermissionException.class) + public Response notPermissionException(NotPermissionException e, HandlerMethod method) { + + this.logException(e, method); + + BaseException ex = new AccessDeniedException(); + + this.setResponseCode(ex); + + return this.getBuilder(method.getBean()).fail(ex); + } + + protected void logException(Throwable e, HandlerMethod method) { + + if (e instanceof ClientException) { + if (log.isDebugEnabled()) { + String className = method.getBeanType().getName(); + String methodName = method.getMethod().getName(); + log.debug("className={}, methodName={}, 有异常产生", className, methodName, e); + } + } else { + String className = method.getBeanType().getName(); + String methodName = method.getMethod().getName(); + log.error("className={}, methodName={}, 有异常产生", className, methodName, e); + } + } + + protected void setResponseCode(BaseException e) { + //如果请求地址是/ydool开头的,则返回200 + String requestURI = WebUtils.getHttpRequest().getRequestURI(); + if (requestURI.startsWith("/ydool")) { + ResponseUtil.getResponse().setStatus(HttpStatus.OK.value()); + }else { + ResponseUtil.getResponse().setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); + } + } + + protected ResponseErrorBuilder getBuilder(Object bean) { + + Map builders = ApplicationUtil.getBeansOfType( + ResponseErrorBuilder.class); + ResponseErrorBuilder builder = null; + for (ResponseErrorBuilder value : builders.values()) { + if (value.isDefault()) { + builder = value; + break; + } + } + + for (ResponseErrorBuilder value : builders.values()) { + if (value.isMatch(bean)) { + builder = value; + break; + } + } + + return builder; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/permission/DataPermissionHandlerImpl.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/permission/DataPermissionHandlerImpl.java new file mode 100644 index 0000000..0179185 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/permission/DataPermissionHandlerImpl.java @@ -0,0 +1,155 @@ +package com.lframework.xingyun.template.core.components.permission; + +import cn.dev33.satoken.exception.SaTokenException; +import cn.dev33.satoken.session.SaSession; +import cn.dev33.satoken.stp.StpUtil; +import com.baomidou.mybatisplus.extension.plugins.handler.DataPermissionHandler; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.security.SecurityConstants; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.template.core.annotations.permission.DataPermission; +import com.lframework.xingyun.template.core.annotations.permission.DataPermissions; +import com.lframework.xingyun.template.core.service.SysDataPermissionModelDetailService; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import net.sf.jsqlparser.JSQLParserException; +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.operators.conditional.AndExpression; +import net.sf.jsqlparser.parser.CCJSqlParserUtil; + +public class DataPermissionHandlerImpl implements DataPermissionHandler { + + private static final String EMPTY_SQL = "(1 = 1)"; + + @Override + public Expression getSqlSegment(Expression where, String mappedStatementId) { + try { + String sqlSegment = this.convertDataPermissionSql(mappedStatementId); + if (StringUtil.isEmpty(sqlSegment)) { + return null; + } + Expression sqlSegmentExpression = CCJSqlParserUtil.parseCondExpression(sqlSegment); + if (null != where) { + return new AndExpression(where, sqlSegmentExpression); + } + return sqlSegmentExpression; + } catch (JSQLParserException e) { + e.printStackTrace(); + } + return null; + } + + private String getDataPermission(SysDataPermissionDataPermissionType permissionType, + List keys, + List values) { + + Map dataPermissionMap = null; + Map dataPermissionVar = null; + try { + SaSession session = StpUtil.getSession(false); + if (session == null) { + return EMPTY_SQL; + } + dataPermissionMap = (Map) session.get( + SecurityConstants.DATA_PERMISSION_SQL_MAP); + + dataPermissionVar = (Map) session.get( + SecurityConstants.DATA_PERMISSION_SQL_VAR); + if (CollectionUtil.isEmpty(dataPermissionMap)) { + return EMPTY_SQL; + } + } catch (SaTokenException e) { + return EMPTY_SQL; + } + + Assert.notNull(permissionType); + Assert.notNull(keys); + Assert.notNull(values); + + String sqlTemplate = dataPermissionMap.get(permissionType.getCode().toString()); + if (StringUtil.isBlank(sqlTemplate)) { + return EMPTY_SQL; + } + + if (keys.size() != values.size()) { + throw new DefaultSysException("keys和values长度不一致!"); + } + + Map sqlParams = new HashMap<>(); + for (int i = 0; i < keys.size(); i++) { + sqlParams.put(keys.get(i), values.get(i)); + } + + if (CollectionUtil.isNotEmpty(dataPermissionVar)) { + dataPermissionVar.forEach((k, v) -> { + sqlParams.put("__var#" + k, v); + }); + } + + SysDataPermissionModelDetailService sysDataPermissionModelDetailService = ApplicationUtil.getBean( + SysDataPermissionModelDetailService.class); + return sysDataPermissionModelDetailService.formatSql(sqlTemplate, sqlParams); + } + + private String convertDataPermissionSql(String statementId) { + // 获取Mapper执行方法上的注解 + Method mapperMethod = null; + try { + mapperMethod = this.findMapperMethod(this.convertMsId(statementId)); + } catch (ClassNotFoundException e) { + return null; + } + if (mapperMethod == null) { + return null; + } + DataPermissions dataPermissions = mapperMethod.getAnnotation(DataPermissions.class); + + if (dataPermissions != null) { + SysDataPermissionDataPermissionType dataPermissionType = dataPermissions.type(); + DataPermission[] dataPermissionList = dataPermissions.value(); + String dataPermissionSql = this.getDataPermission(dataPermissionType, + Arrays.stream(dataPermissionList).map(DataPermission::template) + .collect(Collectors.toList()), + Arrays.stream(dataPermissionList).map(DataPermission::alias) + .collect(Collectors.toList())); + + return dataPermissionSql; + } + + return null; + } + + private String convertMsId(String id) { + String pageHelperSuffix = "_COUNT"; + if (id.endsWith(pageHelperSuffix)) { + return id.substring(0, id.length() - pageHelperSuffix.length()); + } + + String mpSuffix = "_mpCount"; + if (id.endsWith(mpSuffix)) { + return id.substring(0, id.length() - mpSuffix.length()); + } + + return id; + } + + private Method findMapperMethod(String statementId) + throws ClassNotFoundException { + int lastDotIndex = statementId.lastIndexOf("."); + String className = statementId.substring(0, lastDotIndex); + String methodName = statementId.substring(lastDotIndex + 1); + + Class mapperInterface = Class.forName(className); + return Arrays.stream(mapperInterface.getDeclaredMethods()) + .filter(method -> method.getName().equals(methodName)) + .findFirst() + .orElse(null); + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/permission/SysDataPermissionDataPermissionType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/permission/SysDataPermissionDataPermissionType.java new file mode 100644 index 0000000..e908f51 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/permission/SysDataPermissionDataPermissionType.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.core.components.permission; + +public enum SysDataPermissionDataPermissionType { + + PRODUCT(1, "商品"), ORDER(2, "单据"); + + private Integer code; + + private String desc; + + SysDataPermissionDataPermissionType(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + public Integer getCode() { + return this.code; + } + + public String getDesc() { + return desc; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/qrtz/QrtzHandler.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/qrtz/QrtzHandler.java new file mode 100644 index 0000000..95aedf9 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/qrtz/QrtzHandler.java @@ -0,0 +1,321 @@ +package com.lframework.xingyun.template.core.components.qrtz; + +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import java.util.Map; +import lombok.extern.slf4j.Slf4j; +import org.quartz.CronScheduleBuilder; +import org.quartz.CronTrigger; +import org.quartz.JobBuilder; +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.quartz.Trigger; +import org.quartz.TriggerBuilder; +import org.quartz.TriggerKey; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; + +@Slf4j +public class QrtzHandler { + + private static final SchedulerFactoryBean SCHEDULER_FACTORY = ApplicationUtil.getBean( + SchedulerFactoryBean.class); + + public static void addJob(Class jobClass, String cron, + Map jobDatas) { + + addJob(null, null, jobClass, null, null, cron, jobDatas); + } + + public static void addJob(Class jobClass, String cron) { + + addJob(null, null, jobClass, null, null, cron, null); + } + + public static void addJob(String jobName, String jobGroupName, Class jobClass, + String triggerName, String triggerGroupName, String cron) { + + addJob(jobName, jobGroupName, jobClass, triggerName, triggerGroupName, cron, null); + } + + public static void addJob(String jobName, String jobGroupName, Class jobClass, + String triggerName, String triggerGroupName, String cron, Map jobDatas) { + + addJob(jobName, jobGroupName, jobClass, triggerName, triggerGroupName, cron, jobDatas, null); + } + + /** + * 添加任务 + * + * @param jobName 任务名 + * @param jobGroupName 任务组名 + * @param jobClass 任务类Class + * @param triggerName 触发器名 + * @param triggerGroupName 触发器组名 + * @param cron cron表达式 + * @param jobDatas 附加数据 + */ + public static void addJob(String jobName, String jobGroupName, Class jobClass, + String triggerName, String triggerGroupName, String cron, Map jobDatas, + String description) { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + JobBuilder jobBuilder = JobBuilder.newJob(jobClass); + if (!StringUtil.isBlank(jobName)) { + jobBuilder.withIdentity(jobName, jobGroupName); + } + + JobDetail jobDetail = jobBuilder.withDescription( + StringUtil.isBlank(description) ? StringPool.EMPTY_STR : description).build(); + if (!CollectionUtil.isEmpty(jobDatas)) { + jobDatas.forEach((k, v) -> jobDetail.getJobDataMap().put(k, v)); + } + + TriggerBuilder triggerBuilder = TriggerBuilder.newTrigger(); + if (!StringUtil.isBlank(triggerName)) { + triggerBuilder.withIdentity(triggerName, triggerGroupName); + } + + triggerBuilder.startNow(); + triggerBuilder.withSchedule(CronScheduleBuilder.cronSchedule(cron)); + CronTrigger trigger = (CronTrigger) triggerBuilder.build(); + sched.scheduleJob(jobDetail, trigger); + + if (!sched.isShutdown()) { + sched.start(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 查询触发器 + * + * @param triggerName 触发器名称 + * @param triggerGroupName 触发器组名称 + * @return + */ + public static CronTrigger getTrigger(String triggerName, String triggerGroupName) { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + TriggerKey triggerKey = TriggerKey.triggerKey(triggerName, triggerGroupName); + CronTrigger trigger = (CronTrigger) sched.getTrigger(triggerKey); + + return trigger; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 查询任务 + * + * @param jobName + * @param jobGroupName + * @return + */ + public static JobDetail getJob(String jobName, String jobGroupName) { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + JobDetail jobDetail = sched.getJobDetail(JobKey.jobKey(jobName, jobGroupName)); + return jobDetail; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 修改任务Cron + * + * @param triggerName 触发器名称 + * @param triggerGroupName 触发器组名称 + * @param cron cron表达式 + */ + public static void updateJobCron(String triggerName, String triggerGroupName, String cron) { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + CronTrigger trigger = getTrigger(triggerName, triggerGroupName); + if (trigger == null) { + return; + } + + String oriCron = trigger.getCronExpression(); + if (!oriCron.equalsIgnoreCase(cron)) { + TriggerBuilder triggerBuilder = TriggerBuilder.newTrigger(); + triggerBuilder.withIdentity(triggerName, triggerGroupName); + triggerBuilder.startNow(); + triggerBuilder.withSchedule(CronScheduleBuilder.cronSchedule(cron)); + trigger = (CronTrigger) triggerBuilder.build(); + sched.rescheduleJob(TriggerKey.triggerKey(triggerName, triggerGroupName), trigger); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 删除任务 + * + * @param jobName 任务名称 + * @param jobGroupName 任务组名称 + * @param triggerName 触发器名称 + * @param triggerGroupName 触发器组名称 + */ + public static void deleteJob(String jobName, String jobGroupName, String triggerName, + String triggerGroupName) { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + + TriggerKey triggerKey = TriggerKey.triggerKey(triggerName, triggerGroupName); + + sched.pauseTrigger(triggerKey); + sched.unscheduleJob(triggerKey); + sched.deleteJob(JobKey.jobKey(jobName, jobGroupName)); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 启动所有任务 + */ + public static void startJobs() { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + sched.start(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 关闭所有任务 + */ + public static void shutdownJobs() { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + if (!sched.isShutdown()) { + sched.shutdown(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 安全关闭 + * + * @throws SchedulerException + */ + public static void safeShutdown() throws SchedulerException { + + try { + DynamicDataSourceContextHolder.push("master"); + int executingJobSize = SCHEDULER_FACTORY.getScheduler().getCurrentlyExecutingJobs().size(); + log.info("当前运行任务个数:{},等待完成后关闭", executingJobSize); + SCHEDULER_FACTORY.getScheduler().shutdown(true); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 恢复任务 + * + * @param jobName + * @param jobGroupName + */ + public static void resume(String jobName, String jobGroupName) { + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + sched.resumeJob(JobKey.jobKey(jobName, jobGroupName)); + } catch (SchedulerException e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 暂停任务 + * + * @param jobName + * @param jobGroupName + */ + public static void pause(String jobName, String jobGroupName) { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + sched.pauseJob(JobKey.jobKey(jobName, jobGroupName)); + } catch (SchedulerException e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + /** + * 触发任务 + * + * @param jobName + * @param jobGroupName + */ + public static void trigger(String jobName, String jobGroupName) { + + try { + DynamicDataSourceContextHolder.push("master"); + Scheduler sched = SCHEDULER_FACTORY.getScheduler(); + sched.triggerJob(JobKey.jobKey(jobName, jobGroupName)); + } catch (SchedulerException e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } finally { + DynamicDataSourceContextHolder.poll(); + } + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/qrtz/QrtzJob.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/qrtz/QrtzJob.java new file mode 100644 index 0000000..cf7c53d --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/components/qrtz/QrtzJob.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.template.core.components.qrtz; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.ClientException; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import java.io.Serializable; +import lombok.extern.slf4j.Slf4j; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +/** + * 定时任务 + */ +@Slf4j +@DisallowConcurrentExecution +public abstract class QrtzJob implements Job, Serializable { + + private static final long serialVersionUID = 1L; + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + + log.info("开始执行定时任务【{}】", this.getClass().getName()); + long begTime = System.currentTimeMillis(); + + try { + // 这里获取tenantId 如果为空则不设置租户ID + Integer tenantId = (Integer) context.getJobDetail().getJobDataMap().get(StringPool.TENANT_ID_QRTZ); + if (tenantId != null) { + TenantContextHolder.setTenantId(tenantId); + } + this.onExecute(context); + long endTime = System.currentTimeMillis(); + log.info("定时任务【{}】执行完毕,共耗时{}ms", this.getClass().getName(), endTime - begTime); + } catch (Exception e) { + if (e instanceof ClientException) { + log.warn("执行定时任务【{}】失败", this.getClass().getName()); + log.warn(e.getMessage(), e); + } else { + log.error("执行定时任务【{}】失败", this.getClass().getName()); + log.error(e.getMessage(), e); + } + throw new JobExecutionException(e); + } finally { + TenantContextHolder.clearTenantId(); + } + } + + protected abstract void onExecute(JobExecutionContext context) throws Exception; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/config/MpInterceptorConfiguration.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/config/MpInterceptorConfiguration.java new file mode 100644 index 0000000..11b9135 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/config/MpInterceptorConfiguration.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.template.core.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.DataPermissionInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.lframework.xingyun.template.core.components.permission.DataPermissionHandlerImpl; +import com.lframework.xingyun.template.core.interceptors.CustomSortInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class MpInterceptorConfiguration { + + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor( + new DataPermissionInterceptor(new DataPermissionHandlerImpl())); + interceptor.addInnerInterceptor(new CustomSortInterceptor()); + interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); + return interceptor; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/dto/DeptDto.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/dto/DeptDto.java new file mode 100644 index 0000000..25820f6 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/dto/DeptDto.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.core.dto; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class DeptDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "DeptDto"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/dto/UserDto.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/dto/UserDto.java new file mode 100644 index 0000000..96e1d67 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/dto/UserDto.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.core.dto; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +/** + * 用户Dto + * + * @author zmj + */ +@Data +public class UserDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "UserDto"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 姓名 + */ + private String name; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/OpLogs.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/OpLogs.java new file mode 100644 index 0000000..6d685c1 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/OpLogs.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.template.core.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 操作日志实体类 + *

+ * + * @author zmj + */ +@Data +@TableName("op_logs") +public class OpLogs extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 日志名称 + */ + private String name; + + /** + * 类别 + */ + private Integer logType; + + /** + * IP地址 + */ + private String ip; + + /** + * 补充信息 + */ + private String extra; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/RecursionMapping.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/RecursionMapping.java new file mode 100644 index 0000000..655c7d3 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/RecursionMapping.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.core.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * 递归映射 + *

+ * + * @author zmj + * @since 2021-06-27 + */ +@Data +@TableName("recursion_mapping") +public class RecursionMapping extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 节点ID + */ + private String nodeId; + + /** + * 节点类型 + */ + private Integer nodeType; + + /** + * 从顶点到当前结点的路径,用,分割 + */ + private String path; + + /** + * 节点层级 + */ + private Integer level; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysDataPermissionData.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysDataPermissionData.java new file mode 100644 index 0000000..aa27649 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysDataPermissionData.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.template.core.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.template.core.enums.SysDataPermissionDataBizType; +import lombok.Data; + +/** + *

+ * 数据权限数据 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_data_permission_data") +public class SysDataPermissionData extends BaseEntity implements BaseDto { + + /** + * ID + */ + private String id; + + /** + * 业务ID + */ + private String bizId; + + /** + * 业务类型 + */ + private SysDataPermissionDataBizType bizType; + + /** + * 权限类型 + */ + private Integer permissionType; + + /** + * 权限 + */ + private String permission; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysDataPermissionModelDetail.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysDataPermissionModelDetail.java new file mode 100644 index 0000000..462dad9 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysDataPermissionModelDetail.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.template.core.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailInputType; +import lombok.Data; + +/** + *

+ * 数据权限模型明细 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_data_permission_model_detail") +public class SysDataPermissionModelDetail extends BaseEntity implements BaseDto { + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 名称 + */ + private String name; + + /** + * 模型ID + */ + private Integer modelId; + + /** + * 条件 + */ + private String conditionType; + + /** + * 输入类型 + */ + private SysDataPermissionModelDetailInputType inputType; + + /** + * 表名 + */ + private String tableName; + + /** + * 字段名 + */ + private String columnName; + + /** + * 前段枚举名 + */ + private String enumName; + + /** + * SQL + */ + private String sqlValue; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysUser.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysUser.java new file mode 100644 index 0000000..c90dead --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/entity/SysUser.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.template.core.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.template.core.enums.Gender; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-04 + */ +@Data +@TableName("sys_user") +public class SysUser extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SysUser"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 姓名 + */ + private String name; + + /** + * 用户名 + */ + private String username; + + /** + * 密码 + */ + private String password; + + /** + * 邮箱 + */ + private String email; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 性别 0-未知 1-男 2-女 + */ + private Gender gender; + + /** + * 状态 1-在用 0停用 + */ + private Boolean available; + + /** + * 锁定状态 + */ + private Boolean lockStatus; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/Available.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/Available.java new file mode 100644 index 0000000..597ce0e --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/Available.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum Available implements BaseEnum { + ENABLE(Boolean.TRUE, "启用"), UNABLE(Boolean.FALSE, "停用"); + + + @EnumValue + private final Boolean code; + + private final String desc; + + Available(Boolean code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Boolean getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/DefaultOpLogType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/DefaultOpLogType.java new file mode 100644 index 0000000..3d42c74 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/DefaultOpLogType.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.core.enums; + +/** + * 默认操作日志类别 + * + * @author zmj + */ +public interface DefaultOpLogType { + + /** + * 用户认证 + */ + int AUTH = 1; + + /** + * 系统管理 + */ + int SYSTEM = 2; + + /** + * 其他 + */ + int OTHER = 99; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/Gender.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/Gender.java new file mode 100644 index 0000000..a3d51d5 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/Gender.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum Gender implements BaseEnum { + UNKNOWN(0, "未知"), MAN(1, "男"), FEMALE(2, "女"); + + @EnumValue + private final Integer code; + + private final String desc; + + Gender(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/NodeType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/NodeType.java new file mode 100644 index 0000000..5fa2615 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/NodeType.java @@ -0,0 +1,7 @@ +package com.lframework.xingyun.template.core.enums; + +import com.lframework.starter.web.enums.BaseEnum; + +public interface NodeType extends BaseEnum { + +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionDataBizType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionDataBizType.java new file mode 100644 index 0000000..a4897c8 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionDataBizType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SysDataPermissionDataBizType implements BaseEnum { + ROLE(0, "角色"), DEPT(1, "部门"), USER(2, "用户"); + + @EnumValue + private final Integer code; + + private final String desc; + + SysDataPermissionDataBizType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailCalcType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailCalcType.java new file mode 100644 index 0000000..13c070f --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailCalcType.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.template.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SysDataPermissionModelDetailCalcType implements BaseEnum { + + AND(1, "AND", "并且"), OR(2, "OR", "或者"); + + @EnumValue + private final Integer code; + + private String operation; + + private final String desc; + + SysDataPermissionModelDetailCalcType(Integer code, String operation, String desc) { + + this.code = code; + this.operation = operation; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } + + public String getOperation() { + return operation; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailConditionType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailConditionType.java new file mode 100644 index 0000000..bb8b0a4 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailConditionType.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SysDataPermissionModelDetailConditionType implements BaseEnum { + + EQ(0, "=", "等于"), GT(1, ">", "大于"), GE(2, ">=", "大于或等于"), LT(3, "<", "小于"), LE(4, "<=", + "小于或等于"), NE(5, + "!=", "不等于"), IN(6, "IN", "在列表中"), NOT_IN(7, + "NOT IN", "不在列表中"), LEFT_LIKE(8, "LIKE", "结尾"), RIGHT_LIKE(9, "LIKE", + "开头"), AROUND_LIKE(10, "LIKE", "包含"); + + @EnumValue + private final Integer code; + + private final String operation; + + private final String desc; + + SysDataPermissionModelDetailConditionType(Integer code, String operation, String desc) { + + this.code = code; + this.operation = operation; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } + + public String getOperation() { + return operation; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailInputType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailInputType.java new file mode 100644 index 0000000..b9f1b1e --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailInputType.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SysDataPermissionModelDetailInputType implements BaseEnum { + + INPUT(0, "输入框"), SELECT(1, "选择器"), DATE_TIME(2, "日期时间选择器"), DATE(3, + "日期选择器"), SQL(99, "SQL"); + + @EnumValue + private final Integer code; + + private final String desc; + + SysDataPermissionModelDetailInputType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailNodeType.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailNodeType.java new file mode 100644 index 0000000..507b2ce --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/enums/SysDataPermissionModelDetailNodeType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SysDataPermissionModelDetailNodeType implements BaseEnum { + + CALC(1, "运算节点"), CONDITION(2, "条件节点"); + + @EnumValue + private final Integer code; + + private final String desc; + + SysDataPermissionModelDetailNodeType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/DeptServiceImpl.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/DeptServiceImpl.java new file mode 100644 index 0000000..460fb8a --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/DeptServiceImpl.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.core.impl; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.dto.DeptDto; +import com.lframework.xingyun.template.core.mappers.DeptMapper; +import com.lframework.xingyun.template.core.service.DeptService; +import java.io.Serializable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +/** + * @author zmj + */ +@Service +public class DeptServiceImpl implements DeptService { + + @Autowired + private DeptMapper deptMapper; + + @Cacheable(value = DeptDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public DeptDto findById(String id) { + + if (StringUtil.isBlank(id)) { + return null; + } + + return deptMapper.findById(id); + } + + @Override + public DeptDto findByCode(String code) { + return deptMapper.findByCode(code); + } + + @CacheEvict(value = {DeptDto.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/OpLogsServiceImpl.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/OpLogsServiceImpl.java new file mode 100644 index 0000000..abad287 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/OpLogsServiceImpl.java @@ -0,0 +1,120 @@ +package com.lframework.xingyun.template.core.impl; + +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.mappers.OpLogsMapper; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.vo.CreateOpLogsVo; +import com.lframework.xingyun.template.core.vo.QueryOpLogsVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * 操作日志Service实现 + * + * @author zmj + */ +@Slf4j +@Service +public class OpLogsServiceImpl extends BaseMpServiceImpl + implements OpLogsService { + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateOpLogsVo vo) { + + OpLogs record = this.doCreate(vo); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void create(Collection list) { + if (CollectionUtil.isEmpty(list)) { + return; + } + List records = list.stream().map(this::doCreate).collect(Collectors.toList()); + this.saveBatch(records); + } + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryOpLogsVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.doQuery(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public OpLogs findById(String id) { + + return this.doGetById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void clearLogs(LocalDateTime endTime) { + + log.info("开始清除创建时间早于{}的操作日志", endTime); + + this.doClearLogs(endTime); + } + + protected OpLogs doCreate(CreateOpLogsVo vo) { + + OpLogs record = new OpLogs(); + record.setId(IdUtil.getId()); + record.setName(vo.getName()); + record.setLogType(vo.getLogType()); + if (!StringUtil.isBlank(vo.getCreateBy())) { + record.setCreateBy(vo.getCreateBy()); + } + + if (!StringUtil.isBlank(vo.getCreateById())) { + record.setCreateById(vo.getCreateById()); + } + + if (!StringUtil.isBlank(vo.getExtra())) { + record.setExtra(vo.getExtra()); + } + record.setIp(vo.getIp()); + + return record; + } + + protected List doQuery(QueryOpLogsVo vo) { + + return getBaseMapper().query(vo); + } + + protected OpLogs doGetById(String id) { + + return getBaseMapper().findById(id); + } + + protected void doClearLogs(LocalDateTime endTime) { + + getBaseMapper().clearLogs(endTime); + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/RecursionMappingServiceImpl.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/RecursionMappingServiceImpl.java new file mode 100644 index 0000000..2c4b71a --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/RecursionMappingServiceImpl.java @@ -0,0 +1,102 @@ +package com.lframework.xingyun.template.core.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.entity.RecursionMapping; +import com.lframework.xingyun.template.core.enums.NodeType; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.xingyun.template.core.mappers.RecursionMappingMapper; +import java.util.ArrayList; +import java.util.List; +import lombok.NonNull; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class RecursionMappingServiceImpl extends + BaseMpServiceImpl + implements RecursionMappingService { + + @Override + public List getNodeParentIds(@NonNull String nodeId, @NonNull NodeType nodeType) { + + if (StringUtil.isEmpty(nodeId)) { + return CollectionUtil.emptyList(); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(RecursionMapping.class) + .eq(RecursionMapping::getNodeId, nodeId) + .eq(RecursionMapping::getNodeType, nodeType.getCode()); + + RecursionMapping recursionMappings = getBaseMapper().selectOne(queryWrapper); + if (recursionMappings == null || StringUtil.isEmpty(recursionMappings.getPath())) { + return CollectionUtil.emptyList(); + } + + return StringUtil.split(recursionMappings.getPath(), StringPool.STR_SPLIT); + } + + @Override + public List getNodeChildIds(String nodeId, NodeType nodeType) { + + return getBaseMapper().getNodeChildIds(nodeId, nodeType.getCode()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveNode(String nodeId, NodeType nodeType) { + + this.saveNode(nodeId, nodeType, null); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteNode(String nodeId, NodeType nodeType) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(RecursionMapping.class) + .eq(RecursionMapping::getNodeId, nodeId) + .eq(RecursionMapping::getNodeType, nodeType.getCode()); + getBaseMapper().delete(deleteWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteNodeAndChildren(String nodeId, NodeType nodeType) { + List childNodeIds = this.getNodeChildIds(nodeId, nodeType); + List allNodeIds = new ArrayList<>(); + allNodeIds.add(nodeId); + allNodeIds.addAll(childNodeIds); + Wrapper deleteWrapper = Wrappers.lambdaQuery(RecursionMapping.class) + .in(RecursionMapping::getNodeId, allNodeIds) + .eq(RecursionMapping::getNodeType, nodeType.getCode()); + getBaseMapper().delete(deleteWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveNode(@NonNull String nodeId, @NonNull NodeType nodeType, List parentIds) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(RecursionMapping.class) + .eq(RecursionMapping::getNodeId, nodeId) + .eq(RecursionMapping::getNodeType, nodeType.getCode()); + getBaseMapper().delete(deleteWrapper); + + RecursionMapping data = new RecursionMapping(); + data.setId(IdUtil.getId()); + data.setNodeId(nodeId); + data.setNodeType(nodeType.getCode()); + data.setLevel(1); + data.setPath(StringPool.EMPTY_STR); + if (!CollectionUtil.isEmpty(parentIds)) { + data.setPath(StringUtil.join(StringPool.STR_SPLIT, parentIds)); + data.setLevel(parentIds.size() + 1); + } + + getBaseMapper().insert(data); + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/SysDataPermissionModelDetailServiceImpl.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/SysDataPermissionModelDetailServiceImpl.java new file mode 100644 index 0000000..9734d1a --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/SysDataPermissionModelDetailServiceImpl.java @@ -0,0 +1,145 @@ +package com.lframework.xingyun.template.core.impl; + +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.xingyun.template.core.vo.permission.SysDataPermissionModelDetailVo; +import com.lframework.xingyun.template.core.entity.SysDataPermissionModelDetail; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailCalcType; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailConditionType; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailInputType; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailNodeType; +import com.lframework.xingyun.template.core.mappers.SysDataPermissionModelDetailMapper; +import com.lframework.xingyun.template.core.service.SysDataPermissionModelDetailService; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; + +@Service +public class SysDataPermissionModelDetailServiceImpl extends + BaseMpServiceImpl implements + SysDataPermissionModelDetailService { + + @Override + public String toSql(List models) { + if (CollectionUtil.isEmpty(models)) { + return null; + } + + StringBuilder builder = new StringBuilder(); + + for (SysDataPermissionModelDetailVo model : models) { + SysDataPermissionModelDetailNodeType nodeType = EnumUtil.getByCode( + SysDataPermissionModelDetailNodeType.class, model.getNodeType()); + if (nodeType == SysDataPermissionModelDetailNodeType.CALC) { + SysDataPermissionModelDetailCalcType calcType = EnumUtil.getByCode( + SysDataPermissionModelDetailCalcType.class, model.getCalcType()); + if (CollectionUtil.isNotEmpty(model.getChildren())) { + builder.append(" ("); + builder.append(this.buildChildrenSql(model.getChildren(), calcType.getOperation())); + builder.append(") "); + } + builder.append("AND "); + } else { + throw new DefaultSysException("nodeType有误,请检查!"); + } + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - 4); + } + return builder.toString(); + } + + @Override + public String formatSql(String sqlTemplate, Map params) { + return StringUtil.format(sqlTemplate, params); + } + + private String buildChildrenSql(List children, String operation) { + if (CollectionUtil.isEmpty(children)) { + return ""; + } + + StringBuilder builder = new StringBuilder(); + for (SysDataPermissionModelDetailVo child : children) { + SysDataPermissionModelDetailNodeType nodeType = EnumUtil.getByCode( + SysDataPermissionModelDetailNodeType.class, child.getNodeType()); + if (nodeType == SysDataPermissionModelDetailNodeType.CALC) { + SysDataPermissionModelDetailCalcType calcType = EnumUtil.getByCode( + SysDataPermissionModelDetailCalcType.class, child.getCalcType()); + if (CollectionUtil.isNotEmpty(child.getChildren())) { + builder.append(" ("); + builder.append(this.buildChildrenSql(child.getChildren(), calcType.getOperation())); + builder.append(")"); + builder.append(operation).append(" "); + } + } else { + SysDataPermissionModelDetailConditionType conditionType = EnumUtil.getByCode( + SysDataPermissionModelDetailConditionType.class, child.getConditionType()); + SysDataPermissionModelDetail record = this.getById(child.getDetailId()); + builder.append("{").append(record.getTableName()).append("}.") + .append(record.getColumnName()).append(" ").append(conditionType.getOperation()) + .append(" ").append(this.buildLeft(conditionType)) + .append(this.buildValue(child, record)) + .append(this.buildRight(conditionType)).append(" ").append(operation).append(" "); + } + } + + if (builder.length() > 0) { + builder.setLength(builder.length() - operation.length() - 1); + } + + return builder.toString(); + } + + private String buildLeft(SysDataPermissionModelDetailConditionType conditionType) { + if (conditionType == SysDataPermissionModelDetailConditionType.IN + || conditionType == SysDataPermissionModelDetailConditionType.NOT_IN) { + return "("; + } else if (conditionType == SysDataPermissionModelDetailConditionType.LEFT_LIKE) { + return "CONCAT('%',"; + } else if (conditionType == SysDataPermissionModelDetailConditionType.RIGHT_LIKE) { + return "CONCAT("; + } else if (conditionType == SysDataPermissionModelDetailConditionType.AROUND_LIKE) { + return "CONCAT('%',"; + } + + return ""; + } + + private String buildRight(SysDataPermissionModelDetailConditionType conditionType) { + if (conditionType == SysDataPermissionModelDetailConditionType.IN + || conditionType == SysDataPermissionModelDetailConditionType.NOT_IN) { + return ")"; + } else if (conditionType == SysDataPermissionModelDetailConditionType.LEFT_LIKE) { + return ")"; + } else if (conditionType == SysDataPermissionModelDetailConditionType.RIGHT_LIKE) { + return ",'%')"; + } else if (conditionType == SysDataPermissionModelDetailConditionType.AROUND_LIKE) { + return ",'%')"; + } + + return ""; + } + + private String buildValue(SysDataPermissionModelDetailVo child, + SysDataPermissionModelDetail record) { + SysDataPermissionModelDetailConditionType conditionType = EnumUtil.getByCode( + SysDataPermissionModelDetailConditionType.class, child.getConditionType()); + if (conditionType == SysDataPermissionModelDetailConditionType.IN + || conditionType == SysDataPermissionModelDetailConditionType.NOT_IN) { + if (record.getInputType() == SysDataPermissionModelDetailInputType.SQL) { + return record.getSqlValue(); + } else { + return CollectionUtil.join( + child.getValues().stream().map(t -> "'" + t + "'").collect(Collectors.toList()), ","); + } + } + + return "'" + child.getValue() + "'"; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/UserServiceImpl.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/UserServiceImpl.java new file mode 100644 index 0000000..a2589bd --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/impl/UserServiceImpl.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.template.core.impl; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.core.mappers.UserMapper; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.dto.UserDto; +import java.io.Serializable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +/** + * 默认用户Service实现 + * + * @author zmj + */ +@Service +public class UserServiceImpl implements UserService { + + @Autowired + private UserMapper userMapper; + + @Cacheable(value = UserDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public UserDto findById(String id) { + + if (StringUtil.isBlank(id)) { + return null; + } + + return userMapper.findById(id); + } + + @Override + public UserDto findByCode(String code) { + return userMapper.findByCode(code); + } + + @CacheEvict(value = {UserDto.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/interceptors/CustomSortInterceptor.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/interceptors/CustomSortInterceptor.java new file mode 100644 index 0000000..c3fdcb7 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/interceptors/CustomSortInterceptor.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.template.core.interceptors; + +import com.baomidou.mybatisplus.core.toolkit.PluginUtils; +import com.baomidou.mybatisplus.extension.parser.JsqlParserSupport; +import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.vo.SortPageVo; +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import java.lang.reflect.Method; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import net.sf.jsqlparser.JSQLParserException; +import net.sf.jsqlparser.parser.CCJSqlParser; +import net.sf.jsqlparser.parser.CCJSqlParserUtil; +import net.sf.jsqlparser.parser.ParseException; +import net.sf.jsqlparser.statement.Statement; +import net.sf.jsqlparser.statement.select.PlainSelect; +import net.sf.jsqlparser.statement.select.Select; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; + +@Slf4j +public class CustomSortInterceptor extends JsqlParserSupport implements InnerInterceptor { + + @Override + public void beforeQuery( + Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, + ResultHandler resultHandler, BoundSql boundSql) throws SQLException { + if (parameter instanceof Map) { + Map map = (Map) parameter; + List sortPageVos = map.values().stream() + .filter(t -> t instanceof SortPageVo).map(t -> (SortPageVo) t) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(sortPageVos)) { + return; + } + Map sortMap = this.convertSortMap(ms.getId()); + if (CollectionUtil.isEmpty(sortMap)) { + return; + } + + StringBuilder sqlBuilder = new StringBuilder("ORDER BY "); + + List orderBySqlElements = sortPageVos.stream() + .filter(t -> sortMap.containsKey(t.getSortField())).map( + t -> sortMap.get(t.getSortField()) + " " + ( + "asc".equalsIgnoreCase(t.getSortOrder()) ? "ASC" : "DESC")).distinct() + .collect( + Collectors.toList()); + + if (CollectionUtil.isEmpty(orderBySqlElements)) { + return; + } + + // order by code asc, name desc + String sqlProvider = sqlBuilder.append(StringUtil.join(",", orderBySqlElements)) + .toString(); + + CCJSqlParser parser = CCJSqlParserUtil.newParser(sqlProvider); + + PluginUtils.MPBoundSql mpBs = PluginUtils.mpBoundSql(boundSql); + + String sql = mpBs.sql(); + try { + Statement statement = CCJSqlParserUtil.parse(sql); + PlainSelect plainSelect = (PlainSelect) ((Select) statement).getSelectBody(); + plainSelect.setOrderByElements(parser.OrderByElements()); + mpBs.sql(statement.toString()); + } catch (JSQLParserException | ParseException e) { + log.error("Failed to process, Error SQL: {}", sql); + log.error(e.getMessage(), e); + } + } + } + + private Map convertSortMap(String statementId) { + // 获取Mapper执行方法上的注解 + Method mapperMethod = null; + try { + mapperMethod = this.findMapperMethod(this.convertMsId(statementId)); + } catch (ClassNotFoundException e) { + return null; + } + if (mapperMethod == null) { + return null; + } + Sorts sorts = mapperMethod.getAnnotation(Sorts.class); + + if (sorts != null) { + Sort[] sortList = sorts.value(); + Map sortKeyMap = new HashMap<>(sortList.length); + for (Sort sort : sortList) { + if (sort.autoParse()) { + sortKeyMap.put(sort.value(), (StringUtil.isEmpty(sort.alias()) ? "" : (sort.alias() + ".")) + StringUtil.toUnderlineCase(sort.value())); + } else { + sortKeyMap.put(sort.value(), sort.alias()); + } + } + + return sortKeyMap; + } + + return null; + } + + private String convertMsId(String id) { + return id; + } + + private Method findMapperMethod(String statementId) + throws ClassNotFoundException { + int lastDotIndex = statementId.lastIndexOf("."); + String className = statementId.substring(0, lastDotIndex); + String methodName = statementId.substring(lastDotIndex + 1); + + Class mapperInterface = Class.forName(className); + return Arrays.stream(mapperInterface.getDeclaredMethods()) + .filter(method -> method.getName().equals(methodName)) + .findFirst() + .orElse(null); + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/DeptMapper.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/DeptMapper.java new file mode 100644 index 0000000..5050f09 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/DeptMapper.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.template.core.mappers; + +import com.lframework.xingyun.template.core.dto.DeptDto; + +/** + * @author zmj + */ +public interface DeptMapper { + + /** + * 根据ID查询 主要用于各个业务关联查询信息 + * + * @param id + * @return + */ + DeptDto findById(String id); + + /** + * 根据编号查询 + * + * @param code + * @return + */ + DeptDto findByCode(String code); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/OpLogsMapper.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/OpLogsMapper.java new file mode 100644 index 0000000..6691cfa --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/OpLogsMapper.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.template.core.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.vo.QueryOpLogsVo; +import java.time.LocalDateTime; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 操作日志 Mapper + *

+ * + * @author zmj + */ +public interface OpLogsMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryOpLogsVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + OpLogs findById(String id); + + /** + * 根据截止时间删除日志 + * + * @param endTime + */ + void clearLogs(@Param("endTime") LocalDateTime endTime); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/RecursionMappingMapper.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/RecursionMappingMapper.java new file mode 100644 index 0000000..13e5513 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/RecursionMappingMapper.java @@ -0,0 +1,19 @@ +package com.lframework.xingyun.template.core.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.core.entity.RecursionMapping; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 递归映射 Mapper 接口 + *

+ * + * @author zmj + * @since 2021-06-27 + */ +public interface RecursionMappingMapper extends BaseMapper { + + List getNodeChildIds(@Param("nodeId") String nodeId, @Param("nodeType") Integer nodeType); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/SysDataPermissionModelDetailMapper.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/SysDataPermissionModelDetailMapper.java new file mode 100644 index 0000000..9398f06 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/SysDataPermissionModelDetailMapper.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.template.core.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.core.entity.SysDataPermissionModelDetail; + +public interface SysDataPermissionModelDetailMapper extends + BaseMapper { + +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/UserMapper.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/UserMapper.java new file mode 100644 index 0000000..e8f2fc8 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/mappers/UserMapper.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.core.mappers; + +import com.lframework.xingyun.template.core.dto.UserDto; + +/** + * 默认UserMapper + * + * @author zmj + */ +public interface UserMapper { + + /** + * 根据ID查询 主要用于各个业务关联查询用户信息 + * + * @param id + * @return + */ + UserDto findById(String id); + + /** + * 根据编号查询 + * + * @param code + * @return + */ + UserDto findByCode(String code); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/DeptService.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/DeptService.java new file mode 100644 index 0000000..f33c5a1 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/DeptService.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.core.service; + +import com.lframework.starter.web.service.BaseService; +import com.lframework.xingyun.template.core.dto.DeptDto; + +/** + * 部门Service + * + * @author zmj + */ +public interface DeptService extends BaseService { + + /** + * 根据ID查询 主要用于各个业务关联查询信息 + * + * @param id + * @return + */ + DeptDto findById(String id); + + /** + * 根据编号查询 + * + * @param code + * @return + */ + DeptDto findByCode(String code); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/OpLogsService.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/OpLogsService.java new file mode 100644 index 0000000..1537d09 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/OpLogsService.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.template.core.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.vo.CreateOpLogsVo; +import com.lframework.xingyun.template.core.vo.QueryOpLogsVo; +import java.time.LocalDateTime; +import java.util.Collection; + +/** + * 操作日志Service + * + * @author zmj + */ +public interface OpLogsService extends BaseMpService { + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateOpLogsVo vo); + + /** + * 创建 + * + * @param list + * @return + */ + void create(Collection list); + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryOpLogsVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + OpLogs findById(String id); + + /** + * 根据截止时间删除日志 + * + * @param endTime + */ + void clearLogs(LocalDateTime endTime); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/RecursionMappingService.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/RecursionMappingService.java new file mode 100644 index 0000000..7588761 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/RecursionMappingService.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.template.core.service; + + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.core.entity.RecursionMapping; +import com.lframework.xingyun.template.core.enums.NodeType; +import java.util.List; + +public interface RecursionMappingService extends BaseMpService { + + /** + * 查询节点的父节点ID + * + * @param nodeId + * @param nodeType + * @return + */ + List getNodeParentIds(String nodeId, NodeType nodeType); + + /** + * 查询节点的子节点ID + * + * @param nodeId + * @param nodeType + * @return + */ + List getNodeChildIds(String nodeId, NodeType nodeType); + + + /** + * 保存节点递归信息 + * + * @param nodeId + * @param nodeType + * @param parentIds 顺序有意义,需要从顶点到终点的顺序排列 + */ + void saveNode(String nodeId, NodeType nodeType, List parentIds); + + /** + * 保存节点递归信息 + * + * @param nodeId + * @param nodeType + */ + void saveNode(String nodeId, NodeType nodeType); + + /** + * 根据节点ID删除 + * + * @param nodeId + * @param nodeType + */ + void deleteNode(String nodeId, NodeType nodeType); + + /** + * 根据节点ID删除以及子节点 + * + * @param nodeId + * @param nodeType + */ + void deleteNodeAndChildren(String nodeId, NodeType nodeType); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/SysDataPermissionModelDetailService.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/SysDataPermissionModelDetailService.java new file mode 100644 index 0000000..6868f7f --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/SysDataPermissionModelDetailService.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.core.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.core.vo.permission.SysDataPermissionModelDetailVo; +import com.lframework.xingyun.template.core.entity.SysDataPermissionModelDetail; +import java.util.List; +import java.util.Map; + +public interface SysDataPermissionModelDetailService extends + BaseMpService { + + /** + * 解析SQL + * + * @param models + * @return + */ + String toSql(List models); + + /** + * 格式化SQL + * + * @param sqlTemplate + * @param params 表别名Map Key:表名占位符,具体定义数据表中的table_name Value:具体SQL的别名 + * @return + */ + String formatSql(String sqlTemplate, Map params); + +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/UserService.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/UserService.java new file mode 100644 index 0000000..e009d30 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/service/UserService.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.core.service; + +import com.lframework.xingyun.template.core.dto.UserDto; +import com.lframework.starter.web.service.BaseService; + +/** + * 用户Service + * + * @author zmj + */ +public interface UserService extends BaseService { + + /** + * 根据ID查询 主要用于各个业务关联查询用户信息 + * + * @param id + * @return + */ + UserDto findById(String id); + + /** + * 根据编号查询 + * + * @param code + * @return + */ + UserDto findByCode(String code); +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/utils/OpLogUtil.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/utils/OpLogUtil.java new file mode 100644 index 0000000..9493165 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/utils/OpLogUtil.java @@ -0,0 +1,117 @@ +package com.lframework.xingyun.template.core.utils; + +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.vo.CreateOpLogsVo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.JsonUtil; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.extern.slf4j.Slf4j; + +/** + * 操作日志Util + * + * @author zmj + */ +@Slf4j +public class OpLogUtil { + + private static final ThreadLocal>> VARIABLE_POOL = new ThreadLocal<>(); + + private static final ThreadLocal> LOG_ID_POOL = new ThreadLocal<>(); + + private static final ThreadLocal> EXTRA_POOL = new ThreadLocal<>(); + + public static void init(String logId) { + + initPool(); + + LOG_ID_POOL.get().add(logId); + + VARIABLE_POOL.get().putIfAbsent(logId, new HashMap<>()); + } + + public static void addLog(CreateOpLogsVo vo) { + + try { + OpLogsService opLogsService = ApplicationUtil.getBean(OpLogsService.class); + + // 这里不异步,需要在同事务内执行 + opLogsService.create(vo); + } catch (Exception e) { + // 这里异常不抛出 + log.error(e.getMessage(), e); + } + } + + public static void addLogs(Collection list) { + + try { + OpLogsService opLogsService = ApplicationUtil.getBean(OpLogsService.class); + + // 这里不异步,需要在同事务内执行 + opLogsService.create(list); + } catch (Exception e) { + // 这里异常不抛出 + log.error(e.getMessage(), e); + } + } + + public static void setVariable(String key, Object value) { + try { + VARIABLE_POOL.get().get(getCurrentLogId()).put(key, value); + }catch (Exception e){ + String logId = IdUtil.getUUID(); + init(logId); + VARIABLE_POOL.get().get(getCurrentLogId()).put(key, value); + } + + } + + public static Map getVariables() { + + return VARIABLE_POOL.get().get(getCurrentLogId()); + } + + public static String getExtra() { + + Object value = EXTRA_POOL.get().get(getCurrentLogId()); + + return value == null ? null : JsonUtil.toJsonString(value); + } + + public static void setExtra(Object value) { + + EXTRA_POOL.get().put(getCurrentLogId(), value); + } + + public static void clear() { + + VARIABLE_POOL.get().remove(getCurrentLogId()); + EXTRA_POOL.get().remove(getCurrentLogId()); + LOG_ID_POOL.get().remove(LOG_ID_POOL.get().size() - 1); + } + + private static void initPool() { + + if (VARIABLE_POOL.get() == null) { + VARIABLE_POOL.set(new HashMap<>()); + } + + if (LOG_ID_POOL.get() == null) { + LOG_ID_POOL.set(new ArrayList<>()); + } + + if (EXTRA_POOL.get() == null) { + EXTRA_POOL.set(new HashMap<>()); + } + } + + private static String getCurrentLogId() { + return LOG_ID_POOL.get().get(LOG_ID_POOL.get().size() - 1); + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/utils/WebUtils.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/utils/WebUtils.java new file mode 100644 index 0000000..c3be30f --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/utils/WebUtils.java @@ -0,0 +1,117 @@ +package com.lframework.xingyun.template.core.utils; + +import cn.hutool.core.collection.ArrayIter; +import cn.hutool.core.collection.IterUtil; +import cn.hutool.core.map.CaseInsensitiveMap; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.text.CharSequenceUtil; +import cn.hutool.core.util.ArrayUtil; +import org.springframework.util.Assert; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.Objects; + + +public class WebUtils { + + private static final String UNKNOWN ="unknown"; + + public static HttpServletRequest getHttpRequest() { + ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); + Assert.notNull(attributes, "RequestContextHolder.getRequestAttributes can't be NULL"); + return attributes.getRequest(); + } + + public static HttpServletRequest getRequest() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + return (requestAttributes == null) ? null : ((ServletRequestAttributes) requestAttributes).getRequest(); + } + + public static HttpServletResponse getResponse() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + return (requestAttributes == null) ? null : ((ServletRequestAttributes) requestAttributes).getResponse(); + } + + public static void redirect(String url) throws Exception { + redirect(getResponse(), url); + } + + public static void redirect(HttpServletResponse response, String url) throws Exception { + response.sendRedirect(url); + } + + public static void addCookie(String name, String value) { + getResponse().addCookie(new Cookie(name, value)); + } + + public static void addCookie(String name, String value, int expiry) { + Cookie cookie = new Cookie(name, value); + cookie.setMaxAge(expiry); + cookie.setPath("/"); + getResponse().addCookie(cookie); + } + + public static String getCookie(String name) { + Map cookieMap = readCookieMap(getRequest()); + return cookieMap.containsKey(name) ? ((Cookie)cookieMap.get(name)).getValue() : null; + } + + public static Map readCookieMap(HttpServletRequest httpServletRequest) { + Cookie[] cookies = httpServletRequest.getCookies(); + return ArrayUtil.isEmpty(cookies) ? MapUtil.empty() : IterUtil.toMap(new ArrayIter(httpServletRequest.getCookies()), new CaseInsensitiveMap(), Cookie::getName); + } + + + + public static String getRemoteIpAddress() { + return getRemoteIpAddress(getRequest()); + } + + /** + * 获取请求路径 + * + */ + public static String getRequestPath() { + return Objects.requireNonNull(getRequest()).getRequestURI(); + } + + public static String getRemoteIpAddress(HttpServletRequest request) { + String ip = null; + // X-Forwarded-For:Squid 服务代理 + String ipAddresses = request.getHeader("X-Forwarded-For"); + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // Proxy-Client-IP:apache 服务代理 + ipAddresses = request.getHeader("Proxy-Client-IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + ipAddresses = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // WL-Proxy-Client-IP:weblogic 服务代理 + ipAddresses = request.getHeader("WL-Proxy-Client-IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // HTTP_CLIENT_IP:有些代理服务器 + ipAddresses = request.getHeader("HTTP_CLIENT_IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // X-Real-IP:nginx服务代理 + ipAddresses = request.getHeader("X-Real-IP"); + } + // 有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP + if (CharSequenceUtil.isNotBlank(ipAddresses)) { + ip = ipAddresses.split(",")[0]; + } + // 还是不能获取到,最后再通过request.getRemoteAddr();获取 + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + ip = request.getRemoteAddr(); + } + return ip; + } +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/CreateOpLogsVo.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/CreateOpLogsVo.java new file mode 100644 index 0000000..c2c7dc9 --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/CreateOpLogsVo.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.template.core.vo; + +import com.lframework.starter.web.vo.BaseVo; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +/** + * 新增操作日志Vo + * + * @author zmj + */ +@Data +public class CreateOpLogsVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 日志名称 + */ + @NotBlank(message = "日志名称不能为空!") + private String name; + + /** + * 类型 + */ + @NotNull(message = "日志类型不能为空!") + private Integer logType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建人ID + */ + private String createById; + + /** + * IP地址 + */ + @NotBlank(message = "IP地址不能为空!") + private String ip; + + /** + * 补充信息 + */ + private String extra; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/QueryOpLogsVo.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/QueryOpLogsVo.java new file mode 100644 index 0000000..cf3d54e --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/QueryOpLogsVo.java @@ -0,0 +1,47 @@ +package com.lframework.xingyun.template.core.vo; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + * 查询操作日志Vo + * + * @author zmj + */ +@Data +public class QueryOpLogsVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 日志名称 + */ + @ApiModelProperty("日志名称") + private String name; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 日志类别 + */ + @ApiModelProperty("日志类别") + private Integer logType; + + /** + * 创建起始时间 + */ + @ApiModelProperty("创建起始时间") + private LocalDateTime startTime; + + /** + * 创建截止时间 + */ + @ApiModelProperty("创建截止时间") + private LocalDateTime endTime; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/permission/CreateSysDataPermissionDataVo.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/permission/CreateSysDataPermissionDataVo.java new file mode 100644 index 0000000..5d090ec --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/permission/CreateSysDataPermissionDataVo.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.template.core.vo.permission; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.template.core.enums.SysDataPermissionDataBizType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSysDataPermissionDataVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务ID + */ + @ApiModelProperty(value = "业务ID", required = true) + @NotEmpty(message = "业务ID不能为空!") + private List bizIds; + + /** + * 业务类型 + */ + @ApiModelProperty(value = "业务类型", required = true) + @NotNull(message = "业务类型不能为空!") + @IsEnum(message = "业务类型格式错误!", enumClass = SysDataPermissionDataBizType.class) + private Integer bizType; + + /** + * 权限类型 + */ + @ApiModelProperty(value = "权限类型", required = true) + @NotNull(message = "权限类型不能为空!") + private Integer permissionType; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; +} diff --git a/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/permission/SysDataPermissionModelDetailVo.java b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/permission/SysDataPermissionModelDetailVo.java new file mode 100644 index 0000000..b69246d --- /dev/null +++ b/xingyun-template-core/src/main/java/com/lframework/xingyun/template/core/vo/permission/SysDataPermissionModelDetailVo.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.template.core.vo.permission; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class SysDataPermissionModelDetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + + private String id; + + /** + * 明细ID + */ + @ApiModelProperty(value = "明细ID", required = true) + @NotNull(message = "明细ID不能为空!") + private Integer detailId; + + /** + * 节点类型 + */ + @ApiModelProperty(value = "节点类型", required = true) + @NotNull(message = "节点类型不能为空!") + private Integer nodeType; + + /** + * 计算类型 + */ + @ApiModelProperty("计算类型") + private Integer calcType; + + /** + * 值 + */ + @ApiModelProperty("值") + private String value; + + /** + * 值 + */ + @ApiModelProperty("值") + private List values; + + /** + * 条件类型 + */ + @ApiModelProperty("条件类型") + private Integer conditionType; + + /** + * 子节点 + */ + @ApiModelProperty("子节点") + private List children; +} diff --git a/xingyun-template-core/src/main/java/lombok.config b/xingyun-template-core/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-template-core/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-template-core/src/main/resources/mappers/DeptMapper.xml b/xingyun-template-core/src/main/resources/mappers/DeptMapper.xml new file mode 100644 index 0000000..2d30636 --- /dev/null +++ b/xingyun-template-core/src/main/resources/mappers/DeptMapper.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/xingyun-template-core/src/main/resources/mappers/OpLogsMapper.xml b/xingyun-template-core/src/main/resources/mappers/OpLogsMapper.xml new file mode 100644 index 0000000..537503d --- /dev/null +++ b/xingyun-template-core/src/main/resources/mappers/OpLogsMapper.xml @@ -0,0 +1,49 @@ + + + + + + SELECT + * + FROM op_logs + + + DELETE FROM op_logs + WHERE + + + + + + + diff --git a/xingyun-template-core/src/main/resources/mappers/RecursionMappingMappre.xml b/xingyun-template-core/src/main/resources/mappers/RecursionMappingMappre.xml new file mode 100644 index 0000000..66c2164 --- /dev/null +++ b/xingyun-template-core/src/main/resources/mappers/RecursionMappingMappre.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/xingyun-template-core/src/main/resources/mappers/UserMapper.xml b/xingyun-template-core/src/main/resources/mappers/UserMapper.xml new file mode 100644 index 0000000..04c331f --- /dev/null +++ b/xingyun-template-core/src/main/resources/mappers/UserMapper.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/xingyun-template/pom.xml b/xingyun-template/pom.xml new file mode 100644 index 0000000..3ff0b86 --- /dev/null +++ b/xingyun-template/pom.xml @@ -0,0 +1,38 @@ + + + + xingyun + com.lframework + 1.0.0-SNAPSHOT + + 4.0.0 + + xingyun-template + + 【${project.artifactId}】此Module与业务无关,提供用户、角色、部门、岗位等基础接口 + + + + com.lframework + xingyun-template-core + + + com.lframework + websocket-starter + + + org.freemarker + freemarker + + + org.ssssssss + magic-api-spring-boot-starter + + + org.ssssssss + magic-api-plugin-cluster + + + \ No newline at end of file diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/config/TemplateApiConfiguration.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/config/TemplateApiConfiguration.java new file mode 100644 index 0000000..4cd982e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/config/TemplateApiConfiguration.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.config; + +import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; + +@Configuration +public class TemplateApiConfiguration { + + @Bean("templateApiDocket") + public Docket securityAPiDocket(ApiInfo info, OpenApiExtensionResolver openApiExtensionResolver) { + + // 除了描述 其他全与info保持一致 + ApiInfo apiInfo = new ApiInfo(info.getTitle(), "系统内置模块", info.getVersion(), + info.getTermsOfServiceUrl(), + info.getContact(), info.getLicense(), info.getLicenseUrl(), info.getVendorExtensions()); + + Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).groupName("系统内置模块") + .select() + .apis(RequestHandlerSelectors.basePackage("com.lframework.xingyun.template")) + .paths(PathSelectors.any()) + .build() + .extensions(openApiExtensionResolver.buildSettingExtensions()); + return docket; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/GenCustomListSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/GenCustomListSelectorBo.java new file mode 100644 index 0000000..36e4702 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/GenCustomListSelectorBo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.template.gen.bo.custom.list; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.xingyun.template.gen.service.GenCustomListCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomListSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 数据对象ID + */ + @ApiModelProperty("数据对象ID") + private String dataObjId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + public GenCustomListSelectorBo() { + } + + public GenCustomListSelectorBo(GenCustomList dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomList dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomListCategoryService genCustomListCategoryService = ApplicationUtil.getBean( + GenCustomListCategoryService.class); + GenCustomListCategory category = genCustomListCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/GetGenCustomListBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/GetGenCustomListBo.java new file mode 100644 index 0000000..278ded8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/GetGenCustomListBo.java @@ -0,0 +1,500 @@ +package com.lframework.xingyun.template.gen.bo.custom.list; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.bo.SuperBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.xingyun.template.gen.entity.GenCustomListDetail; +import com.lframework.xingyun.template.gen.entity.GenCustomListHandleColumn; +import com.lframework.xingyun.template.gen.entity.GenCustomListQueryParams; +import com.lframework.xingyun.template.gen.entity.GenCustomListToolbar; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.xingyun.template.gen.service.GenCustomListCategoryService; +import com.lframework.xingyun.template.gen.service.GenCustomListDetailService; +import com.lframework.xingyun.template.gen.service.GenCustomListHandleColumnService; +import com.lframework.xingyun.template.gen.service.GenCustomListQueryParamsService; +import com.lframework.xingyun.template.gen.service.GenCustomListToolbarService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetGenCustomListBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 数据对象ID + */ + @ApiModelProperty("数据对象ID") + private String dataObjId; + + /** + * 列表类型 + */ + @ApiModelProperty("列表类型") + private Integer listType; + + /** + * 数据对象名称 + */ + @ApiModelProperty("数据对象名称") + private String dataObjName; + + /** + * 表单Label宽度 + */ + @ApiModelProperty("表单Label宽度") + private Integer labelWidth; + + /** + * 是否分页 + */ + @ApiModelProperty("是否分页") + private Boolean hasPage; + + /** + * 是否树形列表 + */ + @ApiModelProperty("是否树形列表") + private Boolean treeData; + + /** + * ID字段 + */ + @ApiModelProperty("ID字段") + private String idColumn; + + /** + * 父级ID字段 + */ + @ApiModelProperty("父级ID字段") + private String treePidColumn; + + /** + * 树形节点字段 + */ + @ApiModelProperty("树形节点字段") + private String treeNodeColumn; + + /** + * 子节点Key值 + */ + @ApiModelProperty("子节点Key值") + private String treeChildrenKey; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 查询前置SQL + */ + @ApiModelProperty("查询前置SQL") + private String queryPrefixSql; + + /** + * 查询后置SQL + */ + @ApiModelProperty("查询后置SQL") + private String querySuffixSql; + + /** + * 后置SQL + */ + @ApiModelProperty("后置SQL") + private String suffixSql; + + /** + * 是否允许导出 + */ + @ApiModelProperty("是否允许导出") + private Boolean allowExport; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 工具栏 + */ + @ApiModelProperty("工具栏") + private List toolbars; + + /** + * 操作列 + */ + @ApiModelProperty("操作列") + private List handleColumns; + + /** + * 查询条件 + */ + @ApiModelProperty("查询条件") + private List queryParams; + + /** + * 详情 + */ + @ApiModelProperty("详情") + private List details; + + public GetGenCustomListBo() { + } + + public GetGenCustomListBo(GenCustomList dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomList dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomListCategoryService genCustomListCategoryService = ApplicationUtil.getBean( + GenCustomListCategoryService.class); + GenCustomListCategory category = genCustomListCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + + this.listType = dto.getListType().getCode(); + + GenDataEntityDetailService genDataEntityDetailService = ApplicationUtil + .getBean(GenDataEntityDetailService.class); + GenDataObjService genDataObjService = ApplicationUtil.getBean(GenDataObjService.class); + GenDataObj dataObj = genDataObjService.findById(dto.getDataObjId()); + this.dataObjName = dataObj.getName(); + + GenCustomListQueryParamsService genCustomListQueryParamsService = ApplicationUtil.getBean( + GenCustomListQueryParamsService.class); + List queryParams = genCustomListQueryParamsService.getByCustomListId( + dto.getId()); + if (!CollectionUtil.isEmpty(queryParams)) { + this.queryParams = queryParams.stream().map(t -> { + GenDataEntityDetail entityDetail = genDataEntityDetailService.getById(t.getDataEntityId()); + QueryParamsBo bo = new QueryParamsBo(); + bo.setId(t.getDataEntityId()); + bo.setRelaId(t.getRelaId()); + bo.setFrontShow(t.getFrontShow()); + bo.setQueryType(t.getQueryType().getCode()); + bo.setFormWidth(t.getFormWidth()); + bo.setDefaultValue(t.getDefaultValue()); + bo.setType(t.getType().getCode()); + bo.setDataType(entityDetail.getDataType().getCode()); + bo.setViewType(entityDetail.getViewType().getCode()); + + return bo; + }).collect(Collectors.toList()); + } + + GenCustomListDetailService genCustomListDetailService = ApplicationUtil.getBean( + GenCustomListDetailService.class); + List details = genCustomListDetailService.getByCustomListId(dto.getId()); + this.details = details.stream().map(t -> { + DetailBo bo = new DetailBo(); + bo.setId(t.getDataEntityId()); + bo.setRelaId(t.getRelaId()); + bo.setWidthType(t.getWidthType().getCode()); + bo.setSortable(t.getSortable()); + bo.setWidth(t.getWidth()); + bo.setType(t.getType().getCode()); + if (t.getType() == GenCustomListDetailType.CUSTOM) { + bo.setId(t.getRelaId()); + } + bo.setFormatter(t.getFormatter()); + + return bo; + }).collect(Collectors.toList()); + + GenCustomListToolbarService genCustomListToolbarService = ApplicationUtil + .getBean(GenCustomListToolbarService.class); + List toolbars = genCustomListToolbarService + .getByCustomListId(dto.getId()); + + this.toolbars = toolbars.stream().map(t -> { + ToolbarBo toolbar = new ToolbarBo(); + toolbar.setId(t.getId()); + toolbar.setName(t.getName()); + toolbar.setViewType(t.getViewType().getCode()); + toolbar.setBtnType(t.getBtnType().getCode()); + toolbar.setBtnConfig(t.getBtnConfig()); + toolbar.setIcon(t.getIcon()); + return toolbar; + }).collect(Collectors.toList()); + + GenCustomListHandleColumnService genCustomListHandleColumnService = ApplicationUtil + .getBean(GenCustomListHandleColumnService.class); + List handleColumns = genCustomListHandleColumnService + .getByCustomListId(dto.getId()); + + this.handleColumns = handleColumns.stream().map(t -> { + HandleColumnBo handleColumn = new HandleColumnBo(); + handleColumn.setId(t.getId()); + handleColumn.setName(t.getName()); + handleColumn.setViewType(t.getViewType().getCode()); + handleColumn.setBtnType(t.getBtnType().getCode()); + handleColumn.setBtnConfig(t.getBtnConfig()); + handleColumn.setWidth(t.getWidth()); + handleColumn.setIcon(t.getIcon()); + return handleColumn; + }).collect(Collectors.toList()); + } + + @Data + public static class ToolbarBo implements SuperBo { + + /** + * ID + */ + @ApiModelProperty(value = "ID") + private String id; + + /** + * 显示名称 + */ + @ApiModelProperty(value = "显示名称") + private String name; + + /** + * 显示类型 + */ + @ApiModelProperty(value = "显示类型") + private String viewType; + + /** + * 按钮类型 + */ + @ApiModelProperty(value = "按钮类型") + private Integer btnType; + + /** + * 按钮配置 + */ + @ApiModelProperty(value = "按钮配置") + private String btnConfig; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 请求参数 + */ + @ApiModelProperty(value = "请求参数") + private String requestParam; + + /** + * 自定义表单ID + */ + @ApiModelProperty(value = "自定义表单ID") + private String customFormId; + + /** + * 自定义表单名称 + */ + @ApiModelProperty(value = "自定义表单名称") + private String customFormName; + } + + @Data + public static class QueryParamsBo implements SuperBo { + + /** + * ID + */ + @ApiModelProperty(value = "ID") + private String id; + + /** + * 关联ID + */ + @ApiModelProperty(value = "关联ID") + private String relaId; + + /** + * 前端显示 + */ + @ApiModelProperty(value = "前端显示") + private Boolean frontShow; + + /** + * 查询类型 + */ + @ApiModelProperty(value = "查询类型") + private Integer queryType; + + /** + * 表单宽度 + */ + @ApiModelProperty(value = "表单宽度") + private Integer formWidth; + + /** + * 默认值 + */ + @ApiModelProperty(value = "默认值") + private String defaultValue; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 数据类型 + */ + @ApiModelProperty("数据对象") + private Integer dataType; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + private Integer viewType; + } + + @Data + public static class DetailBo implements SuperBo { + + /** + * ID + */ + @ApiModelProperty(value = "ID") + private String id; + + /** + * 关联ID + */ + @ApiModelProperty("关联ID") + private String relaId; + + /** + * 宽度类型 + */ + @ApiModelProperty(value = "宽度类型") + private Integer widthType; + + /** + * 是否页面排序 + */ + @ApiModelProperty(value = "是否页面排序") + private Boolean sortable; + + /** + * 宽度 + */ + @ApiModelProperty(value = "宽度") + private Integer width; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 格式化脚本 + */ + @ApiModelProperty("格式化脚本") + private String formatter; + } + + @Data + public static class HandleColumnBo implements SuperBo { + + /** + * ID + */ + @ApiModelProperty(value = "ID") + private String id; + + /** + * 显示名称 + */ + @ApiModelProperty(value = "显示名称") + private String name; + + /** + * 显示类型 + */ + @ApiModelProperty(value = "显示类型") + private String viewType; + + /** + * 按钮类型 + */ + @ApiModelProperty(value = "按钮类型") + private Integer btnType; + + /** + * 按钮配置 + */ + @ApiModelProperty(value = "按钮配置") + private String btnConfig; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 请求参数 + */ + @ApiModelProperty(value = "请求参数") + private String requestParam; + + /** + * 宽度 + */ + @ApiModelProperty(value = "宽度") + private Integer width; + + /** + * 自定义表单ID + */ + @ApiModelProperty(value = "自定义表单ID") + private String customFormId; + + /** + * 自定义表单名称 + */ + @ApiModelProperty(value = "自定义表单名称") + private String customFormName; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/QueryGenCustomListBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/QueryGenCustomListBo.java new file mode 100644 index 0000000..6958e99 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/QueryGenCustomListBo.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.template.gen.bo.custom.list; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.xingyun.template.gen.service.GenCustomListCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryGenCustomListBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryGenCustomListBo() { + } + + public QueryGenCustomListBo(GenCustomList dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomList dto) { + + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomListCategoryService genDataObjCategoryService = ApplicationUtil.getBean( + GenCustomListCategoryService.class); + GenCustomListCategory category = genDataObjCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/GenCustomListCategorySelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/GenCustomListCategorySelectorBo.java new file mode 100644 index 0000000..a1ae71c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/GenCustomListCategorySelectorBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.bo.custom.list.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomListCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public GenCustomListCategorySelectorBo() { + } + + public GenCustomListCategorySelectorBo(GenCustomListCategory dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/GetGenCustomListCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/GetGenCustomListCategoryBo.java new file mode 100644 index 0000000..4483cc8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/GetGenCustomListCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.custom.list.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetGenCustomListCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public GetGenCustomListCategoryBo() { + + } + + public GetGenCustomListCategoryBo(GenCustomListCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/QueryGenCustomListCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/QueryGenCustomListCategoryBo.java new file mode 100644 index 0000000..8f2056b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/list/category/QueryGenCustomListCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.custom.list.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryGenCustomListCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public QueryGenCustomListCategoryBo() { + + } + + public QueryGenCustomListCategoryBo(GenCustomListCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/GenCustomPageSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/GenCustomPageSelectorBo.java new file mode 100644 index 0000000..a04cd61 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/GenCustomPageSelectorBo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.template.gen.bo.custom.page; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.xingyun.template.gen.service.GenCustomPageCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomPageSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + public GenCustomPageSelectorBo() { + } + + public GenCustomPageSelectorBo(GenCustomPage dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomPage dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomPageCategoryService genCustomPageCategoryService = ApplicationUtil.getBean( + GenCustomPageCategoryService.class); + GenCustomPageCategory category = genCustomPageCategoryService + .findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/GetGenCustomPageBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/GetGenCustomPageBo.java new file mode 100644 index 0000000..eca5112 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/GetGenCustomPageBo.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.template.gen.bo.custom.page; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.xingyun.template.gen.service.GenCustomPageCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetGenCustomPageBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 页面代码 + */ + @ApiModelProperty("页面代码") + private String pageCode; + + /** + * 脚本代码 + */ + @ApiModelProperty("脚本代码") + private String scriptCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetGenCustomPageBo() { + } + + public GetGenCustomPageBo(GenCustomPage dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomPage dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomPageCategoryService genCustomPageCategoryService = ApplicationUtil.getBean( + GenCustomPageCategoryService.class); + GenCustomPageCategory category = genCustomPageCategoryService + .findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/QueryGenCustomPageBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/QueryGenCustomPageBo.java new file mode 100644 index 0000000..6c586d6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/QueryGenCustomPageBo.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.template.gen.bo.custom.page; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.xingyun.template.gen.service.GenCustomPageCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryGenCustomPageBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryGenCustomPageBo() { + } + + public QueryGenCustomPageBo(GenCustomPage dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomPage dto) { + + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomPageCategoryService genCustomPageCategoryService = ApplicationUtil.getBean( + GenCustomPageCategoryService.class); + GenCustomPageCategory category = genCustomPageCategoryService + .findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/GenCustomPageCategorySelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/GenCustomPageCategorySelectorBo.java new file mode 100644 index 0000000..9fd8647 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/GenCustomPageCategorySelectorBo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.template.gen.bo.custom.page.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomPageCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + public GenCustomPageCategorySelectorBo() { + } + + public GenCustomPageCategorySelectorBo(GenCustomPageCategory dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/GetGenCustomPageCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/GetGenCustomPageCategoryBo.java new file mode 100644 index 0000000..bdcee25 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/GetGenCustomPageCategoryBo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.template.gen.bo.custom.page.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetGenCustomPageCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + + public GetGenCustomPageCategoryBo() { + + } + + public GetGenCustomPageCategoryBo(GenCustomPageCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/QueryGenCustomPageCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/QueryGenCustomPageCategoryBo.java new file mode 100644 index 0000000..9cf1b32 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/page/category/QueryGenCustomPageCategoryBo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.template.gen.bo.custom.page.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryGenCustomPageCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + + public QueryGenCustomPageCategoryBo() { + + } + + public QueryGenCustomPageCategoryBo(GenCustomPageCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/GenCustomSelectorSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/GenCustomSelectorSelectorBo.java new file mode 100644 index 0000000..51530f9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/GenCustomSelectorSelectorBo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.template.gen.bo.custom.selector; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomSelectorSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + public GenCustomSelectorSelectorBo() { + } + + public GenCustomSelectorSelectorBo(GenCustomSelector dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomSelector dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomSelectorCategoryService genCustomListCategoryService = ApplicationUtil.getBean( + GenCustomSelectorCategoryService.class); + GenCustomSelectorCategory category = genCustomListCategoryService + .findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/GetGenCustomSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/GetGenCustomSelectorBo.java new file mode 100644 index 0000000..6fa75ba --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/GetGenCustomSelectorBo.java @@ -0,0 +1,125 @@ +package com.lframework.xingyun.template.gen.bo.custom.selector; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetGenCustomSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 数据对象ID + */ + @ApiModelProperty("数据对象ID") + private String dataObjId; + + /** + * 自定义列表ID + */ + @ApiModelProperty("自定义列表ID") + private String customListId; + + /** + * 自定义列表名称 + */ + @ApiModelProperty("自定义列表名称") + private String customListName; + + /** + * 对话框标题 + */ + @ApiModelProperty("对话框标题") + private String dialogTittle; + + /** + * 对话框宽度 + */ + @ApiModelProperty("对话框宽度") + private String dialogWidth; + + /** + * 占位符 + */ + @ApiModelProperty("占位符") + private String placeholder; + + /** + * ID字段 + */ + @ApiModelProperty("ID字段") + private String idColumn; + + /** + * 名称字段 + */ + @ApiModelProperty("名称字段") + private String nameColumn; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetGenCustomSelectorBo() { + } + + public GetGenCustomSelectorBo(GenCustomSelector dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomSelector dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomSelectorCategoryService genCustomListCategoryService = ApplicationUtil.getBean( + GenCustomSelectorCategoryService.class); + GenCustomSelectorCategory category = genCustomListCategoryService + .findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + + GenCustomListService genCustomListService = ApplicationUtil + .getBean(GenCustomListService.class); + GenCustomList customList = genCustomListService.findById(dto.getCustomListId()); + this.customListName = customList.getName(); + + this.dataObjId = customList.getDataObjId(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/QueryGenCustomSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/QueryGenCustomSelectorBo.java new file mode 100644 index 0000000..0bc1dd0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/QueryGenCustomSelectorBo.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.template.gen.bo.custom.selector; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryGenCustomSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryGenCustomSelectorBo() { + } + + public QueryGenCustomSelectorBo(GenCustomSelector dto) { + super(dto); + } + + @Override + protected void afterInit(GenCustomSelector dto) { + + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenCustomSelectorCategoryService customSelectorCategoryService = ApplicationUtil.getBean( + GenCustomSelectorCategoryService.class); + GenCustomSelectorCategory category = customSelectorCategoryService + .findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/GenCustomSelectorCategorySelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/GenCustomSelectorCategorySelectorBo.java new file mode 100644 index 0000000..3388b13 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/GenCustomSelectorCategorySelectorBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.bo.custom.selector.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomSelectorCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public GenCustomSelectorCategorySelectorBo() { + } + + public GenCustomSelectorCategorySelectorBo(GenCustomSelectorCategory dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/GetGenCustomSelectorCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/GetGenCustomSelectorCategoryBo.java new file mode 100644 index 0000000..f6f303b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/GetGenCustomSelectorCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.custom.selector.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetGenCustomSelectorCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public GetGenCustomSelectorCategoryBo() { + + } + + public GetGenCustomSelectorCategoryBo(GenCustomSelectorCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/QueryGenCustomSelectorCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/QueryGenCustomSelectorCategoryBo.java new file mode 100644 index 0000000..17f0a54 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/custom/selector/category/QueryGenCustomSelectorCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.custom.selector.category; + +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryGenCustomSelectorCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public QueryGenCustomSelectorCategoryBo() { + + } + + public QueryGenCustomSelectorCategoryBo(GenCustomSelectorCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/DataEntityGenerateBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/DataEntityGenerateBo.java new file mode 100644 index 0000000..2c13b7d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/DataEntityGenerateBo.java @@ -0,0 +1,114 @@ +package com.lframework.xingyun.template.gen.bo.data.entity; + +import com.lframework.starter.common.functions.SFunction; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.bo.gen.GenCreateColumnConfigBo; +import com.lframework.xingyun.template.gen.bo.gen.GenDetailColumnConfigBo; +import com.lframework.xingyun.template.gen.bo.gen.GenGenerateInfoBo; +import com.lframework.xingyun.template.gen.bo.gen.GenQueryColumnConfigBo; +import com.lframework.xingyun.template.gen.bo.gen.GenQueryParamsColumnConfigBo; +import com.lframework.xingyun.template.gen.bo.gen.GenUpdateColumnConfigBo; +import com.lframework.xingyun.template.gen.dto.data.entity.DataEntityGenerateDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class DataEntityGenerateBo extends BaseBo { + + /** + * 字段信息 + */ + @ApiModelProperty("字段信息") + private List columns; + + /** + * 基本设置 + */ + @ApiModelProperty("基本设置") + private GenGenerateInfoBo generateInfo; + + /** + * 新增配置 + */ + @ApiModelProperty("新增配置") + private List createConfigs; + + /** + * 修改配置 + */ + @ApiModelProperty("修改配置") + private List updateConfigs; + + /** + * 查询配置 + */ + @ApiModelProperty("查询配置") + private List queryConfigs; + + /** + * 查询参数配置 + */ + @ApiModelProperty("查询参数配置") + private List queryParamsConfigs; + + /** + * 详情配置 + */ + @ApiModelProperty("详情配置") + private List detailConfigs; + + public DataEntityGenerateBo(DataEntityGenerateDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(DataEntityGenerateDto dto) { + + return this; + } + + @Override + public BaseBo convert(DataEntityGenerateDto dto, + SFunction... columns) { + + return this; + } + + @Override + protected void afterInit(DataEntityGenerateDto dto) { + + this.columns = dto.getColumns().stream().map(GenDataEntityDetailGenerateBo::new) + .collect(Collectors.toList()); + this.generateInfo = + dto.getGenerateInfo() == null ? null : new GenGenerateInfoBo(dto.getGenerateInfo()); + if (!CollectionUtil.isEmpty(dto.getCreateConfigs())) { + this.createConfigs = dto.getCreateConfigs().stream().map(GenCreateColumnConfigBo::new) + .collect(Collectors.toList()); + } + + if (!CollectionUtil.isEmpty(dto.getUpdateConfigs())) { + this.updateConfigs = dto.getUpdateConfigs().stream().map(GenUpdateColumnConfigBo::new) + .collect(Collectors.toList()); + } + + if (!CollectionUtil.isEmpty(dto.getQueryConfigs())) { + this.queryConfigs = dto.getQueryConfigs().stream().map(GenQueryColumnConfigBo::new) + .collect(Collectors.toList()); + } + + if (!CollectionUtil.isEmpty(dto.getQueryParamsConfigs())) { + this.queryParamsConfigs = dto.getQueryParamsConfigs().stream() + .map(GenQueryParamsColumnConfigBo::new) + .collect(Collectors.toList()); + } + + if (!CollectionUtil.isEmpty(dto.getDetailConfigs())) { + this.detailConfigs = dto.getDetailConfigs().stream().map(GenDetailColumnConfigBo::new) + .collect(Collectors.toList()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailBo.java new file mode 100644 index 0000000..023915b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailBo.java @@ -0,0 +1,169 @@ +package com.lframework.xingyun.template.gen.bo.data.entity; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataEntityDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 字段显示名称 + */ + @ApiModelProperty("字段显示名称") + private String name; + + /** + * 字段名称 + */ + @ApiModelProperty("字段名称") + private String columnName; + + /** + * 是否主键 + */ + @ApiModelProperty("是否主键") + private Boolean isKey; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + private Integer dataType; + + /** + * 排序编号 + */ + @ApiModelProperty("排序编号") + private Integer columnOrder; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + private Integer viewType; + + /** + * 是否内置枚举 + */ + @ApiModelProperty("是否内置枚举") + private Boolean fixEnum; + + /** + * 后端枚举名 + */ + @ApiModelProperty("后端枚举名") + private String enumBack; + + /** + * 前端枚举名 + */ + @ApiModelProperty("前端枚举名") + private String enumFront; + + /** + * 正则表达式 + */ + @ApiModelProperty("正则表达式") + private String regularExpression; + + /** + * 是否排序字段 + */ + @ApiModelProperty("是否排序字段") + private Boolean isOrder; + + /** + * 排序类型 + */ + @ApiModelProperty("排序类型") + private String orderType; + + /** + * 数据字典ID + */ + private String dataDicId; + + /** + * 数据字典名称 + */ + private String dataDicName; + + /** + * 自定义选择器ID + */ + private String customSelectorId; + + /** + * 自定义选择器名称 + */ + private String customSelectorName; + + /** + * 长度 + */ + @ApiModelProperty("长度") + private Long len; + + /** + * 小数位数 + */ + @ApiModelProperty("小数位数") + private Integer decimals; + + public GenDataEntityDetailBo() { + + } + + public GenDataEntityDetailBo(GenDataEntityDetail dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenDataEntityDetail dto) { + + return super.convert(dto, GenDataEntityDetailBo::getDataType, + GenDataEntityDetailBo::getViewType, GenDataEntityDetailBo::getOrderType); + } + + @Override + protected void afterInit(GenDataEntityDetail dto) { + + this.dataType = dto.getDataType().getCode(); + this.viewType = dto.getViewType().getCode(); + this.orderType = dto.getOrderType() == null ? null : dto.getOrderType().getCode(); + + if (!StringUtil.isBlank(dto.getDataDicId())) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dic = sysDataDicService.findById(dto.getDataDicId()); + this.dataDicName = dic.getName(); + } + + if (!StringUtil.isBlank(dto.getCustomSelectorId())) { + GenCustomSelectorService genCustomSelectorService = ApplicationUtil + .getBean(GenCustomSelectorService.class); + GenCustomSelector selector = genCustomSelectorService.findById(dto.getCustomSelectorId()); + this.customSelectorName = selector.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailGenerateBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailGenerateBo.java new file mode 100644 index 0000000..1206a1d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailGenerateBo.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.template.gen.bo.data.entity; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataEntityDetailGenerateBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 字段显示名称 + */ + @ApiModelProperty("字段显示名称") + private String name; + + /** + * 字段名称 + */ + @ApiModelProperty("字段名称") + private String columnName; + + /** + * 是否主键 + */ + @ApiModelProperty("是否主键") + private Boolean isKey; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + private Integer dataType; + + /** + * 排序编号 + */ + @ApiModelProperty("排序编号") + private Integer columnOrder; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + private Integer viewType; + + /** + * 是否内置枚举 + */ + @ApiModelProperty("是否内置枚举") + private Boolean fixEnum; + + /** + * 后端枚举名 + */ + @ApiModelProperty("后端枚举名") + private String enumBack; + + /** + * 前端枚举名 + */ + @ApiModelProperty("前端枚举名") + private String enumFront; + + /** + * 正则表达式 + */ + @ApiModelProperty("正则表达式") + private String regularExpression; + + /** + * 是否排序字段 + */ + @ApiModelProperty("是否排序字段") + private Boolean isOrder; + + /** + * 排序类型 + */ + @ApiModelProperty("排序类型") + private String orderType; + + public GenDataEntityDetailGenerateBo() { + + } + + public GenDataEntityDetailGenerateBo(GenDataEntityDetail dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenDataEntityDetail dto) { + + return super.convert(dto, GenDataEntityDetailGenerateBo::getDataType, + GenDataEntityDetailGenerateBo::getViewType, + GenDataEntityDetailGenerateBo::getOrderType); + } + + @Override + protected void afterInit(GenDataEntityDetail dto) { + + this.dataType = dto.getDataType().getCode(); + this.viewType = dto.getViewType().getCode(); + this.orderType = dto.getOrderType() == null ? null : dto.getOrderType().getCode(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailSelectorBo.java new file mode 100644 index 0000000..664ba46 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntityDetailSelectorBo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.gen.bo.data.entity; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataEntityDetailSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public GenDataEntityDetailSelectorBo() { + } + + public GenDataEntityDetailSelectorBo(GenDataEntityDetail dto) { + super(dto); + } + + @Override + protected void afterInit(GenDataEntityDetail dto) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntitySelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntitySelectorBo.java new file mode 100644 index 0000000..c86a2b5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GenDataEntitySelectorBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.gen.bo.data.entity; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.service.GenDataEntityCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataEntitySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + public GenDataEntitySelectorBo() { + } + + public GenDataEntitySelectorBo(GenDataEntity dto) { + super(dto); + } + + @Override + protected void afterInit(GenDataEntity dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenDataEntityCategoryService genDataEntityCategoryService = ApplicationUtil.getBean( + GenDataEntityCategoryService.class); + GenDataEntityCategory category = genDataEntityCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GetDataEntityBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GetDataEntityBo.java new file mode 100644 index 0000000..0bb34a8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/GetDataEntityBo.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.template.gen.bo.data.entity; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.service.GenDataEntityCategoryService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetDataEntityBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 数据表 + */ + @ApiModelProperty("数据表") + private String tableName; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 字段信息 + */ + @ApiModelProperty("字段信息") + private List columns; + + public GetDataEntityBo() { + + } + + public GetDataEntityBo(GenDataEntity dto) { + + super(dto); + } + + @Override + protected void afterInit(GenDataEntity dto) { + + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenDataEntityCategoryService genDataEntityCategoryService = ApplicationUtil.getBean( + GenDataEntityCategoryService.class); + GenDataEntityCategory category = genDataEntityCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + + this.tableName = dto.getTableName(); + + GenDataEntityDetailService genDataEntityDetailService = ApplicationUtil.getBean( + GenDataEntityDetailService.class); + List details = genDataEntityDetailService.getByEntityId(dto.getId()); + this.columns = details.stream().map(GenDataEntityDetailBo::new).collect(Collectors.toList()); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/QueryDataEntityBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/QueryDataEntityBo.java new file mode 100644 index 0000000..dced7f6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/QueryDataEntityBo.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.template.gen.bo.data.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.service.GenDataEntityCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryDataEntityBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 生成状态 + */ + @ApiModelProperty("生成状态") + private Integer genStatus; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryDataEntityBo() { + } + + public QueryDataEntityBo(GenDataEntity dto) { + super(dto); + } + + @Override + protected void afterInit(GenDataEntity dto) { + + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenDataEntityCategoryService genDataEntityCategoryService = ApplicationUtil.getBean( + GenDataEntityCategoryService.class); + GenDataEntityCategory category = genDataEntityCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + this.genStatus = dto.getGenStatus().getCode(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/GenDataEntityCategorySelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/GenDataEntityCategorySelectorBo.java new file mode 100644 index 0000000..081db45 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/GenDataEntityCategorySelectorBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.bo.data.entity.category; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataEntityCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public GenDataEntityCategorySelectorBo() { + } + + public GenDataEntityCategorySelectorBo(GenDataEntityCategory dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/GetGenDataEntityCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/GetGenDataEntityCategoryBo.java new file mode 100644 index 0000000..aa00336 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/GetGenDataEntityCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.data.entity.category; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetGenDataEntityCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public GetGenDataEntityCategoryBo() { + + } + + public GetGenDataEntityCategoryBo(GenDataEntityCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/QueryGenDataEntityCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/QueryGenDataEntityCategoryBo.java new file mode 100644 index 0000000..7aaa0f0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/entity/category/QueryGenDataEntityCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.data.entity.category; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryGenDataEntityCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public QueryGenDataEntityCategoryBo() { + + } + + public QueryGenDataEntityCategoryBo(GenDataEntityCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjColumnBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjColumnBo.java new file mode 100644 index 0000000..f18b02d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjColumnBo.java @@ -0,0 +1,68 @@ +package com.lframework.xingyun.template.gen.bo.data.obj; + +import com.lframework.starter.web.bo.SuperBo; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.Data; + +@Data +public class GenDataObjColumnBo implements SuperBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 数据对象名称 + */ + @ApiModelProperty("数据对象名称") + private String name; + + /** + * 列 + */ + @ApiModelProperty("列") + private List columns; + + @Data + public static class ColumnBo implements SuperBo { + + /** + * 数据实体明细ID + */ + @ApiModelProperty("数据实体明细ID") + private String id; + + /** + * 关联ID + */ + @ApiModelProperty("关联ID") + private String relaId; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + private String name; + + /** + * 类型 + */ + @ApiModelProperty("类型") + private Integer type; + + /** + * 数据类型 + */ + @ApiModelProperty("数据对象") + private Integer dataType; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + private Integer viewType; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjDetailBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjDetailBo.java new file mode 100644 index 0000000..537cfe6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjDetailBo.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.template.gen.bo.data.obj; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataObjDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 主表字段 + */ + @ApiModelProperty("主表字段") + private String[] mainTableDetailIds; + + /** + * 关联类型 + */ + @ApiModelProperty("关联类型") + private Integer relaType; + + /** + * 关联方式 + */ + @ApiModelProperty("关联方式") + private Integer relaMode; + + /** + * 子表ID + */ + @ApiModelProperty("子表ID") + private String subTableId; + + /** + * 子表名称 + */ + @ApiModelProperty("子表名称") + private String subTableName; + + /** + * 子表别名 + */ + @ApiModelProperty("子表别名") + private String subTableAlias; + + /** + * 子表字段 + */ + @ApiModelProperty("子表字段") + private String[] subTableDetailIds; + + public GenDataObjDetailBo() { + + } + + public GenDataObjDetailBo(GenDataObjDetail dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenDataObjDetail dto) { + + return super.convert(dto, GenDataObjDetailBo::getRelaType, GenDataObjDetailBo::getRelaMode, + GenDataObjDetailBo::getMainTableDetailIds, GenDataObjDetailBo::getSubTableDetailIds); + } + + @Override + protected void afterInit(GenDataObjDetail dto) { + + this.relaType = dto.getRelaType().getCode(); + this.relaMode = dto.getRelaMode().getCode(); + this.mainTableDetailIds = dto.getMainTableDetailIds().split(StringPool.STR_SPLIT); + this.subTableDetailIds = dto.getSubTableDetailIds().split(StringPool.STR_SPLIT); + + GenDataEntityService genDataEntityService = ApplicationUtil.getBean( + GenDataEntityService.class); + GenDataEntity entity = genDataEntityService.findById(dto.getSubTableId()); + this.subTableName = entity.getName(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjQueryDetailBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjQueryDetailBo.java new file mode 100644 index 0000000..e000eee --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjQueryDetailBo.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.template.gen.bo.data.obj; + +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataObjQueryDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + private String customName; + + /** + * 自定义SQL + */ + @ApiModelProperty("自定义SQL") + private String customSql; + + /** + * 别名 + */ + @ApiModelProperty("别名") + private String customAlias; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + private Integer dataType; + + public GenDataObjQueryDetailBo() { + + } + + public GenDataObjQueryDetailBo(GenDataObjQueryDetail dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenDataObjQueryDetail dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(GenDataObjQueryDetail dto) { + this.dataType = dto.getDataType().getCode(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjSelectorBo.java new file mode 100644 index 0000000..1a5ea2f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GenDataObjSelectorBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.gen.bo.data.obj; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.service.GenDataObjCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataObjSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + public GenDataObjSelectorBo() { + } + + public GenDataObjSelectorBo(GenDataObj dto) { + super(dto); + } + + @Override + protected void afterInit(GenDataObj dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenDataObjCategoryService genDataObjCategoryService = ApplicationUtil.getBean( + GenDataObjCategoryService.class); + GenDataObjCategory category = genDataObjCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GetGenDataObjBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GetGenDataObjBo.java new file mode 100644 index 0000000..52989ca --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/GetGenDataObjBo.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.template.gen.bo.data.obj; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.service.GenDataObjCategoryService; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjQueryDetailService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetGenDataObjBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 主表ID + */ + @ApiModelProperty("主表ID") + private String mainTableId; + + /** + * 主表名称 + */ + @ApiModelProperty("主表名称") + private String mainTableName; + + /** + * 主表别名 + */ + @ApiModelProperty("主表别名") + private String mainTableAlias; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 关联字段 + */ + @ApiModelProperty("关联字段") + private List columns; + + /** + * 自定义查询 + */ + @ApiModelProperty("自定义查询") + private List queryColumns; + + public GetGenDataObjBo() { + + } + + public GetGenDataObjBo(GenDataObj dto) { + + super(dto); + } + + @Override + protected void afterInit(GenDataObj dto) { + + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenDataObjCategoryService genDataObjCategoryService = ApplicationUtil.getBean( + GenDataObjCategoryService.class); + GenDataObjCategory category = genDataObjCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + + GenDataEntityService genDataEntityService = ApplicationUtil.getBean( + GenDataEntityService.class); + GenDataEntity entity = genDataEntityService.findById(dto.getMainTableId()); + this.mainTableName = entity.getName(); + + GenDataObjDetailService genDataObjDetailService = ApplicationUtil.getBean( + GenDataObjDetailService.class); + List details = genDataObjDetailService.getByObjId(dto.getId()); + if (!CollectionUtil.isEmpty(details)) { + this.columns = details.stream().map(GenDataObjDetailBo::new).collect(Collectors.toList()); + } + + GenDataObjQueryDetailService genDataObjQueryDetailService = ApplicationUtil.getBean( + GenDataObjQueryDetailService.class); + List queryDetails = genDataObjQueryDetailService.getByObjId(dto.getId()); + if (!CollectionUtil.isEmpty(queryDetails)) { + this.queryColumns = queryDetails.stream().map(GenDataObjQueryDetailBo::new) + .collect(Collectors.toList()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/QueryGenDataObjBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/QueryGenDataObjBo.java new file mode 100644 index 0000000..dd995c0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/QueryGenDataObjBo.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.template.gen.bo.data.obj; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.service.GenDataObjCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryGenDataObjBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人ID + */ + @ApiModelProperty("创建人ID") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人ID + */ + @ApiModelProperty("修改人ID") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QueryGenDataObjBo() { + } + + public QueryGenDataObjBo(GenDataObj dto) { + super(dto); + } + + @Override + protected void afterInit(GenDataObj dto) { + + if (!StringUtil.isBlank(dto.getCategoryId())) { + GenDataObjCategoryService genDataObjCategoryService = ApplicationUtil.getBean( + GenDataObjCategoryService.class); + GenDataObjCategory category = genDataObjCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/GenDataObjCategorySelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/GenDataObjCategorySelectorBo.java new file mode 100644 index 0000000..5d1e6a6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/GenDataObjCategorySelectorBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.bo.data.obj.category; + +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataObjCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public GenDataObjCategorySelectorBo() { + } + + public GenDataObjCategorySelectorBo(GenDataObjCategory dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/GetGenDataObjCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/GetGenDataObjCategoryBo.java new file mode 100644 index 0000000..fa1db89 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/GetGenDataObjCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.data.obj.category; + +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetGenDataObjCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public GetGenDataObjCategoryBo() { + + } + + public GetGenDataObjCategoryBo(GenDataObjCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/QueryGenDataObjCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/QueryGenDataObjCategoryBo.java new file mode 100644 index 0000000..98583de --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/data/obj/category/QueryGenDataObjCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.bo.data.obj.category; + +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryGenDataObjCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public QueryGenDataObjCategoryBo() { + + } + + public QueryGenDataObjCategoryBo(GenDataObjCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenCreateColumnConfigBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenCreateColumnConfigBo.java new file mode 100644 index 0000000..194cda5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenCreateColumnConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.gen.bo.gen; + +import com.lframework.xingyun.template.gen.dto.gen.GenCreateColumnConfigDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCreateColumnConfigBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 是否必填 + */ + @ApiModelProperty("是否必填") + private Boolean required; + + /** + * 排序编号 + */ + @ApiModelProperty("排序编号") + private Integer orderNo; + + public GenCreateColumnConfigBo() { + + } + + public GenCreateColumnConfigBo(GenCreateColumnConfigDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenCreateColumnConfigDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(GenCreateColumnConfigDto dto) { + + super.afterInit(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenDetailColumnConfigBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenDetailColumnConfigBo.java new file mode 100644 index 0000000..3ac614d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenDetailColumnConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.gen.bo.gen; + +import com.lframework.xingyun.template.gen.dto.gen.GenDetailColumnConfigDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDetailColumnConfigBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 列宽 + */ + @ApiModelProperty("列宽") + private Integer span; + + /** + * 排序编号 + */ + @ApiModelProperty("排序编号") + private Integer orderNo; + + public GenDetailColumnConfigBo() { + + } + + public GenDetailColumnConfigBo(GenDetailColumnConfigDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenDetailColumnConfigDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(GenDetailColumnConfigDto dto) { + + super.afterInit(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenGenerateInfoBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenGenerateInfoBo.java new file mode 100644 index 0000000..d0efaa2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenGenerateInfoBo.java @@ -0,0 +1,121 @@ +package com.lframework.xingyun.template.gen.bo.gen; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import lombok.Data; + +@Data +public class GenGenerateInfoBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 生成模板类型 + */ + private Integer templateType; + + /** + * 包名 + */ + private String packageName; + + /** + * 模块名 + */ + private String moduleName; + + /** + * 业务名 + */ + private String bizName; + + /** + * 类名 + */ + private String className; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 父级菜单ID + */ + private String parentMenuId; + + /** + * 父级菜单名称 + */ + private String parentMenuName; + + /** + * 主键类型 + */ + private Integer keyType; + + /** + * 作者 + */ + private String author; + + /** + * 本级菜单编号 + */ + private String menuCode; + + /** + * 本级菜单名称 + */ + private String menuName; + + /** + * 详情页Span总数量 + */ + private Integer detailSpan; + + /** + * 是否应用缓存 + */ + private Boolean isCache; + + /** + * 是否内置删除功能 + */ + private Boolean hasDelete; + + public GenGenerateInfoBo() { + + } + + public GenGenerateInfoBo(GenGenerateInfoDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenGenerateInfoDto dto) { + + return super.convert(dto, GenGenerateInfoBo::getTemplateType, GenGenerateInfoBo::getKeyType); + } + + @Override + protected void afterInit(GenGenerateInfoDto dto) { + + this.templateType = dto.getTemplateType().getCode(); + this.keyType = dto.getKeyType().getCode(); + + if (!StringUtil.isBlank(dto.getParentMenuId())) { + SysMenuService sysMenuService = ApplicationUtil.getBean(SysMenuService.class); + this.parentMenuName = sysMenuService.findById(dto.getParentMenuId()).getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenQueryColumnConfigBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenQueryColumnConfigBo.java new file mode 100644 index 0000000..db1a9cd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenQueryColumnConfigBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.template.gen.bo.gen; + +import com.lframework.xingyun.template.gen.dto.gen.GenQueryColumnConfigDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenQueryColumnConfigBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 宽度类型 + */ + @ApiModelProperty("宽度类型") + private Integer widthType; + + /** + * 宽度 + */ + @ApiModelProperty("宽度") + private Integer width; + + /** + * 是否页面排序 + */ + @ApiModelProperty("是否页面排序") + private Boolean sortable; + + /** + * 排序编号 + */ + @ApiModelProperty("排序编号") + private Integer orderNo; + + public GenQueryColumnConfigBo() { + + } + + public GenQueryColumnConfigBo(GenQueryColumnConfigDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenQueryColumnConfigDto dto) { + + return super.convert(dto, GenQueryColumnConfigBo::getWidthType); + } + + @Override + protected void afterInit(GenQueryColumnConfigDto dto) { + + this.widthType = dto.getWidthType().getCode(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenQueryParamsColumnConfigBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenQueryParamsColumnConfigBo.java new file mode 100644 index 0000000..c117f8f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenQueryParamsColumnConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.gen.bo.gen; + +import com.lframework.xingyun.template.gen.dto.gen.GenQueryParamsColumnConfigDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenQueryParamsColumnConfigBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 查询类型 + */ + @ApiModelProperty("查询类型") + private Integer queryType; + + /** + * 排序编号 + */ + @ApiModelProperty("排序编号") + private Integer orderNo; + + public GenQueryParamsColumnConfigBo() { + + } + + public GenQueryParamsColumnConfigBo(GenQueryParamsColumnConfigDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenQueryParamsColumnConfigDto dto) { + + return super.convert(dto, GenQueryParamsColumnConfigBo::getQueryType); + } + + @Override + protected void afterInit(GenQueryParamsColumnConfigDto dto) { + + this.queryType = dto.getQueryType().getCode(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenUpdateColumnConfigBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenUpdateColumnConfigBo.java new file mode 100644 index 0000000..579c917 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/gen/GenUpdateColumnConfigBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.gen.bo.gen; + +import com.lframework.xingyun.template.gen.dto.gen.GenUpdateColumnConfigDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenUpdateColumnConfigBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 是否必填 + */ + @ApiModelProperty("是否必填") + private Boolean required; + + /** + * 排序编号 + */ + @ApiModelProperty("排序编号") + private Integer orderNo; + + public GenUpdateColumnConfigBo() { + + } + + public GenUpdateColumnConfigBo(GenUpdateColumnConfigDto dto) { + + super(dto); + } + + @Override + public BaseBo convert(GenUpdateColumnConfigDto dto) { + + return super.convert(dto); + } + + @Override + protected void afterInit(GenUpdateColumnConfigDto dto) { + + super.afterInit(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/simpledb/SimpleDBSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/simpledb/SimpleDBSelectorBo.java new file mode 100644 index 0000000..2f6be82 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/bo/simpledb/SimpleDBSelectorBo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.gen.bo.simpledb; + +import com.lframework.xingyun.template.gen.dto.simpledb.SimpleDBDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SimpleDBSelectorBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * 库名 + */ + @ApiModelProperty("库名") + private String tableSchema; + + /** + * 表名 + */ + @ApiModelProperty("表名") + private String tableName; + + public SimpleDBSelectorBo() { + + } + + public SimpleDBSelectorBo(SimpleDBDto dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomListBuilder.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomListBuilder.java new file mode 100644 index 0000000..4621fc5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomListBuilder.java @@ -0,0 +1,370 @@ +package com.lframework.xingyun.template.gen.builders; + +import cn.hutool.core.convert.Convert; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig.FieldConfig; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig.HandleColumn; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig.ListConfig; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig.QueryParam; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig.Toolbar; +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryObj; +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryParamObj; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListDetail; +import com.lframework.xingyun.template.gen.entity.GenCustomListHandleColumn; +import com.lframework.xingyun.template.gen.entity.GenCustomListQueryParams; +import com.lframework.xingyun.template.gen.entity.GenCustomListToolbar; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import com.lframework.xingyun.template.gen.service.GenCustomListDetailService; +import com.lframework.xingyun.template.gen.service.GenCustomListHandleColumnService; +import com.lframework.xingyun.template.gen.service.GenCustomListQueryParamsService; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.service.GenCustomListToolbarService; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjQueryDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Component; + +@Component +public class CustomListBuilder { + + @Autowired + private GenCustomListService genCustomListService; + + @Autowired + private GenCustomListDetailService genCustomListDetailService; + + @Autowired + private GenCustomListQueryParamsService genCustomListQueryParamsService; + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Autowired + private GenDataObjService genDataObjService; + + @Autowired + private GenDataObjDetailService genDataObjDetailService; + + @Autowired + private GenDataObjQueryDetailService genDataObjQueryDetailService; + + @Autowired + private DataObjectBuilder dataObjectBuilder; + + @Autowired + private GenCustomListToolbarService genCustomListToolbarService; + + @Autowired + private GenCustomListHandleColumnService genCustomListHandleColumnService; + + public DataObjectQueryObj buildQueryObj(String id, DataObjectQueryParamObj queryParamObj) { + GenCustomList customList = genCustomListService.findById(id); + if (customList == null) { + throw new DefaultClientException("自定义列表不存在!"); + } + + CustomListBuilder customListBuilder = ApplicationUtil.getBean(CustomListBuilder.class); + CustomListConfig config = customListBuilder.buildConfig(id); + + DataObjectQueryObj obj = dataObjectBuilder.buildQueryObj(customList.getDataObjId()); + obj.setQueryParamObj(this.buildQueryParamObj(queryParamObj, config)); + obj.setSuffixSql(customList.getSuffixSql()); + obj.setQueryPrefixSql(customList.getQueryPrefixSql()); + obj.setQuerySuffixSql(customList.getQuerySuffixSql()); + + return obj; + } + + @Cacheable(value = CustomListConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + public CustomListConfig buildConfig(String id) { + + // 先查询配置信息 + GenCustomList data = genCustomListService.findById(id); + + if (data == null) { + throw new DefaultClientException("自定义列表不存在!"); + } + + CustomListConfig result = new CustomListConfig(); + + List toolbars = genCustomListToolbarService + .getByCustomListId(data.getId()); + if (!CollectionUtil.isEmpty(toolbars)) { + result.setToolbars(toolbars.stream().map(t -> { + Toolbar toolbar = new Toolbar(); + toolbar.setId(t.getId()); + toolbar.setName(t.getName()); + toolbar.setViewType(t.getViewType().getCode()); + toolbar.setBtnType(t.getBtnType().getCode()); + toolbar.setBtnConfig(t.getBtnConfig()); + toolbar.setRequestParam(t.getRequestParam()); + toolbar.setIcon(t.getIcon()); + + return toolbar; + }).collect(Collectors.toList())); + } + + List handleColumns = genCustomListHandleColumnService + .getByCustomListId(data.getId()); + if (!CollectionUtil.isEmpty(handleColumns)) { + result.setHandleColumns(handleColumns.stream().map(t -> { + HandleColumn handleColumn = new HandleColumn(); + handleColumn.setId(t.getId()); + handleColumn.setName(t.getName()); + handleColumn.setViewType(t.getViewType().getCode()); + handleColumn.setBtnType(t.getBtnType().getCode()); + handleColumn.setBtnConfig(t.getBtnConfig()); + handleColumn.setRequestParam(t.getRequestParam()); + handleColumn.setIcon(t.getIcon()); + handleColumn.setWidth(t.getWidth()); + + return handleColumn; + }).collect(Collectors.toList())); + } + + List genCustomListQueryParamsList = genCustomListQueryParamsService + .getByCustomListId( + data.getId()); + List genCustomListDetailList = genCustomListDetailService + .getByCustomListId( + data.getId()); + + List queryParams = new ArrayList<>(); + + if (CollectionUtil.isNotEmpty(genCustomListQueryParamsList)) { + for (GenCustomListQueryParams genCustomListQueryParams : genCustomListQueryParamsList) { + GenDataEntityDetail entityDetail = genDataEntityDetailService.getById( + genCustomListQueryParams.getDataEntityId()); + + String relaId = genCustomListQueryParams.getRelaId(); + GenDataObj dataObj = null; + GenDataObjDetail dataObjDetail = null; + if (genCustomListQueryParams.getType() == GenCustomListDetailType.MAIN_TABLE) { + dataObj = genDataObjService.findById(relaId); + } else if (genCustomListQueryParams.getType() == GenCustomListDetailType.SUB_TALBE) { + dataObjDetail = genDataObjDetailService.getById(relaId); + } else { + throw new DefaultSysException("不支持的类型!"); + } + + QueryParam queryParam = new QueryParam(); + queryParam.setTableAlias( + genCustomListQueryParams.getType() == GenCustomListDetailType.SUB_TALBE + ? dataObjDetail.getSubTableAlias() : dataObj.getMainTableAlias()); + queryParam.setColumnName(entityDetail.getDbColumnName()); + queryParam.setName(entityDetail.getName()); + queryParam.setFrontShow(genCustomListQueryParams.getFrontShow()); + queryParam.setQueryType(genCustomListQueryParams.getQueryType().getCode()); + queryParam.setFormWidth(genCustomListQueryParams.getFormWidth()); + queryParam.setViewType(entityDetail.getViewType().getCode()); + queryParam.setDataType(entityDetail.getDataType().getCode()); + queryParam.setFixEnum(entityDetail.getFixEnum()); + queryParam.setFrontType(entityDetail.getEnumFront()); + if (StringUtil.isNotEmpty(genCustomListQueryParams.getDefaultValue())) { + queryParam.setDefaultValue(Convert.convert( + entityDetail.getViewType() == GenViewType.DATE_RANGE ? String.class + : entityDetail.getDataType().getClazz(), + genCustomListQueryParams.getDefaultValue())); + } + queryParam.setHasAvailableTag( + entityDetail.getViewType() == GenViewType.SELECT + && entityDetail.getDataType() == GenDataType.BOOLEAN + && "available".equals(entityDetail.getColumnName())); + + if (entityDetail.getViewType() == GenViewType.DATA_DIC) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dic = sysDataDicService.findById(entityDetail.getDataDicId()); + queryParam.setDataDicCode(dic.getCode()); + } else if (entityDetail.getViewType() == GenViewType.CUSTOM_SELECTOR) { + GenCustomSelectorService genCustomSelectorService = ApplicationUtil + .getBean(GenCustomSelectorService.class); + GenCustomSelector selector = genCustomSelectorService + .findById(entityDetail.getCustomSelectorId()); + queryParam.setCustomSelectorId(selector.getId()); + } + + queryParams.add(queryParam); + } + } + + result.setQueryParams(queryParams); + + ListConfig listConfig = new ListConfig(); + listConfig.setId(data.getId()); + listConfig.setListType(data.getListType().getCode()); + listConfig.setLabelWidth(data.getLabelWidth()); + listConfig.setHasPage(data.getHasPage()); + listConfig.setTreeData(data.getTreeData()); + GenDataEntityDetail idColumnEntityDetail = genDataEntityDetailService + .getById(data.getIdColumn()); + GenDataObj idColumnDataObj = genDataObjService.findById(data.getIdColumnRelaId()); + GenDataObjDetail idColumnDataObjDetail = genDataObjDetailService + .getById(data.getIdColumnRelaId()); + + listConfig.setIdColumn( + (idColumnDataObj == null ? idColumnDataObjDetail.getSubTableAlias() + : idColumnDataObj.getMainTableAlias()) + "_" + + idColumnEntityDetail.getDbColumnName()); + listConfig.setAllowExport(data.getAllowExport()); + + if (data.getTreeData()) { + GenDataEntityDetail entityDetail = genDataEntityDetailService + .getById(data.getTreePidColumn()); + GenDataObj dataObj = genDataObjService.findById(data.getTreePidColumnRelaId()); + GenDataObjDetail dataObjDetail = genDataObjDetailService + .getById(data.getTreePidColumnRelaId()); + + listConfig.setTreePidColumn( + (dataObj == null ? dataObjDetail.getSubTableAlias() : dataObj.getMainTableAlias()) + "_" + + entityDetail.getDbColumnName()); + + entityDetail = genDataEntityDetailService.getById(data.getTreeNodeColumn()); + dataObj = genDataObjService.findById(data.getTreeNodeColumnRelaId()); + dataObjDetail = genDataObjDetailService + .getById(data.getTreeNodeColumnRelaId()); + + listConfig.setTreeNodeColumn( + (dataObj == null ? dataObjDetail.getSubTableAlias() : dataObj.getMainTableAlias()) + "_" + + entityDetail.getDbColumnName()); + + listConfig.setTreeChildrenKey(data.getTreeChildrenKey()); + } + + List fieldConfigs = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(genCustomListDetailList)) { + for (GenCustomListDetail genCustomListDetail : genCustomListDetailList) { + String relaId = genCustomListDetail.getRelaId(); + GenDataEntityDetail entityDetail = null; + GenDataObjQueryDetail dataObjQueryDetail = null; + + GenDataObj dataObj = null; + GenDataObjDetail dataObjDetail = null; + if (genCustomListDetail.getType() == GenCustomListDetailType.MAIN_TABLE) { + entityDetail = genDataEntityDetailService.getById(genCustomListDetail.getDataEntityId()); + dataObj = genDataObjService.findById(relaId); + } else if (genCustomListDetail.getType() == GenCustomListDetailType.SUB_TALBE) { + entityDetail = genDataEntityDetailService.getById(genCustomListDetail.getDataEntityId()); + dataObjDetail = genDataObjDetailService.getById(relaId); + } else { + dataObjQueryDetail = genDataObjQueryDetailService.getById( + genCustomListDetail.getRelaId()); + } + FieldConfig fieldConfig = new FieldConfig(); + fieldConfig.setName((genCustomListDetail.getType() == GenCustomListDetailType.MAIN_TABLE + || genCustomListDetail.getType() == GenCustomListDetailType.SUB_TALBE) + ? entityDetail.getName() : dataObjQueryDetail.getCustomName()); + + if (genCustomListDetail.getType() == GenCustomListDetailType.MAIN_TABLE) { + fieldConfig.setColumnName( + dataObj.getMainTableAlias() + "_" + entityDetail.getDbColumnName()); + } else if (genCustomListDetail.getType() == GenCustomListDetailType.SUB_TALBE) { + fieldConfig.setColumnName( + dataObjDetail.getSubTableAlias() + "_" + entityDetail.getDbColumnName()); + } else { + fieldConfig.setColumnName("custom_" + dataObjQueryDetail.getCustomAlias()); + } + + fieldConfig.setWidthType(genCustomListDetail.getWidthType().getCode()); + fieldConfig.setWidth(genCustomListDetail.getWidth()); + fieldConfig.setSortable(genCustomListDetail.getSortable()); + fieldConfig.setFormatter(genCustomListDetail.getFormatter()); + if (genCustomListDetail.getType() == GenCustomListDetailType.MAIN_TABLE + || genCustomListDetail.getType() == GenCustomListDetailType.SUB_TALBE) { + fieldConfig.setIsNumberType(GenDataType.isNumberType(entityDetail.getDataType())); + fieldConfig.setHasAvailableTag( + entityDetail.getViewType() == GenViewType.SELECT + && entityDetail.getDataType() == GenDataType.BOOLEAN + && "available".equals(entityDetail.getColumnName())); + fieldConfig.setFrontType(entityDetail.getEnumFront()); + fieldConfig.setFixEnum(entityDetail.getFixEnum()); + fieldConfig.setDataType(entityDetail.getDataType().getCode()); + } else { + fieldConfig.setIsNumberType(GenDataType.isNumberType(dataObjQueryDetail.getDataType())); + fieldConfig.setHasAvailableTag(false); + fieldConfig.setFrontType(StringPool.EMPTY_STR); + fieldConfig.setFixEnum(false); + fieldConfig.setDataType(dataObjQueryDetail.getDataType().getCode()); + } + + fieldConfigs.add(fieldConfig); + } + } + + listConfig.setFields(fieldConfigs); + result.setListConfig(listConfig); + + return result; + } + + private DataObjectQueryParamObj buildQueryParamObj(DataObjectQueryParamObj queryParamObj, + CustomListConfig config) { + if (queryParamObj == null) { + return null; + } + + if (CollectionUtil.isNotEmpty(queryParamObj.getConditions())) { + for (DataObjectQueryParamObj.Condition condition : queryParamObj.getConditions()) { + FieldConfig fieldConfig = config.getListConfig().getFields().stream().filter( + t -> (condition.getTableAlias() + "_" + condition.getColumnName()) + .equals(t.getColumnName())).findFirst().orElse(null); + if (fieldConfig != null) { + if (condition.getValue() != null) { + condition.setValue(Convert.convert( + EnumUtil.getByCode(GenDataType.class, fieldConfig.getDataType()).getClazz(), + condition.getValue())); + } else if (CollectionUtil.isNotEmpty(condition.getValues())) { + condition.setValues(condition.getValues().stream().map(t -> Convert.convert( + EnumUtil.getByCode(GenDataType.class, fieldConfig.getDataType()).getClazz(), t)) + .collect(Collectors.toList())); + } + } + GenQueryType queryType = EnumUtil.getByCode(GenQueryType.class, condition.getQueryType()); + if (queryType == GenQueryType.IN) { + condition.setValuePrefix("("); + condition.setValueSuffix(")"); + } else if (queryType == GenQueryType.NOT_IN) { + condition.setValuePrefix("("); + condition.setValueSuffix(")"); + } else if (queryType == GenQueryType.LEFT_LIKE) { + condition.setValuePrefix("CONCAT('%',"); + condition.setValueSuffix(")"); + } else if (queryType == GenQueryType.RIGHT_LIKE) { + condition.setValuePrefix("CONCAT("); + condition.setValueSuffix(", '%')"); + } else if (queryType == GenQueryType.AROUND_LIKE) { + condition.setValuePrefix("CONCAT('%',"); + condition.setValueSuffix(", '%')"); + } else { + condition.setValuePrefix(StringPool.EMPTY_STR); + condition.setValueSuffix(StringPool.EMPTY_STR); + } + } + } + return queryParamObj; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomPageBuilder.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomPageBuilder.java new file mode 100644 index 0000000..6a8d82c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomPageBuilder.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.builders; + +import cn.hutool.json.JSONObject; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.xingyun.template.gen.components.custom.page.CustomPageConfig; +import com.lframework.xingyun.template.gen.service.GenCustomPageService; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.starter.web.utils.JsonUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class CustomPageBuilder { + + @Autowired + private GenCustomPageService genCustomPageService; + + //@Cacheable(value = CustomPageConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + public CustomPageConfig buildConfig(Integer id) { + + GenCustomPage page = genCustomPageService.findById(id); + if (page == null) { + throw new DefaultClientException("自定义页面不存在!"); + } + + CustomPageConfig config = new CustomPageConfig(); + config.setId(page.getId()); + JSONObject obj = new JSONObject(); + obj.set("template", page.getPageCode()); + String templateStr = JsonUtil.toJsonStr(obj); + templateStr = templateStr.substring("{\"template\":".length(), templateStr.length() - 1); + + String scriptStr = page.getScriptCode(); + String componentConfig = scriptStr.substring(0, scriptStr.indexOf("{") + 1) + "template:" + templateStr + "," + scriptStr.substring(scriptStr.indexOf("{") + 1); + componentConfig = "return " + componentConfig.substring("export default".length()); + config.setComponentConfig(componentConfig); + + return config; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomSelectorBuilder.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomSelectorBuilder.java new file mode 100644 index 0000000..d5866b5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/CustomSelectorBuilder.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.template.gen.builders; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.xingyun.template.gen.components.custom.selector.CustomSelectorConfig; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Component; + +@Component +public class CustomSelectorBuilder { + + @Autowired + private GenCustomSelectorService genCustomSelectorService; + + @Autowired + private GenDataObjService genDataObjService; + + @Autowired + private GenDataObjDetailService genDataObjDetailService; + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Cacheable(value = CustomSelectorConfig.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + public CustomSelectorConfig buildConfig(String id) { + + // 先查询配置信息 + GenCustomSelector data = genCustomSelectorService.findById(id); + + if (data == null) { + throw new DefaultClientException("自定义选择器不存在!"); + } + + GenDataObj dataObj = genDataObjService.findById(data.getIdColumnRelaId()); + GenDataObjDetail dataObjDetail = genDataObjDetailService.getById(data.getIdColumnRelaId()); + GenDataEntityDetail entityDetail = genDataEntityDetailService.getById(data.getIdColumn()); + + CustomSelectorConfig result = new CustomSelectorConfig(); + result.setCustomListId(data.getCustomListId()); + result.setIdColumn( + (dataObj == null ? dataObjDetail.getSubTableAlias() : dataObj.getMainTableAlias()) + "_" + + entityDetail.getDbColumnName()); + + dataObj = genDataObjService.findById(data.getNameColumnRelaId()); + dataObjDetail = genDataObjDetailService.getById(data.getNameColumnRelaId()); + entityDetail = genDataEntityDetailService.getById(data.getNameColumn()); + + result.setNameColumn( + (dataObj == null ? dataObjDetail.getSubTableAlias() : dataObj.getMainTableAlias()) + "_" + + entityDetail.getDbColumnName()); + result.setPlaceholder(data.getPlaceholder()); + result.setDialogTittle(data.getDialogTittle()); + result.setDialogWidth(data.getDialogWidth()); + + return result; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/DataEntityBuilder.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/DataEntityBuilder.java new file mode 100644 index 0000000..5698d29 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/DataEntityBuilder.java @@ -0,0 +1,117 @@ +package com.lframework.xingyun.template.gen.builders; + +import com.lframework.xingyun.template.gen.components.DataEntity; +import com.lframework.xingyun.template.gen.components.DataEntityColumn; +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.service.GenCreateColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.service.GenDetailColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenQueryColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenQueryParamsColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenUpdateColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenerateInfoService; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 数据实体Builder + */ +@Component +public class DataEntityBuilder { + + @Autowired + private GenDataEntityService genDataEntityService; + + @Autowired + private GenerateInfoService generateInfoService; + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Autowired + private GenCreateColumnConfigService genCreateColumnConfigService; + + @Autowired + private GenUpdateColumnConfigService genUpdateColumnConfigService; + + @Autowired + private GenQueryColumnConfigService genQueryColumnConfigService; + + @Autowired + private GenQueryParamsColumnConfigService genQueryParamsColumnConfigService; + + @Autowired + private GenDetailColumnConfigService genDetailColumnConfigService; + + /** + * 根据数据对象ID构建 + * + * @param id + * @return + */ + public DataEntity build(String id) { + + // 根据ID查询数据对象 + GenDataEntity dataEntity = genDataEntityService.findById(id); + DataEntity result = new DataEntity(); + result.setId(dataEntity.getId()); + result.setName(dataEntity.getName()); + result.setDescription(dataEntity.getDescription()); + result.setTable(dataEntity); + result.setColumns(this.buildColumns(dataEntity.getId())); + result.setGenerateInfo(this.buildGenerateInfo(dataEntity.getId())); + + return result; + } + + private GenGenerateInfoDto buildGenerateInfo(String dataObjId) { + + return generateInfoService.getByEntityId(dataObjId); + } + + private List buildColumns(String entityId) { + + List results = new ArrayList<>(); + + List columns = genDataEntityDetailService.getByEntityId(entityId); + for (GenDataEntityDetail column : columns) { + DataEntityColumn result = new DataEntityColumn(); + result.setId(column.getId()); + result.setName(column.getName()); + result.setColumnName(column.getColumnName()); + result.setIsKey(column.getIsKey()); + result.setDataType(column.getDataType()); + result.setColumnOrder(column.getColumnOrder()); + result.setDescription(column.getDescription()); + result.setViewType(column.getViewType()); + result.setTableColumn(column); + result.setFixEnum(column.getFixEnum()); + result.setEnumBack(column.getEnumBack()); + result.setEnumFront(column.getEnumFront()); + result.setRegularExpression(column.getRegularExpression()); + result.setIsOrder(column.getIsOrder()); + if (result.getIsOrder()) { + result.setOrderType(column.getOrderType()); + } + + result.setCreateConfig(genCreateColumnConfigService.findById(column.getId())); + result.setUpdateConfig(genUpdateColumnConfigService.findById(column.getId())); + result.setQueryConfig(genQueryColumnConfigService.findById(column.getId())); + result.setQueryParamsConfig(genQueryParamsColumnConfigService.findById(column.getId())); + result.setDetailConfig(genDetailColumnConfigService.findById(column.getId())); + result.setLen(column.getLen()); + result.setDataDicId(column.getDataDicId()); + result.setCustomSelectorId(column.getCustomSelectorId()); + result.setDecimals(column.getDecimals()); + + results.add(result); + } + + return results; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/DataObjectBuilder.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/DataObjectBuilder.java new file mode 100644 index 0000000..3287708 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/builders/DataObjectBuilder.java @@ -0,0 +1,151 @@ +package com.lframework.xingyun.template.gen.builders; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryObj; +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryObj.QuerySubTableCondition; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjQueryDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Component; + +/** + * 数据对象Builder + */ +@Component +public class DataObjectBuilder { + + @Autowired + private GenDataObjService genDataObjService; + + @Autowired + private GenDataObjDetailService genDataObjDetailService; + + @Autowired + private GenDataObjQueryDetailService genDataObjQueryDetailService; + + @Autowired + private GenDataEntityService genDataEntityService; + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Cacheable(value = DataObjectQueryObj.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + public DataObjectQueryObj buildQueryObj(String id) { + // 先查询配置信息 + GenDataObj data = genDataObjService.findById(id); + + if (data == null) { + throw new DefaultClientException("数据对象不存在!"); + } + + List details = genDataObjDetailService.getByObjId(data.getId()); + List queryDetails = genDataObjQueryDetailService.getByObjId(data.getId()); + + String mainTableId = data.getMainTableId(); + GenDataEntity dataEntity = genDataEntityService.findById(mainTableId); + if (dataEntity == null) { + throw new DefaultClientException("数据实体不存在!"); + } + + List entityDetails = genDataEntityDetailService.getByEntityId(dataEntity.getId()); + + DataObjectQueryObj queryObj = new DataObjectQueryObj(); + List fields = new ArrayList<>(); + + // 主表字段 + if (CollectionUtil.isNotEmpty(entityDetails)) { + for (GenDataEntityDetail entityDetail : entityDetails) { + DataObjectQueryObj.QueryField field = new DataObjectQueryObj.QueryField(); + field.setTableAlias(data.getMainTableAlias()); + field.setColumnName(entityDetail.getDbColumnName()); + field.setColumnAlias(data.getMainTableAlias() + "_" + entityDetail.getDbColumnName()); + field.setDataType(entityDetail.getDataType()); + + fields.add(field); + } + } + + // 子表字段 + if (CollectionUtil.isNotEmpty(details)) { + for (GenDataObjDetail detail : details) { + GenDataEntity subTable = genDataEntityService.findById(detail.getSubTableId()); + List subTableDetails = genDataEntityDetailService.getByEntityId(subTable.getId()); + for (GenDataEntityDetail subTableDetail : subTableDetails) { + DataObjectQueryObj.QueryField field = new DataObjectQueryObj.QueryField(); + field.setTableAlias(detail.getSubTableAlias()); + field.setColumnName(subTableDetail.getDbColumnName()); + field.setColumnAlias(detail.getSubTableAlias() + "_" + subTableDetail.getDbColumnName()); + field.setDataType(subTableDetail.getDataType()); + + fields.add(field); + } + } + } + + // 自定义查询字段 + if (CollectionUtil.isNotEmpty(queryDetails)) { + for (GenDataObjQueryDetail queryDetail : queryDetails) { + DataObjectQueryObj.QueryField field = new DataObjectQueryObj.QueryField(); + field.setColumnName(queryDetail.getCustomSql()); + field.setColumnAlias("custom_" + queryDetail.getCustomAlias()); + field.setDataType(queryDetail.getDataType()); + + fields.add(field); + } + } + + + queryObj.setFields(fields); + queryObj.setMainTable(dataEntity.getTableName()); + queryObj.setMainTableAlias(data.getMainTableAlias()); + + // 关联字表 + List subTables = new ArrayList<>(); + for (GenDataObjDetail detail : details) { + GenDataEntity subTable= genDataEntityService.getById(detail.getSubTableId()); + + DataObjectQueryObj.QuerySubTable querySubTable = new DataObjectQueryObj.QuerySubTable(); + querySubTable.setSubTable(subTable.getTableName()); + querySubTable.setSubTableAlias(detail.getSubTableAlias()); + querySubTable.setJoinType(detail.getRelaMode().getSql()); + + String[] mainTableDetailIds = detail.getMainTableDetailIds().split(StringPool.STR_SPLIT); + String[] subTableDetailIds = detail.getSubTableDetailIds().split(StringPool.STR_SPLIT); + + querySubTable.setJoinCondition(new ArrayList<>()); + + for (int i = 0; i < mainTableDetailIds.length; i++) { + String mainTableDetailId = mainTableDetailIds[i]; + String subTableDetailId = subTableDetailIds[i]; + + GenDataEntityDetail mainTableDetail = genDataEntityDetailService.getById(mainTableDetailId); + GenDataEntityDetail subTableDetail = genDataEntityDetailService.getById(subTableDetailId); + + QuerySubTableCondition condition = new QuerySubTableCondition(); + condition.setKey(mainTableDetail.getDbColumnName()); + condition.setValue(subTableDetail.getDbColumnName()); + querySubTable.getJoinCondition().add(condition); + } + + + + subTables.add(querySubTable); + } + queryObj.setSubTables(subTables); + + return queryObj; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/CreateColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/CreateColumnConfig.java new file mode 100644 index 0000000..d8a2875 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/CreateColumnConfig.java @@ -0,0 +1,19 @@ +package com.lframework.xingyun.template.gen.components; + +public interface CreateColumnConfig { + + /** + * 是否必填 + * + * @return + */ + Boolean getRequired(); + + /** + * 排序 + * + * @return + */ + Integer getOrderNo(); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DataEntity.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DataEntity.java new file mode 100644 index 0000000..f3b9abb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DataEntity.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.template.gen.components; + +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import java.util.List; +import lombok.Data; + +/** + * 数据对象 + */ +@Data +public class DataEntity { + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 备注 + */ + private String description; + + /** + * 数据表信息 + */ + private Table table; + + /** + * 字段信息 + */ + private List columns; + + /** + * 配置信息 + */ + private GenGenerateInfoDto generateInfo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DataEntityColumn.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DataEntityColumn.java new file mode 100644 index 0000000..5b21b27 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DataEntityColumn.java @@ -0,0 +1,130 @@ +package com.lframework.xingyun.template.gen.components; + +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenOrderType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import lombok.Data; + +@Data +public class DataEntityColumn { + + /** + * ID + */ + private String id; + + /** + * 字段显示名称 + */ + private String name; + + /** + * 字段名称 + */ + private String columnName; + + /** + * 是否主键 + */ + private Boolean isKey; + + /** + * 数据类型 + */ + private GenDataType dataType; + + /** + * 排序编号 + */ + private Integer columnOrder; + + /** + * 备注 + */ + private String description; + + /** + * 显示类型 + */ + private GenViewType viewType; + + /** + * 是否内置枚举 + */ + private Boolean fixEnum; + + /** + * 后端枚举名 + */ + private String enumBack; + + /** + * 前端枚举名 + */ + private String enumFront; + + /** + * 正则表达式 + */ + private String regularExpression; + + /** + * 是否排序字段 + */ + private Boolean isOrder; + + /** + * 排序类型 + */ + private GenOrderType orderType; + + /** + * 数据表字段信息 + */ + private TableColumn tableColumn; + + /** + * 新增配置 + */ + private CreateColumnConfig createConfig; + + /** + * 修改配置 + */ + private UpdateColumnConfig updateConfig; + + /** + * 查询配置 + */ + private QueryColumnConfig queryConfig; + + /** + * 查询参数配置 + */ + private QueryParamsColumnConfig queryParamsConfig; + + /** + * 详情配置 + */ + private DetailColumnConfig detailConfig; + + /** + * 数据字典ID + */ + private String dataDicId; + + /** + * 自定义选择器ID + */ + private String customSelectorId; + + /** + * 长度 + */ + private Long len; + + /** + * 小数点位数 + */ + private Integer decimals; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DetailColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DetailColumnConfig.java new file mode 100644 index 0000000..da8d43d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/DetailColumnConfig.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.template.gen.components; + +public interface DetailColumnConfig { + + /** + * 列宽 + * + * @return + */ + Integer getSpan(); + + /** + * 排序 + * + * @return + */ + Integer getOrderNo(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/QueryColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/QueryColumnConfig.java new file mode 100644 index 0000000..f91fbcc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/QueryColumnConfig.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.components; + +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; + +public interface QueryColumnConfig { + + /** + * 宽度类型 + * + * @return + */ + GenQueryWidthType getWidthType(); + + /** + * 宽度 + * + * @return + */ + Integer getWidth(); + + /** + * 页面是否排序 + * + * @return + */ + Boolean getSortable(); + + /** + * 排序 + * + * @return + */ + Integer getOrderNo(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/QueryParamsColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/QueryParamsColumnConfig.java new file mode 100644 index 0000000..4d9e9d0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/QueryParamsColumnConfig.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.template.gen.components; + +import com.lframework.xingyun.template.gen.enums.GenQueryType; + +public interface QueryParamsColumnConfig { + + /** + * 查询类型 + * + * @return + */ + GenQueryType getQueryType(); + + /** + * 排序 + * + * @return + */ + Integer getOrderNo(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/Table.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/Table.java new file mode 100644 index 0000000..b477a7c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/Table.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.components; + +import com.lframework.xingyun.template.gen.enums.GenConvertType; + +public interface Table { + + /** + * 获取数据库名 + * + * @return + */ + String getSchema(); + + /** + * 获取数据表名 + * + * @return + */ + String getTableName(); + + /** + * 获取数据表备注 + * + * @return + */ + String getComment(); + + /** + * 获取转换方式 + * + * @return + */ + GenConvertType getConvertType(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/TableColumn.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/TableColumn.java new file mode 100644 index 0000000..f5d23c9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/TableColumn.java @@ -0,0 +1,11 @@ +package com.lframework.xingyun.template.gen.components; + +public interface TableColumn { + + /** + * 获取数据表中的字段名称 + * + * @return + */ + String getDbColumnName(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/UpdateColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/UpdateColumnConfig.java new file mode 100644 index 0000000..511eb06 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/UpdateColumnConfig.java @@ -0,0 +1,18 @@ +package com.lframework.xingyun.template.gen.components; + +public interface UpdateColumnConfig { + + /** + * 是否必填 + * + * @return + */ + Boolean getRequired(); + + /** + * 排序 + * + * @return + */ + Integer getOrderNo(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/list/CustomListConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/list/CustomListConfig.java new file mode 100644 index 0000000..b88836a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/list/CustomListConfig.java @@ -0,0 +1,377 @@ +package com.lframework.xingyun.template.gen.components.custom.list; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.VoidDto; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class CustomListConfig extends BaseBo implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "CustomListConfig"; + + /** + * 工具栏 + */ + @ApiModelProperty("工具栏") + private List toolbars; + + /** + * 查询参数 + */ + @ApiModelProperty("查询参数") + private List queryParams; + + /** + * 操作列 + */ + @ApiModelProperty("操作列") + private List handleColumns; + + /** + * 列表配置 + */ + @ApiModelProperty("列表配置") + private ListConfig listConfig; + + + @Data + public static class QueryParam implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 表别名 + */ + @ApiModelProperty("表别名") + private String tableAlias; + + /** + * 字段名称 + */ + @ApiModelProperty("字段名称") + private String columnName; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + private String name; + + /** + * 前端显示 + */ + @ApiModelProperty("前端显示") + private Boolean frontShow; + + /** + * 查询类型 + */ + @ApiModelProperty("查询类型") + private Integer queryType; + + /** + * 表单宽度 + */ + @ApiModelProperty("表单宽度") + private Integer formWidth; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + private Integer viewType; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + private Integer dataType; + + /** + * 是否内置枚举 + */ + @ApiModelProperty("是否内置枚举") + private Boolean fixEnum; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + @ApiModelProperty("前端字段类型 只有字段是枚举时生效,此值为前端枚举类型") + private String frontType; + + /** + * 是否包含状态Tag + */ + @ApiModelProperty("是否包含状态Tag") + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 数据字典Code + */ + @ApiModelProperty("数据字典Code") + private String dataDicCode; + + /** + * 自定义选择器ID + */ + @ApiModelProperty("自定义选择器ID") + private String customSelectorId; + + /** + * 默认值 + */ + @ApiModelProperty("默认值") + private Object defaultValue; + } + + @Data + public static class ListConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 列表类型 + */ + @ApiModelProperty("列表类型") + private Integer listType; + + /** + * 表单宽度列表 + */ + @ApiModelProperty("表单宽度列表") + private Integer labelWidth; + + /** + * 是否分页 + */ + @ApiModelProperty("是否分页") + private Boolean hasPage; + + /** + * 是否树形列表 + */ + @ApiModelProperty("是否树形列表") + private Boolean treeData; + + /** + * ID字段 + */ + @ApiModelProperty("ID字段") + private String idColumn; + + /** + * 父级ID字段 + */ + @ApiModelProperty("父级ID字段") + private String treePidColumn; + + /** + * 树形节点字段 + */ + @ApiModelProperty("树形节点字段") + private String treeNodeColumn; + + /** + * 子节点Key值 + */ + @ApiModelProperty("子节点Key值") + private String treeChildrenKey; + + /** + * 是否允许导出 + */ + @ApiModelProperty("是否允许导出") + private Boolean allowExport; + + /** + * 字段 + */ + @ApiModelProperty("字段") + private List fields; + } + + @Data + public static class FieldConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + private String name; + + /** + * 字段名称 + */ + @ApiModelProperty("字段名称") + private String columnName; + + /** + * 宽度类型 + */ + @ApiModelProperty("宽度类型") + private Integer widthType; + + /** + * 宽度 + */ + @ApiModelProperty("宽度") + private Integer width; + + /** + * 是否页面排序 + */ + @ApiModelProperty("是否页面排序") + private Boolean sortable; + + /** + * 是否数字类型 + */ + @ApiModelProperty("是否数字类型") + private Boolean isNumberType = Boolean.FALSE; + + /** + * 是否包含状态Tag + */ + @ApiModelProperty("是否包含状态Tag") + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 是否内置枚举 + */ + @ApiModelProperty("是否内置枚举") + private Boolean fixEnum; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + @ApiModelProperty("前端字段类型 只有字段是枚举时生效,此值为前端枚举类型") + private String frontType; + + /** + * 数据类型 + */ + @ApiModelProperty("数据类型") + private Integer dataType; + + /** + * 格式化脚本 + */ + @ApiModelProperty("格式化脚本") + private String formatter; + } + + @Data + public static class Toolbar implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + private String name; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + private String viewType; + + /** + * 按钮类型 + */ + @ApiModelProperty("按钮类型") + private Integer btnType; + + /** + * 按钮配置 + */ + @ApiModelProperty("按钮配置") + private String btnConfig; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 请求参数 + */ + @ApiModelProperty("请求参数") + private String requestParam; + } + + @Data + public static class HandleColumn implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + private String name; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + private String viewType; + + /** + * 按钮类型 + */ + @ApiModelProperty("按钮类型") + private Integer btnType; + + /** + * 按钮配置 + */ + @ApiModelProperty("按钮配置") + private String btnConfig; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 宽度 + */ + @ApiModelProperty("宽度") + private Integer width; + + /** + * 请求参数 + */ + @ApiModelProperty("请求参数") + private String requestParam; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/page/CustomPageConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/page/CustomPageConfig.java new file mode 100644 index 0000000..9feb8d2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/page/CustomPageConfig.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.components.custom.page; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.VoidDto; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class CustomPageConfig extends BaseBo implements Serializable { + + public static final String CACHE_NAME = "CustomPageConfig"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private Integer id; + + /** + * 组件配置 + */ + @ApiModelProperty("组件配置") + private String componentConfig; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/selector/CustomSelectorConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/selector/CustomSelectorConfig.java new file mode 100644 index 0000000..7d8be96 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/custom/selector/CustomSelectorConfig.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.template.gen.components.custom.selector; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.VoidDto; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class CustomSelectorConfig extends BaseBo implements Serializable { + + public static final String CACHE_NAME = "CustomSelectorConfig"; + + private static final long serialVersionUID = 1L; + + /** + * 自定义列表ID + */ + @ApiModelProperty("自定义列表ID") + private String customListId; + + /** + * ID字段 + */ + @ApiModelProperty("ID字段") + private String idColumn; + + /** + * 名称字段 + */ + @ApiModelProperty("名称字段") + private String nameColumn; + + /** + * 占位符 + */ + @ApiModelProperty("占位符") + private String placeholder; + + /** + * 对话框标题 + */ + @ApiModelProperty("对话框标题") + private String dialogTittle; + + /** + * 对话框宽度 + */ + @ApiModelProperty("对话框宽度") + private String dialogWidth; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/data/obj/DataObjectQueryObj.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/data/obj/DataObjectQueryObj.java new file mode 100644 index 0000000..381488b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/data/obj/DataObjectQueryObj.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.template.gen.components.data.obj; + +import com.lframework.xingyun.template.gen.enums.GenDataType; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class DataObjectQueryObj implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "DataObjectQueryObj"; + + /** + * SQL的SELECT部分 + */ + private List fields; + + /** + * 主表 FROM部分 + */ + private String mainTable; + + /** + * 主表别名 + */ + private String mainTableAlias; + + /** + * 关联的子表 + */ + private List subTables; + + /** + * 查询参数 + */ + private DataObjectQueryParamObj queryParamObj; + + /** + * 查询前置SQL + */ + private String queryPrefixSql; + + /** + * 查询后置SQL + */ + private String querySuffixSql; + + /** + * 后置SQL + */ + private String suffixSql; + + @Data + public static class QueryField implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 表别名 如果此值为空,代表为自定义查询字段 + */ + private String tableAlias; + + /** + * 字段名 + */ + private String columnName; + + /** + * 字段别名 + */ + private String columnAlias; + + /** + * 数据类型 + */ + private GenDataType dataType; + } + + @Data + public static class QuerySubTable implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 子表 + */ + private String subTable; + + /** + * 子表别名 + */ + private String subTableAlias; + + /** + * 关联方式 + */ + private String joinType; + + /** + * 关联条件 key:主表字段 value:子表字段 + */ + private List joinCondition; + } + + @Data + public static class QuerySubTableCondition implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 左侧字段 + */ + private String key; + + /** + * 右侧字段 + */ + private String value; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/data/obj/DataObjectQueryParamObj.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/data/obj/DataObjectQueryParamObj.java new file mode 100644 index 0000000..cfa7bec --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/data/obj/DataObjectQueryParamObj.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.template.gen.components.data.obj; + +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.vo.PageVo; +import java.util.List; +import lombok.Data; + +@Data +public class DataObjectQueryParamObj extends PageVo { + + /** + * 条件 + */ + private List conditions; + + @Data + public static class Condition { + /** + * 表别名 + */ + private String tableAlias; + + /** + * 字段名 + */ + private String columnName; + + /** + * 查询类型 + */ + private Integer queryType; + + /** + * 值前缀 + */ + private String valuePrefix; + + /** + * 值 + */ + private Object value; + + /** + * 值集合 + */ + private List values; + + /** + * 值后缀 + */ + private String valueSuffix; + + public String getQueryTypeSql() { + return EnumUtil.getByCode(GenQueryType.class, this.queryType).getOperation(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomAuthorizationInterceptor.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomAuthorizationInterceptor.java new file mode 100644 index 0000000..6f422a8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomAuthorizationInterceptor.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.gen.components.magic; + +import com.lframework.starter.common.utils.ArrayUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.security.CheckPermissionHandler; +import com.lframework.starter.web.components.security.PermissionCalcType; +import com.lframework.xingyun.template.gen.utils.WebUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.ssssssss.magicapi.core.context.MagicUser; +import org.ssssssss.magicapi.core.exception.MagicLoginException; +import org.ssssssss.magicapi.core.interceptor.Authorization; +import org.ssssssss.magicapi.core.interceptor.AuthorizationInterceptor; +import org.ssssssss.magicapi.core.servlet.MagicHttpServletRequest; + +/** + * 自定义用户名密码登录 + */ +@Component //注入到Spring容器中 +public class MagicCustomAuthorizationInterceptor implements AuthorizationInterceptor { + + @Autowired + private CheckPermissionHandler checkPermissionHandler; + + /** + * 配置是否需要登录 + */ + @Override + public boolean requireLogin() { + return false; + } + + /** + * 根据Token获取User + */ + @Override + public MagicUser getUserByToken(String token) throws MagicLoginException { + AbstractUserDetails currentUser = SecurityUtil.getUserByToken(token); + if (currentUser == null) { + throw new MagicLoginException("请重新登录!请求地址:" + WebUtils.getRequestPath()); + } + + return new MagicUser(currentUser.getId(), currentUser.getName(), token); + } + + @Override + public MagicUser login(String username, String password) throws MagicLoginException { + throw new MagicLoginException("不支持手动登录,请先登录主系统!"); + } + + @Override + public boolean allowVisit(MagicUser magicUser, MagicHttpServletRequest request, + Authorization authorization) { + + String[] profiles = ApplicationUtil.getEnv().getActiveProfiles(); + if (ArrayUtil.isNotEmpty(profiles) && ArrayUtil.contains(profiles, "demo")) { + return authorization == Authorization.VIEW; + } + return checkPermissionHandler.valid(PermissionCalcType.OR, "system:online-code:config"); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomJsonValueProvider.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomJsonValueProvider.java new file mode 100644 index 0000000..5842a29 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomJsonValueProvider.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.components.magic; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import java.util.List; +import java.util.Map; +import org.springframework.stereotype.Component; +import org.ssssssss.magicapi.core.context.RequestEntity; +import org.ssssssss.magicapi.core.interceptor.ResultProvider; +import org.ssssssss.magicapi.modules.db.model.Page; + +@Component +public class MagicCustomJsonValueProvider implements ResultProvider { + + /** + * 定义返回结果,默认返回JsonBean + */ + @Override + public Object buildResult(RequestEntity requestEntity, int code, String message, Object data) { + if (code >= 200 && code <= 299) { + return InvokeResultBuilder.success(data); + } else { + throw new DefaultClientException(message); + } + } + + /** + * 定义分页返回结果,该项会被封装在Json结果内, 此方法可以不覆盖,默认返回PageResult + */ + @Override + public Object buildPageResult(RequestEntity requestEntity, Page page, long total, + List> data) { + + return PageResultUtil.newInstance(page.getOffset() / page.getLimit() + 1, page.getLimit(), + total, data); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomMagicFunction.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomMagicFunction.java new file mode 100644 index 0000000..a7333cd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomMagicFunction.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.components.magic; + +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import org.springframework.stereotype.Component; +import org.ssssssss.magicapi.core.config.MagicFunction; +import org.ssssssss.script.annotation.Comment; +import org.ssssssss.script.annotation.Function; + +@Component +public class MagicCustomMagicFunction implements MagicFunction { + + @Function + @Comment("获取登录人ID") + public static AbstractUserDetails current_user() { + AbstractUserDetails user = SecurityUtil.getCurrentUser(); + return user; + } + + @Function + @Comment("获取租户ID") + public static String current_tenant_id() { + return TenantContextHolder.getTenantId() == null ? null + : TenantContextHolder.getTenantId().toString(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomSqlCache.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomSqlCache.java new file mode 100644 index 0000000..0dd1d2b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/components/magic/MagicCustomSqlCache.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.gen.components.magic; + +import com.lframework.starter.web.components.redis.RedisHandler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.ssssssss.magicapi.modules.db.cache.SqlCache; + +@Component +public class MagicCustomSqlCache implements SqlCache { + + @Autowired + private RedisHandler redisHandler; + + @Override + public void put(String name, String key, Object value) { + redisHandler.hset(name, key, value); + } + + @Override + public void put(String name, String key, Object value, long ttl) { + redisHandler.hset(name, key, value, ttl); + } + + @Override + public T get(String name, String key) { + return (T) redisHandler.hget(name, key); + } + + @Override + public void delete(String name) { + redisHandler.hdel(name); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/config/MagicCustomConfiguration.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/config/MagicCustomConfiguration.java new file mode 100644 index 0000000..db4ae72 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/config/MagicCustomConfiguration.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.template.gen.config; + +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.dynamic.datasource.creator.BasicDataSourceCreator; +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.web.config.properties.SecretProperties; +import com.lframework.starter.web.utils.DataSourceUtil; +import com.lframework.starter.web.utils.EncryptUtil; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.xingyun.template.inner.service.TenantService; +import java.util.List; +import java.util.Map; +import javax.sql.DataSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.TaskScheduler; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.ssssssss.magicapi.datasource.model.MagicDynamicDataSource; + +@Configuration +public class MagicCustomConfiguration { + + @Autowired + private DynamicDataSourceProperties dynamicDataSourceProperties; + + @Bean + public TaskScheduler taskScheduler() { + ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); + taskScheduler.setPoolSize(10); + taskScheduler.initialize(); + return taskScheduler; + } + + @Bean + public MagicDynamicDataSource magicDynamicDataSource(DynamicRoutingDataSource dataSource, + TenantService tenantService, BasicDataSourceCreator basicDataSourceCreator, SecretProperties secretProperties) { + Map dataSourceMap = dataSource.getDataSources(); + MagicDynamicDataSource dynamicDataSource = new MagicDynamicDataSource(); + dynamicDataSource.setDefault(dataSourceMap.get("master")); + + DataSourceProperty dataSourceProperty = dynamicDataSourceProperties.getDatasource() + .get("master"); + // 这里只加载启用的租户 + Wrapper queryWrapper = Wrappers.lambdaQuery(Tenant.class) + .eq(Tenant::getAvailable, Boolean.TRUE); + List tenants = tenantService.list(queryWrapper); + + for (Tenant tenant : tenants) { + dynamicDataSource.add(String.valueOf(tenant.getId()), + basicDataSourceCreator.createDataSource( + DataSourceUtil.createDataSourceProperty(dataSourceProperty, tenant.getJdbcUrl(), + tenant.getJdbcUsername(), EncryptUtil.decrypt(tenant.getJdbcPassword(), secretProperties)))); + } + + return dynamicDataSource; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/constants/GenStringPool.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/constants/GenStringPool.java new file mode 100644 index 0000000..fc10d8d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/constants/GenStringPool.java @@ -0,0 +1,5 @@ +package com.lframework.xingyun.template.gen.constants; + +public interface GenStringPool { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenController.java new file mode 100644 index 0000000..46ccd9c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenController.java @@ -0,0 +1,174 @@ +package com.lframework.xingyun.template.gen.controller; + +import cn.hutool.core.convert.Convert; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.gen.builders.CustomListBuilder; +import com.lframework.xingyun.template.gen.builders.CustomPageBuilder; +import com.lframework.xingyun.template.gen.builders.CustomSelectorBuilder; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig; +import com.lframework.xingyun.template.gen.components.custom.page.CustomPageConfig; +import com.lframework.xingyun.template.gen.components.custom.selector.CustomSelectorConfig; +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryObj; +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryParamObj; +import com.lframework.xingyun.template.gen.mappers.GenMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 提供低代码相关功能所需的接口 + */ +@Slf4j +@Api(tags = "低代码接口") +@Validated +@RestController +@RequestMapping("/gen/api") +public class GenController extends DefaultBaseController { + + @Autowired + private CustomListBuilder customListBuilder; + + @Autowired + private CustomSelectorBuilder customSelectorBuilder; + + @Autowired + private GenMapper genMapper; + + @Autowired + private CustomPageBuilder customPageBuilder; + + @ApiOperation("自定义列表配置") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping("/custom/list/config") + public InvokeResult getCustomListConfig( + @NotBlank(message = "ID不能为空!") String id) { + + CustomListConfig config = customListBuilder.buildConfig(id); + + return InvokeResultBuilder.success(config); + } + + @ApiOperation("查询自定义列表数据(分页)") + @PostMapping("/custom/list/query") + public InvokeResult>> customListQueryPage( + @NotBlank(message = "ID不能为空!") String id, + @RequestBody DataObjectQueryParamObj vo) { + + DataObjectQueryObj queryObj = customListBuilder.buildQueryObj(id, vo); + + PageHelperUtil.startPage(vo); + List> datas = genMapper.findList(queryObj); + PageResult> pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + + for (DataObjectQueryObj.QueryField field : queryObj.getFields()) { + for (Map data : datas) { + Object oriValue = data.get(field.getColumnAlias()); + Object newValue = Convert.convert(field.getDataType().getClazz(), + data.get(field.getColumnAlias())); + data.put(field.getColumnAlias(), newValue == null ? oriValue : newValue); + } + } + + return InvokeResultBuilder.success(pageResult); + } + + @ApiOperation("查询自定义列表数据(不分页)") + @PostMapping("/custom/list/query/list") + public InvokeResult>> customListQueryList( + @NotBlank(message = "ID不能为空!") String id, + @RequestBody DataObjectQueryParamObj vo) { + + DataObjectQueryObj queryObj = customListBuilder.buildQueryObj(id, vo); + + List> datas = genMapper.findList(queryObj); + + for (DataObjectQueryObj.QueryField field : queryObj.getFields()) { + for (Map data : datas) { + Object oriValue = data.get(field.getColumnAlias()); + Object newValue = Convert.convert(field.getDataType().getClazz(), + data.get(field.getColumnAlias())); + data.put(field.getColumnAlias(), newValue == null ? oriValue : newValue); + } + } + + return InvokeResultBuilder.success(datas); + } + + @ApiOperation("查询自定义列表数据(树形)") + @PostMapping("/custom/list/query/tree") + public InvokeResult>> customListQueryTree( + @NotBlank(message = "ID不能为空!") String id, + @RequestBody DataObjectQueryParamObj vo) { + + // 查询全量数据 + DataObjectQueryObj queryObj = customListBuilder.buildQueryObj(id, null); + + List> datas = genMapper.findList(queryObj); + + for (DataObjectQueryObj.QueryField field : queryObj.getFields()) { + for (Map data : datas) { + Object oriValue = data.get(field.getColumnAlias()); + Object newValue = Convert.convert(field.getDataType().getClazz(), + data.get(field.getColumnAlias())); + data.put(field.getColumnAlias(), newValue == null ? oriValue : newValue); + } + } + + if (CollectionUtil.isEmpty(datas)) { + return InvokeResultBuilder.success(datas); + } + + DataObjectQueryObj filterQueryObj = customListBuilder.buildQueryObj(id, vo); + List> filterDatas = genMapper.findList(filterQueryObj); + + CustomListConfig config = customListBuilder.buildConfig(id); + String idColumn = config.getListConfig().getIdColumn(); + List ids = filterDatas.stream().map(t -> String.valueOf(t.get(idColumn))).collect( + Collectors.toList()); + datas.stream().filter(t -> ids.contains(String.valueOf(t.get(idColumn)))) + .forEach(t -> t.put("id@show", true)); + + return InvokeResultBuilder.success(datas); + } + + @ApiOperation("自定义选择器配置") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping("/custom/selector/config") + public InvokeResult getCustomSelectorConfig( + @NotBlank(message = "ID不能为空!") String id) { + + CustomSelectorConfig config = customSelectorBuilder.buildConfig(id); + + return InvokeResultBuilder.success(config); + } + + @ApiOperation("获取自定义页面配置") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping("/custom/page/config") + public InvokeResult get(@NotNull(message = "ID不能为空!") Integer id) { + + CustomPageConfig config = customPageBuilder.buildConfig(id); + + return InvokeResultBuilder.success(config); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomListCategoryController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomListCategoryController.java new file mode 100644 index 0000000..1ab5118 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomListCategoryController.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.xingyun.template.gen.service.GenCustomListCategoryService; +import com.lframework.xingyun.template.gen.vo.custom.list.category.CreateGenCustomListCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.list.category.UpdateGenCustomListCategoryVo; +import com.lframework.xingyun.template.gen.bo.custom.list.category.GetGenCustomListCategoryBo; +import com.lframework.xingyun.template.gen.bo.custom.list.category.QueryGenCustomListCategoryBo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 自定义列表分类 + * + * @author zmj + */ +@Api(tags = "自定义列表分类") +@Validated +@RestController +@RequestMapping("/gen/custom/list/category") +public class GenCustomListCategoryController extends DefaultBaseController { + + @Autowired + private GenCustomListCategoryService genCustomListCategoryService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @GetMapping("/query") + public InvokeResult> query() { + List datas = genCustomListCategoryService.queryList(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryGenCustomListCategoryBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + GenCustomListCategory data = genCustomListCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("自定义列表分类不存在!"); + } + + GetGenCustomListCategoryBo result = new GetGenCustomListCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增自定义列表分类 + */ + @ApiOperation("新增自定义列表分类") + @PostMapping + public InvokeResult create(@Valid CreateGenCustomListCategoryVo vo) { + + genCustomListCategoryService.create(vo); + + genCustomListCategoryService.cleanCacheByKey("all"); + + return InvokeResultBuilder.success(); + } + + /** + * 修改自定义列表分类 + */ + @ApiOperation("修改自定义列表分类") + @PutMapping + public InvokeResult update(@Valid UpdateGenCustomListCategoryVo vo) { + + genCustomListCategoryService.update(vo); + + genCustomListCategoryService.cleanCacheByKeys(Arrays.asList("all", vo.getId())); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("删除自定义列表分类") + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genCustomListCategoryService.deleteById(id); + + genCustomListCategoryService.cleanCacheByKeys(Arrays.asList("all", id)); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomListController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomListController.java new file mode 100644 index 0000000..bb0fcb8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomListController.java @@ -0,0 +1,140 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.vo.custom.list.CreateGenCustomListVo; +import com.lframework.xingyun.template.gen.vo.custom.list.QueryGenCustomListVo; +import com.lframework.xingyun.template.gen.vo.custom.list.UpdateGenCustomListVo; +import com.lframework.xingyun.template.gen.bo.custom.list.GetGenCustomListBo; +import com.lframework.xingyun.template.gen.bo.custom.list.QueryGenCustomListBo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "自定义列表") +@Slf4j +@Validated +@RestController +@RequestMapping("/gen/custom/list") +public class GenCustomListController extends DefaultBaseController { + + @Autowired + private GenCustomListService genCustomListService; + + @ApiOperation("查询自定义列表") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryGenCustomListVo vo) { + + PageResult pageResult = genCustomListService.query(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(QueryGenCustomListBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + GenCustomList data = genCustomListService.findById(id); + + return InvokeResultBuilder.success(new GetGenCustomListBo(data)); + } + + @ApiOperation("新增") + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateGenCustomListVo vo) { + + genCustomListService.create(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateGenCustomListVo vo) { + + genCustomListService.update(vo); + + genCustomListService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genCustomListService.delete(id); + + genCustomListService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量删除") + @DeleteMapping("/batch") + public InvokeResult batchDelete( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genCustomListService.batchDelete(ids); + + genCustomListService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量启用") + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genCustomListService.batchEnable(ids); + + genCustomListService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量停用") + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genCustomListService.batchUnable(ids); + + genCustomListService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomPageCategoryController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomPageCategoryController.java new file mode 100644 index 0000000..61aca3c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomPageCategoryController.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.bo.custom.page.category.GetGenCustomPageCategoryBo; +import com.lframework.xingyun.template.gen.bo.custom.page.category.QueryGenCustomPageCategoryBo; +import com.lframework.xingyun.template.gen.service.GenCustomPageCategoryService; +import com.lframework.xingyun.template.gen.vo.custom.page.category.CreateGenCustomPageCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.page.category.UpdateGenCustomPageCategoryVo; +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 自定义页面分类 + * + * @author zmj + */ +@Api(tags = "自定义页面分类") +@Validated +@RestController +@RequestMapping("/gen/custom/page/category") +public class GenCustomPageCategoryController extends DefaultBaseController { + + @Autowired + private GenCustomPageCategoryService genCustomPageCategoryService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @GetMapping("/query") + public InvokeResult> query() { + List datas = genCustomPageCategoryService.queryList(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryGenCustomPageCategoryBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get( + @NotBlank(message = "ID不能为空!") String id) { + + GenCustomPageCategory data = genCustomPageCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("自定义页面分类不存在!"); + } + + GetGenCustomPageCategoryBo result = new GetGenCustomPageCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增自定义页面分类 + */ + @ApiOperation("新增自定义页面分类") + @PostMapping + public InvokeResult create(@Valid CreateGenCustomPageCategoryVo vo) { + + genCustomPageCategoryService.create(vo); + + genCustomPageCategoryService.cleanCacheByKey("all"); + + return InvokeResultBuilder.success(); + } + + /** + * 修改自定义页面分类 + */ + @ApiOperation("修改自定义页面分类") + @PutMapping + public InvokeResult update(@Valid UpdateGenCustomPageCategoryVo vo) { + + genCustomPageCategoryService.update(vo); + + genCustomPageCategoryService.cleanCacheByKeys(Arrays.asList("all", vo.getId())); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("删除自定义页面分类") + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genCustomPageCategoryService.deleteById(id); + + genCustomPageCategoryService.cleanCacheByKeys(Arrays.asList("all", id)); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomPageController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomPageController.java new file mode 100644 index 0000000..db2d087 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomPageController.java @@ -0,0 +1,114 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.bo.custom.page.GetGenCustomPageBo; +import com.lframework.xingyun.template.gen.bo.custom.page.QueryGenCustomPageBo; +import com.lframework.xingyun.template.gen.service.GenCustomPageService; +import com.lframework.xingyun.template.gen.vo.custom.page.CreateGenCustomPageVo; +import com.lframework.xingyun.template.gen.vo.custom.page.QueryGenCustomPageVo; +import com.lframework.xingyun.template.gen.vo.custom.page.UpdateGenCustomPageVo; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "自定义页面") +@Slf4j +@Validated +@RestController +@RequestMapping("/gen/custom/page") +public class GenCustomPageController extends DefaultBaseController { + + @Autowired + private GenCustomPageService genCustomPageService; + + @ApiOperation("查询自定义页面") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryGenCustomPageVo vo) { + + PageResult pageResult = genCustomPageService.query(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(QueryGenCustomPageBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult getConfig(@NotNull(message = "ID不能为空!") Integer id) { + + GenCustomPage data = genCustomPageService.findById(id); + + return InvokeResultBuilder.success(new GetGenCustomPageBo(data)); + } + + @ApiOperation("新增") + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateGenCustomPageVo vo) { + + genCustomPageService.create(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateGenCustomPageVo vo) { + + genCustomPageService.update(vo); + + genCustomPageService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @DeleteMapping + public InvokeResult delete(@NotNull(message = "ID不能为空!") Integer id) { + + genCustomPageService.delete(id); + + genCustomPageService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量删除") + @DeleteMapping("/batch") + public InvokeResult batchDelete( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genCustomPageService.batchDelete(ids); + + genCustomPageService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomSelectorCategoryController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomSelectorCategoryController.java new file mode 100644 index 0000000..5975d1e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomSelectorCategoryController.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorCategoryService; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.CreateGenCustomSelectorCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.UpdateGenCustomSelectorCategoryVo; +import com.lframework.xingyun.template.gen.bo.custom.selector.category.GetGenCustomSelectorCategoryBo; +import com.lframework.xingyun.template.gen.bo.custom.selector.category.QueryGenCustomSelectorCategoryBo; +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 自定义选择器分类 + * + * @author zmj + */ +@Api(tags = "自定义选择器分类") +@Validated +@RestController +@RequestMapping("/gen/custom/selector/category") +public class GenCustomSelectorCategoryController extends DefaultBaseController { + + @Autowired + private GenCustomSelectorCategoryService genCustomSelectorCategoryService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @GetMapping("/query") + public InvokeResult> query() { + List datas = genCustomSelectorCategoryService.queryList(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryGenCustomSelectorCategoryBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get( + @NotBlank(message = "ID不能为空!") String id) { + + GenCustomSelectorCategory data = genCustomSelectorCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("自定义选择器分类不存在!"); + } + + GetGenCustomSelectorCategoryBo result = new GetGenCustomSelectorCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增自定义选择器分类 + */ + @ApiOperation("新增自定义选择器分类") + @PostMapping + public InvokeResult create(@Valid CreateGenCustomSelectorCategoryVo vo) { + + genCustomSelectorCategoryService.create(vo); + + genCustomSelectorCategoryService.cleanCacheByKey("all"); + + return InvokeResultBuilder.success(); + } + + /** + * 修改自定义选择器分类 + */ + @ApiOperation("修改自定义选择器分类") + @PutMapping + public InvokeResult update(@Valid UpdateGenCustomSelectorCategoryVo vo) { + + genCustomSelectorCategoryService.update(vo); + + genCustomSelectorCategoryService.cleanCacheByKeys(Arrays.asList("all", vo.getId())); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("删除自定义选择器分类") + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genCustomSelectorCategoryService.deleteById(id); + + genCustomSelectorCategoryService.cleanCacheByKeys(Arrays.asList("all", id)); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomSelectorController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomSelectorController.java new file mode 100644 index 0000000..88da8f8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenCustomSelectorController.java @@ -0,0 +1,141 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.gen.vo.custom.selector.CreateGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.QueryGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.UpdateGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.bo.custom.selector.GetGenCustomSelectorBo; +import com.lframework.xingyun.template.gen.bo.custom.selector.QueryGenCustomSelectorBo; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "自定义选择器") +@Slf4j +@Validated +@RestController +@RequestMapping("/gen/custom/selector") +public class GenCustomSelectorController extends DefaultBaseController { + + @Autowired + private GenCustomSelectorService genCustomSelectorService; + + @ApiOperation("查询自定义选择器") + @GetMapping("/query") + public InvokeResult> query( + @Valid QueryGenCustomSelectorVo vo) { + + PageResult pageResult = genCustomSelectorService.query(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(QueryGenCustomSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + GenCustomSelector data = genCustomSelectorService.findById(id); + + return InvokeResultBuilder.success(new GetGenCustomSelectorBo(data)); + } + + @ApiOperation("新增") + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateGenCustomSelectorVo vo) { + + genCustomSelectorService.create(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateGenCustomSelectorVo vo) { + + genCustomSelectorService.update(vo); + + genCustomSelectorService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genCustomSelectorService.delete(id); + + genCustomSelectorService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量删除") + @DeleteMapping("/batch") + public InvokeResult batchDelete( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genCustomSelectorService.batchDelete(ids); + + genCustomSelectorService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量启用") + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genCustomSelectorService.batchEnable(ids); + + genCustomSelectorService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量停用") + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genCustomSelectorService.batchUnable(ids); + + genCustomSelectorService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataEntityCategoryController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataEntityCategoryController.java new file mode 100644 index 0000000..263be1f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataEntityCategoryController.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.service.GenDataEntityCategoryService; +import com.lframework.xingyun.template.gen.vo.data.entity.category.CreateGenDataEntityCategoryVo; +import com.lframework.xingyun.template.gen.vo.data.entity.category.UpdateGenDataEntityCategoryVo; +import com.lframework.xingyun.template.gen.bo.data.entity.category.GetGenDataEntityCategoryBo; +import com.lframework.xingyun.template.gen.bo.data.entity.category.QueryGenDataEntityCategoryBo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据实体分类 + * + * @author zmj + */ +@Api(tags = "数据实体分类") +@Validated +@RestController +@RequestMapping("/gen/data/entity/category") +public class GenDataEntityCategoryController extends DefaultBaseController { + + @Autowired + private GenDataEntityCategoryService genDataEntityCategoryService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @GetMapping("/query") + public InvokeResult> query() { + List datas = genDataEntityCategoryService.queryList(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryGenDataEntityCategoryBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + GenDataEntityCategory data = genDataEntityCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("数据实体分类不存在!"); + } + + GetGenDataEntityCategoryBo result = new GetGenDataEntityCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增数据实体分类 + */ + @ApiOperation("新增数据实体分类") + @PostMapping + public InvokeResult create(@Valid CreateGenDataEntityCategoryVo vo) { + + genDataEntityCategoryService.create(vo); + + genDataEntityCategoryService.cleanCacheByKey("all"); + + return InvokeResultBuilder.success(); + } + + /** + * 修改数据实体分类 + */ + @ApiOperation("修改数据实体分类") + @PutMapping + public InvokeResult update(@Valid UpdateGenDataEntityCategoryVo vo) { + + genDataEntityCategoryService.update(vo); + + genDataEntityCategoryService.cleanCacheByKeys(Arrays.asList("all", vo.getId())); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("删除数据实体分类") + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genDataEntityCategoryService.deleteById(id); + + genDataEntityCategoryService.cleanCacheByKeys(Arrays.asList("all", id)); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataEntityController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataEntityController.java new file mode 100644 index 0000000..e4b66ef --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataEntityController.java @@ -0,0 +1,307 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.FileUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.starter.common.utils.ZipUtil; +import com.lframework.xingyun.template.gen.converters.GenStringConverter; +import com.lframework.xingyun.template.gen.converters.GenViewTypeConverter; +import com.lframework.xingyun.template.gen.dto.data.entity.DataEntityGenerateDto; +import com.lframework.xingyun.template.gen.dto.generate.GenerateDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.generate.Generator; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import com.lframework.xingyun.template.gen.service.SimpleTableColumnService; +import com.lframework.xingyun.template.gen.vo.data.entity.CreateDataEntityVo; +import com.lframework.xingyun.template.gen.vo.data.entity.QueryDataEntityVo; +import com.lframework.xingyun.template.gen.vo.data.entity.UpdateDataEntityGenerateVo; +import com.lframework.xingyun.template.gen.vo.data.entity.UpdateDataEntityVo; +import com.lframework.xingyun.template.gen.vo.simpledb.QuerySimpleTableColumnVo; +import com.lframework.xingyun.template.gen.bo.data.entity.DataEntityGenerateBo; +import com.lframework.xingyun.template.gen.bo.data.entity.GenDataEntityDetailBo; +import com.lframework.xingyun.template.gen.bo.data.entity.GetDataEntityBo; +import com.lframework.xingyun.template.gen.bo.data.entity.QueryDataEntityBo; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.xingyun.template.gen.enums.GenConvertType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.ResponseUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.io.File; +import java.nio.charset.StandardCharsets; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "数据实体") +@Slf4j +@Validated +@RestController +@RequestMapping("/gen/data/entity") +public class GenDataEntityController extends DefaultBaseController { + + @Autowired + private GenDataEntityService genDataEntityService; + + @Autowired + private SimpleTableColumnService simpleTableColumnService; + + @Autowired + private GenViewTypeConverter genViewTypeConverter; + + /** + * 上传文件的临时文件目录 + */ + @Value("${spring.servlet.multipart.location}") + private String location; + + @ApiOperation("查询数据对象列表") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryDataEntityVo vo) { + + PageResult pageResult = genDataEntityService.query(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(QueryDataEntityBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + @ApiOperation("查询列信息") + @GetMapping("/query/columns") + public InvokeResult> getColumns(@Valid QuerySimpleTableColumnVo vo) { + List datas = simpleTableColumnService.query(vo); + if (CollectionUtil.isEmpty(datas)) { + throw new DefaultClientException("数据表不存在,请检查!"); + } + List details = datas.stream().map(t -> { + GenDataEntityDetail detail = new GenDataEntityDetail(); + detail.setId(t.getDbColumnName()); + detail.setName(t.getColumnComment()); + detail.setColumnName(GenStringConverter.convertToCamelCase(GenConvertType.UNDERLINE_TO_CAMEL, + t.getDbColumnName())); + detail.setIsKey(t.getIsKey()); + detail.setDataType(t.getDataType()); + detail.setColumnOrder(t.getOrdinalPosition()); + List viewTypes = genViewTypeConverter.convert(t.getDataType()); + if (CollectionUtil.isEmpty(viewTypes)) { + throw new DefaultClientException("字段:" + t.getDbColumnName() + "类型暂不支持!"); + } + detail.setViewType(viewTypes.get(0)); + detail.setFixEnum(Boolean.FALSE); + detail.setIsOrder(Boolean.FALSE); + detail.setLen(t.getLen()); + detail.setDecimals(t.getDecimals()); + + return detail; + }).collect(Collectors.toList()); + + List results = details.stream().map(GenDataEntityDetailBo::new).collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + GenDataEntity data = genDataEntityService.findById(id); + + return InvokeResultBuilder.success(new GetDataEntityBo(data)); + } + + @ApiOperation("新增") + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateDataEntityVo vo) { + + genDataEntityService.create(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateDataEntityVo vo) { + + genDataEntityService.update(vo); + + this.evictRelaCache(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genDataEntityService.delete(id); + + this.evictRelaCache(id); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量删除") + @DeleteMapping("/batch") + public InvokeResult batchDelete( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genDataEntityService.batchDelete(ids); + + for (String id : ids) { + this.evictRelaCache(id); + } + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量启用") + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genDataEntityService.batchEnable(ids); + + for (String id : ids) { + this.evictRelaCache(id); + } + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量停用") + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genDataEntityService.batchUnable(ids); + + for (String id : ids) { + this.evictRelaCache(id); + } + + return InvokeResultBuilder.success(); + } + + @ApiOperation("获取生成代码配置") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping("/generate") + public InvokeResult getGenerate(@NotNull(message = "ID不能为空!") String id) { + + DataEntityGenerateDto data = genDataEntityService.getGenerateById(id); + + DataEntityGenerateBo result = new DataEntityGenerateBo(data); + + return InvokeResultBuilder.success(result); + } + + @ApiOperation("修改生成代码配置") + @PatchMapping("/generate") + public InvokeResult updateGenerate(@Valid @RequestBody UpdateDataEntityGenerateVo vo) { + + genDataEntityService.updateGenerate(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("预览") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping("/preview") + public InvokeResult> preView(@NotNull(message = "ID不能为空!") String id) { + + Generator generator = Generator.getInstance(id); + List datas = generator.generateAll(); + Map result = new LinkedHashMap<>(); + for (GenerateDto data : datas) { + result.put(data.getFileName(), data.getContent()); + } + + return InvokeResultBuilder.success(result); + } + + @ApiOperation("下载") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping("/download") + public void download(@NotNull(message = "ID不能为空!") String id) { + + String fileLocation = location.endsWith(File.separator) ? location : location + File.separator; + String filePath = fileLocation + IdUtil.getUUID() + File.separator; + + Generator generator = Generator.getInstance(id); + + List datas = generator.generateAll(); + for (GenerateDto data : datas) { + + File file = FileUtil.file(filePath + data.getPath() + File.separator + data.getFileName()); + FileUtil.writeString(data.getContent(), file, StandardCharsets.UTF_8); + } + + File zipFile = ZipUtil.zip(filePath, fileLocation + IdUtil.getUUID() + ".zip", false); + + ResponseUtil.download(zipFile); + } + + @ApiOperation("同步数据表") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @PutMapping("/sync/table") + public InvokeResult syncTable(@NotNull(message = "ID不能为空!") String id) { + genDataEntityService.syncTable(id); + + this.evictRelaCache(id); + + return InvokeResultBuilder.success(); + } + + // 失效关联数据的缓存 + private void evictRelaCache(String entityId) { + ThreadUtil.execAsync(() -> { + GenDataObjService genDataObjService = ApplicationUtil.getBean(GenDataObjService.class); + List ids = genDataObjService.getRelaGenDataEntityIds(entityId); + if (CollectionUtil.isNotEmpty(ids)) { + genDataObjService.cleanCacheByKeys(ids); + } + + GenCustomListService genCustomListService = ApplicationUtil.getBean(GenCustomListService.class); + ids = genCustomListService.getRelaGenDataEntityIds(entityId); + if (CollectionUtil.isNotEmpty(ids)) { + genCustomListService.cleanCacheByKeys(ids); + } + }); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataObjCategoryController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataObjCategoryController.java new file mode 100644 index 0000000..7b403f3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataObjCategoryController.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.bo.data.obj.category.GetGenDataObjCategoryBo; +import com.lframework.xingyun.template.gen.bo.data.obj.category.QueryGenDataObjCategoryBo; +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.service.GenDataObjCategoryService; +import com.lframework.xingyun.template.gen.vo.data.obj.category.CreateGenDataObjCategoryVo; +import com.lframework.xingyun.template.gen.vo.data.obj.category.UpdateGenDataObjCategoryVo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据对象分类 + * + * @author zmj + */ +@Api(tags = "数据对象分类") +@Validated +@RestController +@RequestMapping("/gen/data/obj/category") +public class GenDataObjCategoryController extends DefaultBaseController { + + @Autowired + private GenDataObjCategoryService genDataObjCategoryService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @GetMapping("/query") + public InvokeResult> query() { + List datas = genDataObjCategoryService.queryList(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryGenDataObjCategoryBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + GenDataObjCategory data = genDataObjCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("数据对象分类不存在!"); + } + + GetGenDataObjCategoryBo result = new GetGenDataObjCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增数据对象分类 + */ + @ApiOperation("新增数据对象分类") + @PostMapping + public InvokeResult create(@Valid CreateGenDataObjCategoryVo vo) { + + genDataObjCategoryService.create(vo); + + genDataObjCategoryService.cleanCacheByKey("all"); + + return InvokeResultBuilder.success(); + } + + /** + * 修改数据对象分类 + */ + @ApiOperation("修改数据对象分类") + @PutMapping + public InvokeResult update(@Valid UpdateGenDataObjCategoryVo vo) { + + genDataObjCategoryService.update(vo); + + genDataObjCategoryService.cleanCacheByKeys(Arrays.asList("all", vo.getId())); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("删除数据对象分类") + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genDataObjCategoryService.deleteById(id); + + genDataObjCategoryService.cleanCacheByKeys(Arrays.asList("all", id)); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataObjController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataObjController.java new file mode 100644 index 0000000..f24804b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenDataObjController.java @@ -0,0 +1,259 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.bo.data.obj.GenDataObjColumnBo; +import com.lframework.xingyun.template.gen.bo.data.obj.GenDataObjColumnBo.ColumnBo; +import com.lframework.xingyun.template.gen.bo.data.obj.GetGenDataObjBo; +import com.lframework.xingyun.template.gen.bo.data.obj.QueryGenDataObjBo; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjQueryDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import com.lframework.xingyun.template.gen.vo.data.obj.CreateGenDataObjVo; +import com.lframework.xingyun.template.gen.vo.data.obj.QueryGenDataObjVo; +import com.lframework.xingyun.template.gen.vo.data.obj.UpdateGenDataObjVo; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "数据对象") +@Slf4j +@Validated +@RestController +@RequestMapping("/gen/data/obj") +public class GenDataObjController extends DefaultBaseController { + + @Autowired + private GenDataObjService genDataObjService; + + @Autowired + private GenDataObjDetailService genDataObjDetailService; + + @Autowired + private GenDataObjQueryDetailService genDataObjQueryDetailService; + + @Autowired + private GenDataEntityService genDataEntityService; + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @ApiOperation("查询数据对象列表") + @GetMapping("/query") + public InvokeResult> query(@Valid QueryGenDataObjVo vo) { + + PageResult pageResult = genDataObjService.query(getPageIndex(vo), getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(QueryGenDataObjBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + @ApiOperation("查询数据对象列") + @ApiImplicitParam(value = "数据对象ID", name = "id", paramType = "query", required = true) + @GetMapping("/columns") + public InvokeResult> queryColumns( + @NotBlank(message = "ID不能为空!") String id) { + + GenDataObj dataObj = genDataObjService.findById(id); + if (dataObj == null) { + throw new DefaultClientException("数据对象不存在!"); + } + + List dataObjDetails = genDataObjDetailService.getByObjId(dataObj.getId()); + + List dataObjQueryDetails = genDataObjQueryDetailService.getByObjId( + dataObj.getId()); + + List results = new ArrayList<>(); + // 先查主表 + GenDataEntity dataEntity = genDataEntityService.findById(dataObj.getMainTableId()); + if (dataEntity == null) { + throw new DefaultClientException("主表已被删除,请检查!"); + } + + List dataEntityDetails = genDataEntityDetailService.getByEntityId( + dataEntity.getId()); + + GenDataObjColumnBo mainTable = new GenDataObjColumnBo(); + mainTable.setColumns(new ArrayList<>()); + mainTable.setId(dataEntity.getId()); + mainTable.setName("【主表】" + dataEntity.getName()); + for (GenDataEntityDetail dataEntityDetail : dataEntityDetails) { + ColumnBo column = new ColumnBo(); + column.setId(dataEntityDetail.getId()); + column.setRelaId(dataObj.getId()); + column.setName(dataEntityDetail.getName()); + column.setType(GenCustomListDetailType.MAIN_TABLE.getCode()); + column.setDataType(dataEntityDetail.getDataType().getCode()); + column.setViewType(dataEntityDetail.getViewType().getCode()); + mainTable.getColumns().add(column); + } + + results.add(mainTable); + + // 再查子表 + if (!CollectionUtil.isEmpty(dataObjDetails)) { + for (GenDataObjDetail dataObjDetail : dataObjDetails) { + GenDataEntity subDataEntity = genDataEntityService.findById(dataObjDetail.getSubTableId()); + if (subDataEntity == null) { + throw new DefaultClientException("子表已被删除,请检查!"); + } + + List subDataEntityDetails = genDataEntityDetailService.getByEntityId( + subDataEntity.getId()); + + GenDataObjColumnBo subTable = new GenDataObjColumnBo(); + subTable.setColumns(new ArrayList<>()); + subTable.setId(subDataEntity.getId()); + subTable.setName("【子表】" + subDataEntity.getName()); + for (GenDataEntityDetail dataEntityDetail : subDataEntityDetails) { + ColumnBo column = new ColumnBo(); + column.setId(dataEntityDetail.getId()); + column.setRelaId(dataObjDetail.getId()); + column.setName(dataEntityDetail.getName()); + column.setType(GenCustomListDetailType.SUB_TALBE.getCode()); + column.setDataType(dataEntityDetail.getDataType().getCode()); + column.setViewType(dataEntityDetail.getViewType().getCode()); + subTable.getColumns().add(column); + } + + results.add(subTable); + } + } + + // 最后查附加字段 + if (!CollectionUtil.isEmpty(dataObjQueryDetails)) { + GenDataObjColumnBo customQuery = new GenDataObjColumnBo(); + customQuery.setColumns(new ArrayList<>()); + customQuery.setId("customQuery"); + customQuery.setName("自定义查询"); + for (GenDataObjQueryDetail genDataObjDetail : dataObjQueryDetails) { + ColumnBo column = new ColumnBo(); + column.setId(genDataObjDetail.getId()); + column.setRelaId(genDataObjDetail.getId()); + column.setName(genDataObjDetail.getCustomName()); + column.setType(GenCustomListDetailType.CUSTOM.getCode()); + column.setDataType(genDataObjDetail.getDataType().getCode()); + customQuery.getColumns().add(column); + } + + results.add(customQuery); + } + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + GenDataObj data = genDataObjService.findById(id); + + return InvokeResultBuilder.success(new GetGenDataObjBo(data)); + } + + @ApiOperation("新增") + @PostMapping + public InvokeResult create(@RequestBody @Valid CreateGenDataObjVo vo) { + + genDataObjService.create(vo); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("修改") + @PutMapping + public InvokeResult update(@RequestBody @Valid UpdateGenDataObjVo vo) { + + genDataObjService.update(vo); + + genDataObjService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + genDataObjService.delete(id); + + genDataObjService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量删除") + @DeleteMapping("/batch") + public InvokeResult batchDelete( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genDataObjService.batchDelete(ids); + + genDataObjService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量启用") + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genDataObjService.batchEnable(ids); + + genDataObjService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("批量停用") + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "ID", required = true) @RequestBody @NotEmpty(message = "ID不能为空!") List ids) { + + genDataObjService.batchUnable(ids); + + genDataObjService.cleanCacheByKeys(ids); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenSelectorController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenSelectorController.java new file mode 100644 index 0000000..68d7b74 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/controller/GenSelectorController.java @@ -0,0 +1,523 @@ +package com.lframework.xingyun.template.gen.controller; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.gen.bo.custom.list.GenCustomListSelectorBo; +import com.lframework.xingyun.template.gen.bo.custom.list.category.GenCustomListCategorySelectorBo; +import com.lframework.xingyun.template.gen.bo.custom.page.GenCustomPageSelectorBo; +import com.lframework.xingyun.template.gen.bo.custom.page.category.GenCustomPageCategorySelectorBo; +import com.lframework.xingyun.template.gen.bo.custom.selector.GenCustomSelectorSelectorBo; +import com.lframework.xingyun.template.gen.bo.custom.selector.category.GenCustomSelectorCategorySelectorBo; +import com.lframework.xingyun.template.gen.bo.data.entity.GenDataEntityDetailSelectorBo; +import com.lframework.xingyun.template.gen.bo.data.entity.GenDataEntitySelectorBo; +import com.lframework.xingyun.template.gen.bo.data.entity.category.GenDataEntityCategorySelectorBo; +import com.lframework.xingyun.template.gen.bo.data.obj.GenDataObjSelectorBo; +import com.lframework.xingyun.template.gen.bo.data.obj.category.GenDataObjCategorySelectorBo; +import com.lframework.xingyun.template.gen.bo.simpledb.SimpleDBSelectorBo; +import com.lframework.xingyun.template.gen.dto.simpledb.SimpleDBDto; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.service.GenCustomListCategoryService; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.service.GenCustomPageCategoryService; +import com.lframework.xingyun.template.gen.service.GenCustomPageService; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorCategoryService; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.gen.service.GenDataEntityCategoryService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.service.GenDataObjCategoryService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import com.lframework.xingyun.template.gen.service.SimpleDBService; +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.list.category.GenCustomListCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.page.GenCustomPageSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.GenCustomSelectorSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.GenCustomSelectorCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntityDetailSelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntitySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.category.GenDataEntityCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.obj.GenDataObjSelectorVo; +import com.lframework.xingyun.template.gen.vo.data.obj.category.GenDataObjCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.simpledb.SimpleTableSelectorVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.validation.Valid; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "代码生成-选择器") +@Slf4j +@Validated +@RestController +@RequestMapping("/selector/gen") +public class GenSelectorController extends DefaultBaseController { + + @Autowired + private GenDataEntityCategoryService genDataEntityCategoryService; + + @Autowired + private GenDataObjCategoryService genDataObjCategoryService; + + @Autowired + private SimpleDBService simpleDBService; + + @Autowired + private GenDataEntityService genDataEntityService; + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Autowired + private GenDataObjService genDataObjService; + + @Autowired + private GenCustomListCategoryService genCustomListCategoryService; + + @Autowired + private GenCustomListService genCustomListService; + + @Autowired + private GenCustomSelectorCategoryService genCustomSelectorCategoryService; + + @Autowired + private GenCustomSelectorService genCustomSelectorService; + + @Autowired + private GenCustomPageCategoryService genCustomPageCategoryService; + + @Autowired + private GenCustomPageService genCustomPageService; + + @ApiOperation("数据实体分类") + @GetMapping("/data/entity/category") + public InvokeResult> dataEntityCategory( + @Valid GenDataEntityCategorySelectorVo vo) { + + PageResult pageResult = genDataEntityCategoryService.selector( + getPageIndex(vo), getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenDataEntityCategorySelectorBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载数据实体分类 + */ + @ApiOperation("加载数据实体分类") + @PostMapping("/data/entity/category/load") + public InvokeResult> loadDataEntityCategory( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genDataEntityCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenDataEntityCategorySelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("数据对象分类") + @GetMapping("/data/obj/category") + public InvokeResult> dataObjCategory( + @Valid GenDataObjCategorySelectorVo vo) { + + PageResult pageResult = genDataObjCategoryService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenDataObjCategorySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载数据对象分类 + */ + @ApiOperation("加载数据对象分类") + @PostMapping("/data/obj/category/load") + public InvokeResult> loadDataObjCategory( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genDataObjCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenDataObjCategorySelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("数据表") + @GetMapping("/table") + public InvokeResult> table(@Valid SimpleTableSelectorVo vo) { + PageResult pageResult = simpleDBService.selector(getPageIndex(vo), getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SimpleDBSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载数据表 + */ + @ApiOperation("加载数据表") + @PostMapping("/table/load") + public InvokeResult> loadTable( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = simpleDBService.listByIds(ids); + List results = datas.stream().map(SimpleDBSelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("数据实体") + @GetMapping("/data/entity") + public InvokeResult> dataEntity( + @Valid GenDataEntitySelectorVo vo) { + PageResult pageResult = genDataEntityService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenDataEntitySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载数据实体 + */ + @ApiOperation("加载数据实体") + @PostMapping("/data/entity/load") + public InvokeResult> loadDataEntity( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = genDataEntityService.listByIds(ids); + List results = datas.stream().map(GenDataEntitySelectorBo::new) + .collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("数据实体明细") + @GetMapping("/data/entity/detail") + public InvokeResult> dataEntityDetail( + @Valid GenDataEntityDetailSelectorVo vo) { + List datas = genDataEntityDetailService.selector(vo); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenDataEntityDetailSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("数据对象") + @GetMapping("/data/obj") + public InvokeResult> dataObj(@Valid GenDataObjSelectorVo vo) { + PageResult pageResult = genDataObjService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenDataObjSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载数据对象 + */ + @ApiOperation("加载数据对象") + @PostMapping("/data/obj/load") + public InvokeResult> loadDataObj( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genDataObjService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(GenDataObjSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("自定义列表分类") + @GetMapping("/custom/list/category") + public InvokeResult> customListCategory( + @Valid GenCustomListCategorySelectorVo vo) { + PageResult pageResult = genCustomListCategoryService.selector( + getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenCustomListCategorySelectorBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载自定义列表分类 + */ + @ApiOperation("加载自定义列表分类") + @PostMapping("/custom/list/category/load") + public InvokeResult> loadCustomListCategory( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genCustomListCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenCustomListCategorySelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("自定义列表") + @GetMapping("/custom/list") + public InvokeResult> customList( + @Valid GenCustomListSelectorVo vo) { + PageResult pageResult = genCustomListService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenCustomListSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载自定义列表 + */ + @ApiOperation("加载自定义列表") + @PostMapping("/custom/list/load") + public InvokeResult> loadCustomList( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genCustomListService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenCustomListSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("自定义选择器分类") + @GetMapping("/custom/selector/category") + public InvokeResult> customSelectorCategory( + @Valid GenCustomSelectorCategorySelectorVo vo) { + PageResult pageResult = genCustomSelectorCategoryService.selector( + getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenCustomSelectorCategorySelectorBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载自定义选择器分类 + */ + @ApiOperation("加载自定义选择器分类") + @PostMapping("/custom/selector/category/load") + public InvokeResult> loadCustomSelectorCategory( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genCustomSelectorCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenCustomSelectorCategorySelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("自定义选择器") + @GetMapping("/custom/selector") + public InvokeResult> customList( + @Valid GenCustomSelectorSelectorVo vo) { + PageResult pageResult = genCustomSelectorService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenCustomSelectorSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载自定义选择器 + */ + @ApiOperation("加载自定义选择器") + @PostMapping("/custom/selector/load") + public InvokeResult> loadCustomSelector( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genCustomSelectorService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenCustomSelectorSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("自定义页面分类") + @GetMapping("/custom/page/category") + public InvokeResult> customPageCategory() { + List datas = genCustomPageCategoryService.queryList(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenCustomPageCategorySelectorBo::new) + .collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 加载自定义表单分类 + */ + @ApiOperation("加载自定义页面分类") + @PostMapping("/custom/page/category/load") + public InvokeResult> loadCustomPageCategory( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> genCustomPageCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenCustomPageCategorySelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } + + @ApiOperation("自定义页面") + @GetMapping("/custom/page") + public InvokeResult> customPage( + @Valid GenCustomPageSelectorVo vo) { + PageResult pageResult = genCustomPageService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(GenCustomPageSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载自定义表单 + */ + @ApiOperation("加载自定义页面") + @PostMapping("/custom/page/load") + public InvokeResult> loadCustomPage( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(Objects::nonNull) + .map(t -> genCustomPageService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(GenCustomPageSelectorBo::new).collect( + Collectors.toList()); + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenMysqlDataTypeConverter.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenMysqlDataTypeConverter.java new file mode 100644 index 0000000..f513559 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenMysqlDataTypeConverter.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.template.gen.converters; + +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenMySqlDataType; +import org.springframework.stereotype.Component; + +@Component +public class GenMysqlDataTypeConverter { + + public GenMySqlDataType convert(GenDataType dataType) { + + GenMySqlDataType[] mySqlDataTypes = GenMySqlDataType.values(); + for (GenMySqlDataType mySqlDataType : mySqlDataTypes) { + if (mySqlDataType.getDataType() == dataType) { + return mySqlDataType; + } + } + + return null; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenStringConverter.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenStringConverter.java new file mode 100644 index 0000000..efe88b8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenStringConverter.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.template.gen.converters; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.enums.GenConvertType; + +/** + * @author zmj + * @since 2022/8/18 + */ +public class GenStringConverter { + + /** + * 转换 + * + * @param type + * @param oriStr + * @return + */ + public static String convert(GenConvertType type, String oriStr) { + if (StringUtil.isBlank(oriStr)) { + return oriStr; + } + + if (type == GenConvertType.UNDERLINE_TO_CAMEL) { + return StringUtil.toCamelCase(oriStr); + } + + return null; + } + + /** + * 强制转换成驼峰 + * + * @param type + * @param oriStr + * @return + */ + public static String convertToCamelCase(GenConvertType type, String oriStr) { + + if (type == GenConvertType.UNDERLINE_TO_CAMEL) { + return StringUtil.toCamelCase(oriStr); + } + + return null; + } + + /** + * 强制转换成普通小写 即为:不含分割线的小写字符 + * + * @param type + * @param oriStr + * @return + */ + public static String convertToNormalLowerCase(GenConvertType type, String oriStr) { + if (type == GenConvertType.UNDERLINE_TO_CAMEL) { + return StringUtil.toCamelCase(oriStr).toLowerCase(); + } + + return null; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenViewTypeConverter.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenViewTypeConverter.java new file mode 100644 index 0000000..3b1f4d5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/converters/GenViewTypeConverter.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.template.gen.converters; + +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Slf4j +@Component +public class GenViewTypeConverter { + + public boolean canConvert(GenViewType viewType, GenDataType dataType) { + + List viewTypes = convert(dataType); + if (CollectionUtil.isEmpty(viewTypes)) { + return false; + } + + return viewTypes.contains(viewType); + } + + public List convert(GenDataType dataType) { + + if (dataType == null) { + return null; + } + + List results = new ArrayList<>(); + if (dataType == GenDataType.STRING) { + results.addAll(Arrays.asList(GenViewType.values())); + } else if (dataType == GenDataType.INTEGER) { + results.addAll(Arrays.asList(GenViewType.INPUT, GenViewType.SELECT)); + } else if (dataType == GenDataType.SHORT) { + results.addAll(Arrays.asList(GenViewType.INPUT, GenViewType.SELECT)); + } else if (dataType == GenDataType.LONG) { + results.addAll(Arrays.asList(GenViewType.INPUT)); + } else if (dataType == GenDataType.DOUBLE) { + results.addAll(Arrays.asList(GenViewType.INPUT)); + } else if (dataType == GenDataType.LOCAL_DATE) { + results.addAll(Arrays.asList(GenViewType.INPUT, GenViewType.DATE, GenViewType.DATE_RANGE)); + } else if (dataType == GenDataType.LOCAL_DATE_TIME) { + results.addAll( + Arrays.asList(GenViewType.INPUT, GenViewType.DATETIME, GenViewType.DATE_RANGE)); + } else if (dataType == GenDataType.LOCAL_TIME) { + results.addAll(Arrays.asList(GenViewType.INPUT, GenViewType.TIME)); + } else if (dataType == GenDataType.BOOLEAN) { + results.addAll(Arrays.asList(GenViewType.INPUT, GenViewType.SELECT)); + } else if (dataType == GenDataType.BIG_DECIMAL) { + results.addAll(Arrays.asList(GenViewType.INPUT)); + } else { + log.error("未知的GenDataType={}", dataType); + throw new DefaultSysException("未知的GenDataType"); + } + + return results; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/directives/FormatDirective.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/directives/FormatDirective.java new file mode 100644 index 0000000..78d30ca --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/directives/FormatDirective.java @@ -0,0 +1,117 @@ +package com.lframework.xingyun.template.gen.directives; + +import com.lframework.starter.common.utils.CollectionUtil; +import freemarker.core.Environment; +import freemarker.template.TemplateDirectiveBody; +import freemarker.template.TemplateDirectiveModel; +import freemarker.template.TemplateException; +import freemarker.template.TemplateModel; +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class FormatDirective implements TemplateDirectiveModel { + + public static final String DIRECTIVE_NAME = "format"; + + private static final char NEWLINE = '\n'; + + @Override + public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, + TemplateModel[] loopVars, + TemplateDirectiveBody body) throws TemplateException, IOException { + + FormatWriter writer = new FormatWriter(env.getOut(), + env.getCurrentDirectiveCallPlace().getBeginColumn()); + body.render(writer); + + List chars = writer.getWriteChars(); + char[] space = writer.getSpace(); + + if (!CollectionUtil.isEmpty(chars)) { + List checkList = chars.subList(chars.size() - space.length, chars.size()); + if (checkList.stream().allMatch(t -> t == ' ')) { + chars = chars.subList(0, chars.size() - space.length); + } + + char[] newChars = new char[chars.size()]; + for (int i = 0; i < chars.size(); i++) { + newChars[i] = chars.get(i); + } + env.getOut().write(newChars); + } + } + + private static class FormatWriter extends Writer { + + private final Writer out; + + private final char[] space; + private final List writeChars = new ArrayList<>(); + private boolean newLine = true; + + public FormatWriter(Writer out, int column) { + + this.out = out; + this.space = new char[column]; + Arrays.fill(this.space, ' '); + } + + public char[] getSpace() { + + return space; + } + + public List getWriteChars() { + + return writeChars; + } + + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + + List chars = new ArrayList<>(); + for (int i = off; i < len; i++) { + char c = cbuf[i]; + if (newLine) { + for (char s : space) { + chars.add(s); + } + newLine = false; + } + + if (c == NEWLINE) { + newLine = true; + } + + chars.add(c); + + if (newLine) { + for (char s : space) { + chars.add(s); + } + newLine = false; + } + } + + writeChars.addAll(chars); + } + + @Override + public void flush() throws IOException { + + out.flush(); + } + + @Override + public void close() throws IOException { + + out.close(); + } + + } + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/data/entity/DataEntityGenerateDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/data/entity/DataEntityGenerateDto.java new file mode 100644 index 0000000..546c17b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/data/entity/DataEntityGenerateDto.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.template.gen.dto.data.entity; + +import com.lframework.xingyun.template.gen.dto.gen.GenCreateColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenDetailColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import com.lframework.xingyun.template.gen.dto.gen.GenQueryColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenQueryParamsColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenUpdateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class DataEntityGenerateDto implements BaseDto, Serializable { + + /** + * 字段信息 + */ + private List columns; + + /** + * 基本设置 + */ + private GenGenerateInfoDto generateInfo; + + /** + * 新增配置 + */ + private List createConfigs; + + /** + * 修改配置 + */ + private List updateConfigs; + + /** + * 查询配置 + */ + private List queryConfigs; + + /** + * 查询参数配置 + */ + private List queryParamsConfigs; + + /** + * 详情配置 + */ + private List detailConfigs; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/data/entity/GenDataEntityDetailDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/data/entity/GenDataEntityDetailDto.java new file mode 100644 index 0000000..76b22a5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/data/entity/GenDataEntityDetailDto.java @@ -0,0 +1,84 @@ +package com.lframework.xingyun.template.gen.dto.data.entity; + +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenOrderType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenDataEntityDetailDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 字段显示名称 + */ + private String name; + + /** + * 字段名称 + */ + private String columnName; + + /** + * 是否主键 + */ + private Boolean isKey; + + /** + * 数据类型 + */ + private GenDataType dataType; + + /** + * 排序编号 + */ + private Integer columnOrder; + + /** + * 备注 + */ + private String description; + + /** + * 显示类型 + */ + private GenViewType viewType; + + /** + * 是否内置枚举 + */ + private Boolean fixEnum = Boolean.FALSE; + + /** + * 后端枚举名 + */ + private String enumBack; + + /** + * 前端枚举名 + */ + private String enumFront; + + /** + * 正则表达式 + */ + private String regularExpression; + + /** + * 是否排序字段 + */ + private Boolean isOrder = Boolean.FALSE; + + /** + * 排序类型 + */ + private GenOrderType orderType; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenCreateColumnConfigDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenCreateColumnConfigDto.java new file mode 100644 index 0000000..661e151 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenCreateColumnConfigDto.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.dto.gen; + +import com.lframework.xingyun.template.gen.components.CreateColumnConfig; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenCreateColumnConfigDto implements BaseDto, CreateColumnConfig, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 是否必填 + */ + private Boolean required; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenDetailColumnConfigDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenDetailColumnConfigDto.java new file mode 100644 index 0000000..28681ab --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenDetailColumnConfigDto.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.dto.gen; + +import com.lframework.xingyun.template.gen.components.DetailColumnConfig; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenDetailColumnConfigDto implements BaseDto, DetailColumnConfig, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 列宽 + */ + private Integer span; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenGenerateInfoDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenGenerateInfoDto.java new file mode 100644 index 0000000..a513c7a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenGenerateInfoDto.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.template.gen.dto.gen; + +import com.lframework.xingyun.template.gen.enums.GenKeyType; +import com.lframework.xingyun.template.gen.enums.GenTemplateType; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenGenerateInfoDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 生成模板类型 + */ + private GenTemplateType templateType; + + /** + * 包名 + */ + private String packageName; + + /** + * 模块名 + */ + private String moduleName; + + /** + * 业务名 + */ + private String bizName; + + /** + * 类名 + */ + private String className; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 父级菜单ID + */ + private String parentMenuId; + + /** + * 主键类型 + */ + private GenKeyType keyType; + + /** + * 作者 + */ + private String author; + + /** + * 本级菜单编号 + */ + private String menuCode; + + /** + * 本级菜单名称 + */ + private String menuName; + + /** + * 详情页Span总数量 + */ + private Integer detailSpan; + + /** + * 是否应用缓存 + */ + private Boolean isCache; + + /** + * 是否内置删除功能 + */ + private Boolean hasDelete; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenQueryColumnConfigDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenQueryColumnConfigDto.java new file mode 100644 index 0000000..5378571 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenQueryColumnConfigDto.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.dto.gen; + +import com.lframework.xingyun.template.gen.components.QueryColumnConfig; +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenQueryColumnConfigDto implements BaseDto, QueryColumnConfig, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 宽度类型 + */ + private GenQueryWidthType widthType; + + /** + * 宽度 + */ + private Integer width; + + /** + * 是否页面排序 + */ + private Boolean sortable; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenQueryParamsColumnConfigDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenQueryParamsColumnConfigDto.java new file mode 100644 index 0000000..5bc65e3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenQueryParamsColumnConfigDto.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.dto.gen; + +import com.lframework.xingyun.template.gen.components.QueryParamsColumnConfig; +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenQueryParamsColumnConfigDto implements BaseDto, QueryParamsColumnConfig, + Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 查询类型 + */ + private GenQueryType queryType; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenUpdateColumnConfigDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenUpdateColumnConfigDto.java new file mode 100644 index 0000000..68abfa2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/gen/GenUpdateColumnConfigDto.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.dto.gen; + +import com.lframework.xingyun.template.gen.components.UpdateColumnConfig; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenUpdateColumnConfigDto implements BaseDto, UpdateColumnConfig, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 是否必填 + */ + private Boolean required; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/generate/GenerateDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/generate/GenerateDto.java new file mode 100644 index 0000000..be7b3c4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/generate/GenerateDto.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.template.gen.dto.generate; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class GenerateDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 文件路径 + */ + private String path; + + /** + * 文件名 + */ + private String fileName; + + /** + * 文件内容 + */ + private String content; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/OriSimpleTableColumnDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/OriSimpleTableColumnDto.java new file mode 100644 index 0000000..aded388 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/OriSimpleTableColumnDto.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.template.gen.dto.simpledb; + +import com.lframework.xingyun.template.gen.enums.GenMySqlDataType; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class OriSimpleTableColumnDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 表ID + */ + private String tableId; + + /** + * 字段名 + */ + private String columnName; + + /** + * 字段数据类型 + */ + private GenMySqlDataType dataType; + + /** + * 是否允许为空 + */ + private Boolean isNullable; + + /** + * 列主键类型 + */ + private Boolean isKey; + + /** + * 默认值 + */ + private String columnDefault; + + /** + * 字段排序 + */ + private Integer ordinalPosition; + + /** + * 字段类型 + */ + private String columnType; + + /** + * 字段备注 + */ + private String columnComment; + + /** + * 长度 + */ + private Long len; + + /** + * 小数位数 + */ + private Integer decimals; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/OriSimpleTableDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/OriSimpleTableDto.java new file mode 100644 index 0000000..d3ad6d3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/OriSimpleTableDto.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.template.gen.dto.simpledb; + +import com.lframework.xingyun.template.gen.components.Table; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.xingyun.template.gen.enums.GenConvertType; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class OriSimpleTableDto implements BaseDto, Table, Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 数据表所属的数据库名 + */ + private String tableSchema; + + /** + * 数据库表名 + */ + private String tableName; + + /** + * 字段信息 + */ + private List columns; + + /** + * 数据库引擎 + */ + private String engine; + + /** + * 字符校验编码集 + */ + private String tableCollation; + + /** + * 备注 + */ + private String tableComment; + + /** + * 转换方式 + */ + private GenConvertType convertType; + + @Override + public String getSchema() { + + return this.tableSchema; + } + + @Override + public String getComment() { + + return this.tableComment; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/SimpleDBDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/SimpleDBDto.java new file mode 100644 index 0000000..6f27387 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/SimpleDBDto.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.template.gen.dto.simpledb; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SimpleDBDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 库名 + */ + private String tableSchema; + + /** + * 表名 + */ + private String tableName; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/SimpleTableDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/SimpleTableDto.java new file mode 100644 index 0000000..0f1015e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/dto/simpledb/SimpleTableDto.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.template.gen.dto.simpledb; + +import com.lframework.xingyun.template.gen.components.Table; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.xingyun.template.gen.enums.GenConvertType; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class SimpleTableDto implements BaseDto, Table, Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 数据表所属的数据库名 + */ + private String tableSchema; + + /** + * 数据库表名 + */ + private String tableName; + + /** + * 字段信息 + */ + private List columns; + + /** + * 数据库引擎 + */ + private String engine; + + /** + * 字符校验编码集 + */ + private String tableCollation; + + /** + * 备注 + */ + private String tableComment; + + /** + * 转换方式 + */ + private GenConvertType convertType; + + @Override + public String getSchema() { + + return this.tableSchema; + } + + @Override + public String getComment() { + + return this.tableComment; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCreateColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCreateColumnConfig.java new file mode 100644 index 0000000..705b6c6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCreateColumnConfig.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-10 + */ +@Data +@TableName("gen_create_column_config") +public class GenCreateColumnConfig extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 是否必填 + */ + private Boolean required; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomList.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomList.java new file mode 100644 index 0000000..882e3fc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomList.java @@ -0,0 +1,168 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenCustomListType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 自定义列表 + *

+ * + * @author zmj + * @since 2022-09-24 + */ +@Data +@TableName("gen_custom_list") +public class GenCustomList extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "GenCustomList"; + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 数据对象ID + */ + private String dataObjId; + + /** + * 列表类型 + */ + private GenCustomListType listType; + + /** + * 表单Label宽度 + */ + private Integer labelWidth; + + /** + * 是否分页 + */ + private Boolean hasPage; + + /** + * 是否树形列表 + */ + private Boolean treeData; + + /** + * ID字段 + */ + private String idColumn; + + /** + * ID字段关联ID + */ + private String idColumnRelaId; + + /** + * 父级ID字段 + */ + private String treePidColumn; + + /** + * 父级ID字段关联ID + */ + private String treePidColumnRelaId; + + /** + * 树形节点字段 + */ + private String treeNodeColumn; + + /** + * 树形节点字段关联ID + */ + private String treeNodeColumnRelaId; + + /** + * 子节点Key值 + */ + private String treeChildrenKey; + + /** + * 是否允许导出 + */ + private Boolean allowExport; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 查询前置SQL + */ + private String queryPrefixSql; + + /** + * 查询后置SQL + */ + private String querySuffixSql; + + /** + * 后置SQL + */ + private String suffixSql; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListCategory.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListCategory.java new file mode 100644 index 0000000..a2a7bff --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListCategory.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 自定义列表分类 + *

+ * + * @author zmj + */ +@Data +@TableName("gen_custom_list_category") +public class GenCustomListCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenCustomListCategory"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListDetail.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListDetail.java new file mode 100644 index 0000000..0c69d96 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListDetail.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-10 + */ +@Data +@TableName("gen_custom_list_detail") +public class GenCustomListDetail extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 自定义列表ID + */ + private String customListId; + + /** + * 关联ID 当type为主表时,此值为数据对象ID 当type为子表时,此值为数据对象明细ID 当type为自定义查询时,此值为GenDataObjQueryDetail的ID + */ + private String relaId; + + /** + * 数据实体ID + */ + private String dataEntityId; + + /** + * 宽度类型 + */ + private GenQueryWidthType widthType; + + /** + * 宽度 + */ + private Integer width; + + /** + * 是否页面排序 + */ + private Boolean sortable; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 类型 + */ + private GenCustomListDetailType type; + + /** + * 格式化脚本 + */ + private String formatter; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListHandleColumn.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListHandleColumn.java new file mode 100644 index 0000000..89c806f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListHandleColumn.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnType; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnViewType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * 自定义列表操作列 + *

+ * + * @author zmj + * @since 2022-09-24 + */ +@Data +@TableName("gen_custom_list_handle_column") +public class GenCustomListHandleColumn extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenCustomListHandleColumn"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 自定义列表ID + */ + private String customListId; + + /** + * 显示名称 + */ + private String name; + + /** + * 显示类型 + */ + private GenCustomListBtnViewType viewType; + + /** + * 按钮类型 + */ + private GenCustomListBtnType btnType; + + /** + * 按钮配置 + */ + private String btnConfig; + + /** + * 图标 + */ + private String icon; + + /** + * 请求参数 + */ + private String requestParam; + + /** + * 宽度 + */ + private Integer width; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListQueryParams.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListQueryParams.java new file mode 100644 index 0000000..8bc96c6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListQueryParams.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.starter.web.entity.BaseEntity; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-10 + */ +@Data +@TableName("gen_custom_list_query_params") +public class GenCustomListQueryParams extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 自定义列表ID + */ + private String customListId; + + /** + * 关联ID 当type为主表时,此值为数据对象ID 当type为子表时,此值为数据对象明细ID + */ + private String relaId; + + /** + * 数据实体ID + */ + private String dataEntityId; + + /** + * 前端显示 + */ + private Boolean frontShow; + + /** + * 查询类型 + */ + private GenQueryType queryType; + + /** + * 表单宽度 + */ + private Integer formWidth; + + /** + * 默认值 + */ + private String defaultValue; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 类型 + */ + private GenCustomListDetailType type; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListToolbar.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListToolbar.java new file mode 100644 index 0000000..78b406d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomListToolbar.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnType; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnViewType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * 自定义列表工具栏 + *

+ * + * @author zmj + * @since 2022-09-24 + */ +@Data +@TableName("gen_custom_list_toolbar") +public class GenCustomListToolbar extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenCustomListToolbar"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 自定义列表ID + */ + private String customListId; + + /** + * 显示名称 + */ + private String name; + + /** + * 显示类型 + */ + private GenCustomListBtnViewType viewType; + + /** + * 按钮类型 + */ + private GenCustomListBtnType btnType; + + /** + * 按钮配置 + */ + private String btnConfig; + + /** + * 图标 + */ + private String icon; + + /** + * 请求参数 + */ + private String requestParam; + + /** + * 排序编号 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomPage.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomPage.java new file mode 100644 index 0000000..ed50a3f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomPage.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +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.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 自定义页面 + *

+ * + * @author zmj + * @since 2023-06-20 + */ +@Data +@TableName("gen_custom_page") +public class GenCustomPage extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenCustomPage"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 页面代码 + */ + private String pageCode; + + /** + * 脚本代码 + */ + private String scriptCode; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomPageCategory.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomPageCategory.java new file mode 100644 index 0000000..f3c35bb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomPageCategory.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 自定义页面分类 + *

+ * + * @author zmj + */ +@Data +@TableName("gen_custom_page_category") +public class GenCustomPageCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenCustomPageCategory"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 父级ID + */ + private String parentId; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomSelector.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomSelector.java new file mode 100644 index 0000000..35b2976 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomSelector.java @@ -0,0 +1,126 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 自定义选择器 + *

+ * + * @author zmj + * @since 2022-09-24 + */ +@Data +@TableName("gen_custom_selector") +public class GenCustomSelector extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenCustomSelector"; + + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 自定义列表ID + */ + private String customListId; + + /** + * 对话框标题 + */ + private String dialogTittle; + + /** + * 对话框宽度 + */ + private String dialogWidth; + + /** + * 占位符 + */ + private String placeholder; + + /** + * ID字段 + */ + private String idColumn; + + /** + * ID字段关联ID + */ + private String idColumnRelaId; + + /** + * 名称字段 + */ + private String nameColumn; + + /** + * 名称字段关联ID + */ + private String nameColumnRelaId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomSelectorCategory.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomSelectorCategory.java new file mode 100644 index 0000000..c29f3d4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenCustomSelectorCategory.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 自定义选择器分类 + *

+ * + * @author zmj + */ +@Data +@TableName("gen_custom_selector_category") +public class GenCustomSelectorCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenCustomSelectorCategory"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntity.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntity.java new file mode 100644 index 0000000..702989e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntity.java @@ -0,0 +1,135 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.components.Table; +import com.lframework.xingyun.template.gen.enums.GenConvertType; +import com.lframework.xingyun.template.gen.enums.GenStatus; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 数据实体 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +@Data +@TableName("gen_data_entity") +public class GenDataEntity extends BaseEntity implements BaseDto, Table { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "GenDataEntity"; + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 生成状态 + */ + private GenStatus genStatus; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 数据表所属的数据库名 + */ + private String tableSchema; + + /** + * 数据库表名 + */ + private String tableName; + + /** + * 数据库引擎 + */ + private String engine; + + /** + * 字符校验编码集 + */ + private String tableCollation; + + /** + * 备注 + */ + private String tableComment; + + /** + * 转换方式 + */ + private GenConvertType convertType; + + @Override + public String getSchema() { + return this.tableSchema; + } + + @Override + public String getComment() { + return this.tableComment; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntityCategory.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntityCategory.java new file mode 100644 index 0000000..bce1d58 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntityCategory.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 数据实体分类 + *

+ * + * @author zmj + */ +@Data +@TableName("gen_data_entity_category") +public class GenDataEntityCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenDataEntityCategory"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntityDetail.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntityDetail.java new file mode 100644 index 0000000..2276e03 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataEntityDetail.java @@ -0,0 +1,160 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.components.TableColumn; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenOrderType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * 数据实体明细 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +@Data +@TableName("gen_data_entity_detail") +public class GenDataEntityDetail extends BaseEntity implements BaseDto, TableColumn { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 数据对象ID + */ + private String entityId; + + /** + * 字段显示名称 + */ + private String name; + + /** + * 字段名称 + */ + private String columnName; + + /** + * 是否主键 + */ + private Boolean isKey; + + /** + * 数据类型 + */ + private GenDataType dataType; + + /** + * 排序编号 + */ + private Integer columnOrder; + + /** + * 备注 + */ + private String description; + + /** + * 显示类型 + */ + private GenViewType viewType; + + /** + * 是否内置枚举 + */ + private Boolean fixEnum; + + /** + * 后端枚举名 + */ + private String enumBack; + + /** + * 前端枚举名 + */ + private String enumFront; + + /** + * 正则表达式 + */ + private String regularExpression; + + /** + * 是否排序字段 + */ + private Boolean isOrder; + + /** + * 排序类型 + */ + private GenOrderType orderType; + + /** + * 数据字典ID + */ + private String dataDicId; + + /** + * 自定义选择器ID + */ + private String customSelectorId; + + /** + * 长度 + */ + private Long len; + + /** + * 小数位数 + */ + private Integer decimals; + + /** + * 字段名称 + */ + private String dbColumnName; + + /** + * 字段数据类型 + */ + private GenDataType dbDataType; + + /** + * 是否允许为空 + */ + private Boolean isNullable; + + /** + * 默认值 + */ + private String columnDefault; + + /** + * 字段排序 + */ + private Integer ordinalPosition; + + /** + * 字段备注 + */ + private String columnComment; + + /** + * 长度 + */ + private Long dbLen; + + /** + * 小数位数 + */ + private Integer dbDecimals; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObj.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObj.java new file mode 100644 index 0000000..1655d88 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObj.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 数据对象 + *

+ * + * @author zmj + * @since 2022-09-24 + */ +@Data +@TableName("gen_data_obj") +public class GenDataObj extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "GenDataObj"; + + /** + * ID + */ + private String id; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 主表ID + */ + private String mainTableId; + + /** + * 主表别名 + */ + private String mainTableAlias; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjCategory.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjCategory.java new file mode 100644 index 0000000..8efe884 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjCategory.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 数据对象分类 + *

+ * + * @author zmj + */ +@Data +@TableName("gen_data_obj_category") +public class GenDataObjCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "GenDataObjCategory"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjDetail.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjDetail.java new file mode 100644 index 0000000..4110ee1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjDetail.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenRelaMode; +import com.lframework.xingyun.template.gen.enums.GenRelaType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * 数据对象明细 + *

+ * + * @author zmj + * @since 2022-09-24 + */ +@Data +@TableName("gen_data_obj_detail") +public class GenDataObjDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "GenDataObjDetail"; + + /** + * ID + */ + private String id; + + /** + * 数据对象ID + */ + private String dataObjId; + + /** + * 主表字段 + */ + private String mainTableDetailIds; + + /** + * 关联类型 + */ + private GenRelaType relaType; + + /** + * 关联方式 + */ + private GenRelaMode relaMode; + + /** + * 子表ID + */ + private String subTableId; + + /** + * 子表别名 + */ + private String subTableAlias; + + /** + * 主表字段 + */ + private String subTableDetailIds; + + /** + * 排序 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjQueryDetail.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjQueryDetail.java new file mode 100644 index 0000000..0e4e46b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDataObjQueryDetail.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * 数据对象自定义查询明细 + *

+ * + * @author zmj + * @since 2022-09-24 + */ +@Data +@TableName("gen_data_obj_query_detail") +public class GenDataObjQueryDetail extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "GenDataObjQueryDetail"; + + /** + * ID + */ + private String id; + + /** + * 数据对象ID + */ + private String dataObjId; + + /** + * 显示名称 + */ + private String customName; + + /** + * 自定义SQL + */ + private String customSql; + + /** + * 别名 + */ + private String customAlias; + + /** + * 数据类型 + */ + private GenDataType dataType; + + /** + * 排序 + */ + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDetailColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDetailColumnConfig.java new file mode 100644 index 0000000..260a8a9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenDetailColumnConfig.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-10 + */ +@Data +@TableName("gen_detail_column_config") +public class GenDetailColumnConfig extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 列宽 + */ + private Integer span; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenGenerateInfo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenGenerateInfo.java new file mode 100644 index 0000000..c9ec41c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenGenerateInfo.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenKeyType; +import com.lframework.xingyun.template.gen.enums.GenTemplateType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-08 + */ +@Data +@TableName("gen_generate_info") +public class GenGenerateInfo extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 生成模板类型 + */ + private GenTemplateType templateType; + + /** + * 包名 + */ + private String packageName; + + /** + * 模块名 + */ + private String moduleName; + + /** + * 业务名 + */ + private String bizName; + + /** + * 类名 + */ + private String className; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 父级菜单ID + */ + private String parentMenuId; + + /** + * 主键类型 + */ + private GenKeyType keyType; + + /** + * 作者 + */ + private String author; + + /** + * 本级菜单编号 + */ + private String menuCode; + + /** + * 本级菜单名称 + */ + private String menuName; + + /** + * 详情页Span总数量 + */ + private Integer detailSpan; + + /** + * 是否应用缓存 + */ + private Boolean isCache; + + /** + * 是否内置删除功能 + */ + private Boolean hasDelete; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenQueryColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenQueryColumnConfig.java new file mode 100644 index 0000000..1395f7c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenQueryColumnConfig.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-10 + */ +@Data +@TableName("gen_query_column_config") +public class GenQueryColumnConfig extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 宽度类型 + */ + private GenQueryWidthType widthType; + + /** + * 宽度 + */ + private Integer width; + + /** + * 是否页面排序 + */ + private Boolean sortable; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenQueryParamsColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenQueryParamsColumnConfig.java new file mode 100644 index 0000000..eb9cc76 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenQueryParamsColumnConfig.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-10 + */ +@Data +@TableName("gen_query_params_column_config") +public class GenQueryParamsColumnConfig extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 查询类型 + */ + private GenQueryType queryType; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenSimpleTable.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenSimpleTable.java new file mode 100644 index 0000000..f278819 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenSimpleTable.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.enums.GenConvertType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-05-28 + */ +@Data +@TableName("gen_simple_table") +public class GenSimpleTable extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 数据表所属的数据库名 + */ + private String tableSchema; + + /** + * 数据库表名 + */ + private String tableName; + + /** + * 数据库引擎 + */ + private String engine; + + /** + * 字符校验编码集 + */ + private String tableCollation; + + /** + * 备注 + */ + private String tableComment; + + /** + * 转换方式 + */ + private GenConvertType convertType; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenSimpleTableColumn.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenSimpleTableColumn.java new file mode 100644 index 0000000..65731b4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenSimpleTableColumn.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.xingyun.template.gen.components.TableColumn; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-05-28 + */ +@Data +@TableName("gen_simple_table_column") +public class GenSimpleTableColumn extends BaseEntity implements BaseDto, TableColumn { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 表ID + */ + private String tableId; + + /** + * 字段名 + */ + private String columnName; + + /** + * 字段数据类型 + */ + private GenDataType dataType; + + /** + * 是否允许为空 + */ + private Boolean isNullable; + + /** + * 是否主键 + */ + private Boolean isKey; + + /** + * 默认值 + */ + private String columnDefault; + + /** + * 字段排序 + */ + private Integer ordinalPosition; + + /** + * 字段备注 + */ + private String columnComment; + + /** + * 长度 + */ + private Long len; + + /** + * 小数位数 + */ + private Integer decimals; + + @Override + public String getDbColumnName() { + return this.columnName; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenUpdateColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenUpdateColumnConfig.java new file mode 100644 index 0000000..e9a3d6f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenUpdateColumnConfig.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-12-10 + */ +@Data +@TableName("gen_update_column_config") +public class GenUpdateColumnConfig extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 是否必填 + */ + private Boolean required; + + /** + * 排序编号 + */ + private Integer orderNo; + + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenerateColumnConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenerateColumnConfig.java new file mode 100644 index 0000000..0f808f3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenerateColumnConfig.java @@ -0,0 +1,5 @@ +package com.lframework.xingyun.template.gen.entity; + +public class GenerateColumnConfig { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenerateConfig.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenerateConfig.java new file mode 100644 index 0000000..bc73389 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/entity/GenerateConfig.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.template.gen.entity; + +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + * 代码生成信息 + */ +@Data +public class GenerateConfig extends BaseEntity implements BaseDto { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenConvertType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenConvertType.java new file mode 100644 index 0000000..c14385c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenConvertType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenConvertType implements BaseEnum { + UNDERLINE_TO_CAMEL(1, "下划线转驼峰"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenConvertType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListBtnType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListBtnType.java new file mode 100644 index 0000000..d9de35d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListBtnType.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenCustomListBtnType implements BaseEnum { + + EXTERNAL(0, "外部链接"), + ROUTE(1, "路由跳转"), + EXCUTE_SCRIPT(3, "自定义表单"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenCustomListBtnType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListBtnViewType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListBtnViewType.java new file mode 100644 index 0000000..6bc8a84 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListBtnViewType.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenCustomListBtnViewType implements BaseEnum { + + PRIMARY("primary", "primary"), + DEFAULT("default", "default"), + DASHED("dashed", "dashed"), + DANGER("danger", "danger"), + LINK("link", "link"), + LINK_DANGER("link-danger", "link-danger"); + + @EnumValue + private final String code; + + private final String desc; + + GenCustomListBtnViewType(String code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public String getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListDetailType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListDetailType.java new file mode 100644 index 0000000..7fc4a6c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListDetailType.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenCustomListDetailType implements BaseEnum { + MAIN_TABLE(1, "主表"), + SUB_TALBE(2, "子表"), + CUSTOM(3, "自定义查询"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenCustomListDetailType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListType.java new file mode 100644 index 0000000..d1962e6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenCustomListType.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenCustomListType implements BaseEnum { + SEQ(0, "序列"), + SINGLE(1, "单选"), + MULTIPLE(2, "多选"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenCustomListType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenDataType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenDataType.java new file mode 100644 index 0000000..ec3fa81 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenDataType.java @@ -0,0 +1,86 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public enum GenDataType implements BaseEnum { + + STRING(0, String.class, "String", "string"), INTEGER(1, Integer.class, "Integer", + "number"), SHORT(2, Short.class, "Short", "number"), LONG(3, Long.class, "Long", "number"), DOUBLE(4, + Double.class, "Double", "number"), LOCAL_DATE(5, LocalDate.class, "LocalDate", "string"), LOCAL_DATE_TIME(6, + LocalDateTime.class, "LocalDateTime", "string"), LOCAL_TIME(7, + LocalTime.class, "LocalTime", "string"), BOOLEAN(8, Boolean.class, "Boolean", "boolean"), BIG_DECIMAL(9, + BigDecimal.class, "BigDecimal", "number"), + ; + + @EnumValue + private final Integer code; + + private final Class clazz; + + private final String desc; + + private final String frontDesc; + + GenDataType(Integer code, Class clazz, String desc, String frontDesc) { + + this.code = code; + this.clazz = clazz; + this.desc = desc; + this.frontDesc = frontDesc; + } + + /** + * 是否是数字类型 + * + * @param type + * @return + */ + public static Boolean isNumberType(GenDataType type) { + + if (type == null) { + return false; + } + + return type == INTEGER || type == SHORT || type == LONG || type == DOUBLE + || type == BIG_DECIMAL; + } + + /** + * 是否是小数类型 + * + * @param type + * @return + */ + public static Boolean isDecimalType(GenDataType type) { + if (type == null) { + return false; + } + + return type == DOUBLE || type == BIG_DECIMAL; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } + + public Class getClazz() { + return clazz; + } + + public String getFrontDesc() { + return frontDesc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenKeyType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenKeyType.java new file mode 100644 index 0000000..68c8de4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenKeyType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenKeyType implements BaseEnum { + AUTO(0, "自增ID"), UUID(1, "UUID"), SNOW_FLAKE(2, "雪花算法ID"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenKeyType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenMySqlDataType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenMySqlDataType.java new file mode 100644 index 0000000..da1e85c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenMySqlDataType.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +/** + * MySql列类型枚举 dataType为null时表示该类型暂不支持 + */ +public enum GenMySqlDataType implements BaseEnum { + TINYINT("tinyint", GenDataType.INTEGER, "tinyint"), SMALLINT("smallint", GenDataType.INTEGER, + "smallint"), MEDIUMINT("mediumint", GenDataType.INTEGER, "mediumint"), INT("int", + GenDataType.INTEGER, + "int"), INTEGER("integer", GenDataType.INTEGER, "integer"), BIGINT("bigint", GenDataType.LONG, + "bigint"), BIT("bit", GenDataType.BOOLEAN, "bit"), REAL("real", GenDataType.DOUBLE, + "real"), DOUBLE( + "double", GenDataType.BIG_DECIMAL, "double"), FLOAT("float", GenDataType.BIG_DECIMAL, + "float"), DECIMAL( + "decimal", GenDataType.BIG_DECIMAL, "decimal"), NUMERIC("numeric", GenDataType.BIG_DECIMAL, + "numeric"), CHAR("char", GenDataType.STRING, "char"), VARCHAR("varchar", GenDataType.STRING, + "varchar"), DATE("date", GenDataType.LOCAL_DATE, "date"), TIME("time", GenDataType.LOCAL_TIME, + "time"), YEAR("year", null, "year"), TIMESTAMP("timestamp", GenDataType.LOCAL_DATE_TIME, + "timestamp"), DATETIME("datetime", GenDataType.LOCAL_DATE_TIME, "datetime"), TINYBLOB( + "tinyblob", null, + "tinyblob"), BLOB("blob", null, "blob"), MEDIUMBLOB("mediumblob", null, + "mediumblob"), LONGBLOB("longblob", + null, "longblob"), TINYTEXT("tinytext", GenDataType.STRING, "tinytext"), MEDIUMTEXT( + "mediumtext", + GenDataType.STRING, "mediumtext"), TEXT("text", GenDataType.STRING, "text"), LONGTEXT( + "longtext", + GenDataType.STRING, "longtext"), ENUM("enum", GenDataType.STRING, "enum"), SET("set", + GenDataType.STRING, + "set"), BINARY("binary", null, "binary"), VARBINARY("varbinary", null, "varbinary"), POINT( + "point", null, + "point"), LINESTRING("linestring", null, "linestring"), POLYGON("polygon", null, + "polygon"), GEOMETRY( + "geometry", null, "geometry"), MULTIPOINT("multipoint", null, "multipoint"), MULTILINESTRING( + "multilinestring", null, "multilinestring"), MULTIPOLYGON("multipolygon", null, + "multipolygon"), GEOMETRYCOLLECTION("geometrycollection", null, "geometrycollection"), JSON( + "json", null, + "json"); + + @EnumValue + private final String code; + + private final GenDataType dataType; + + private final String desc; + + GenMySqlDataType(String code, GenDataType dataType, String desc) { + + this.code = code; + this.dataType = dataType; + this.desc = desc; + } + + @Override + public String getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } + + public GenDataType getDataType() { + + return dataType; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenOrderType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenOrderType.java new file mode 100644 index 0000000..e49afe2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenOrderType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenOrderType implements BaseEnum { + ASC("ASC", "升序"), DESC("DESC", "降序"); + + @EnumValue + private final String code; + + private final String desc; + + GenOrderType(String code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public String getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenQueryType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenQueryType.java new file mode 100644 index 0000000..893ba4d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenQueryType.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenQueryType implements BaseEnum { + EQ(0, "=", "="), GT(1, ">", ">"), GE(2, ">=", ">="), LT(3, "<", "<"), LE(4, "<=", "<="), NE(5, "!=", "!="), IN(6, "IN", "IN"), NOT_IN(7, + "NOT IN", "NOT IN"), LEFT_LIKE(8, "LIKE", "LIKE %?"), RIGHT_LIKE(9, "LIKE", "LIKE ?%"), AROUND_LIKE(10, "LIKE", "LIKE %?%"); + + @EnumValue + private final Integer code; + + private final String operation; + + private final String desc; + + GenQueryType(Integer code, String operation, String desc) { + + this.code = code; + this.operation = operation; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } + + public String getOperation() { + return operation; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenQueryWidthType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenQueryWidthType.java new file mode 100644 index 0000000..78d86a5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenQueryWidthType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenQueryWidthType implements BaseEnum { + FIX(0, "固定宽度"), MIN(1, "最小宽度"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenQueryWidthType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenRelaMode.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenRelaMode.java new file mode 100644 index 0000000..9b5374e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenRelaMode.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenRelaMode implements BaseEnum { + LEFT_JOIN(0, "LEFT", "左连接"), + RIGHT_JOIN(1, "RIGHT", "右连接"), + INNER_JOIN(2, "INNER", "全连接"); + + @EnumValue + private final Integer code; + + private final String sql; + + private final String desc; + + GenRelaMode(Integer code, String sql, String desc) { + this.code = code; + this.sql = sql; + this.desc = desc; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getDesc() { + return this.desc; + } + + public String getSql() { + return sql; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenRelaType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenRelaType.java new file mode 100644 index 0000000..2ab7a79 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenRelaType.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenRelaType implements BaseEnum { + ONE_RELA_ONE(0, "一对一"), + ONE_RELA_MANY(1, "一对多"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenRelaType(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getDesc() { + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenStatus.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenStatus.java new file mode 100644 index 0000000..a5cad86 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenStatus.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenStatus implements BaseEnum { + CREATED(0, "已生成"), SET_TABLE(1, "已设置数据表"), SET_GEN(2, "已设置生成配置"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenStatus(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenTemplateType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenTemplateType.java new file mode 100644 index 0000000..bf0584d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenTemplateType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenTemplateType implements BaseEnum { + LIST(1, "列表"), TREE(2, "树形表"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenTemplateType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenType.java new file mode 100644 index 0000000..3798efd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenType.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenType implements BaseEnum { + SIMPLE_DB(1, "数据库单表"); + + @EnumValue + private final Integer code; + + private final String desc; + + GenType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenViewType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenViewType.java new file mode 100644 index 0000000..a9fdefc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/enums/GenViewType.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum GenViewType implements BaseEnum { + INPUT(0, "输入框"), TEXTATREA(1, "文本域"), DATETIME(2, "日期时间选择器"), DATE(3, "日期选择器"), TIME(4, + "时间选择器"), SELECT(5, + "选择器"), DATE_RANGE(6, "日期范围选择器"), DATA_DIC(7, "数据字典"), CUSTOM_SELECTOR(8, "自定义选择器"); + + @EnumValue + private final Integer code; + + + private final String desc; + + GenViewType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/CustomListDeleteEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/CustomListDeleteEvent.java new file mode 100644 index 0000000..e5f7f66 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/CustomListDeleteEvent.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.template.gen.events; + +import org.springframework.context.ApplicationEvent; + +public class CustomListDeleteEvent extends ApplicationEvent { + + /** + * 自定义列表ID + */ + private String id; + + /** + * 自定义列表名称 + */ + private String name; + + public CustomListDeleteEvent(Object source) { + super(source); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataEntityDeleteEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataEntityDeleteEvent.java new file mode 100644 index 0000000..0225e3c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataEntityDeleteEvent.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.template.gen.events; + +import java.util.List; +import org.springframework.context.ApplicationEvent; + +public class DataEntityDeleteEvent extends ApplicationEvent { + + /** + * 数据实体ID + */ + private String id; + + /** + * 数据实体名称 + */ + private String name; + + private List columnIds; + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public DataEntityDeleteEvent(Object source) { + + super(source); + } + + public String getId() { + + return id; + } + + public void setId(String id) { + + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getColumnIds() { + + return columnIds; + } + + public void setColumnIds(List columnIds) { + + this.columnIds = columnIds; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataEntityDetailDeleteEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataEntityDetailDeleteEvent.java new file mode 100644 index 0000000..7225e1a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataEntityDetailDeleteEvent.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.template.gen.events; + +import org.springframework.context.ApplicationEvent; + +public class DataEntityDetailDeleteEvent extends ApplicationEvent { + + /** + * 数据实体明细ID + */ + private String id; + + /** + * 显示名称 + */ + private String name; + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public DataEntityDetailDeleteEvent(Object source) { + + super(source); + } + + public String getId() { + + return id; + } + + public void setId(String id) { + + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataObjDeleteEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataObjDeleteEvent.java new file mode 100644 index 0000000..a6b3ce6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataObjDeleteEvent.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.gen.events; + +import java.util.List; +import org.springframework.context.ApplicationEvent; + +public class DataObjDeleteEvent extends ApplicationEvent { + + /** + * 数据对象ID + */ + private String id; + + /** + * 数据对象名称 + */ + private String name; + + private List detailIds; + + private List queryDetailIds; + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public DataObjDeleteEvent(Object source) { + super(source); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getDetailIds() { + return detailIds; + } + + public void setDetailIds(List detailIds) { + this.detailIds = detailIds; + } + + public List getQueryDetailIds() { + return queryDetailIds; + } + + public void setQueryDetailIds(List queryDetailIds) { + this.queryDetailIds = queryDetailIds; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataObjQueryDetailDeleteEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataObjQueryDetailDeleteEvent.java new file mode 100644 index 0000000..81be25c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/events/DataObjQueryDetailDeleteEvent.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.template.gen.events; + +import org.springframework.context.ApplicationEvent; + +public class DataObjQueryDetailDeleteEvent extends ApplicationEvent { + + /** + * 数据对象明细ID + */ + private String id; + + /** + * 显示名称 + */ + private String name; + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public DataObjQueryDetailDeleteEvent(Object source) { + + super(source); + } + + public String getId() { + + return id; + } + + public void setId(String id) { + + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/Generator.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/Generator.java new file mode 100644 index 0000000..34dfb3d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/Generator.java @@ -0,0 +1,1658 @@ +package com.lframework.xingyun.template.gen.generate; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.IsNumberPrecision; +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.constants.MyBatisStringPool; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.JsonUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.gen.builders.DataEntityBuilder; +import com.lframework.xingyun.template.gen.components.DataEntity; +import com.lframework.xingyun.template.gen.components.DataEntityColumn; +import com.lframework.xingyun.template.gen.directives.FormatDirective; +import com.lframework.xingyun.template.gen.dto.generate.GenerateDto; +import com.lframework.xingyun.template.gen.enums.GenConvertType; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenKeyType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import com.lframework.xingyun.template.gen.generate.templates.ControllerTemplate; +import com.lframework.xingyun.template.gen.generate.templates.CreateTemplate; +import com.lframework.xingyun.template.gen.generate.templates.DetailTemplate; +import com.lframework.xingyun.template.gen.generate.templates.EntityTemplate; +import com.lframework.xingyun.template.gen.generate.templates.MapperTemplate; +import com.lframework.xingyun.template.gen.generate.templates.QueryParamsTemplate; +import com.lframework.xingyun.template.gen.generate.templates.QueryTemplate; +import com.lframework.xingyun.template.gen.generate.templates.ServiceTemplate; +import com.lframework.xingyun.template.gen.generate.templates.SqlTemplate; +import com.lframework.xingyun.template.gen.generate.templates.UpdateTemplate; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.service.system.SysDataDicItemService; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import freemarker.ext.beans.BeansWrapper; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import freemarker.template.TemplateHashModel; +import freemarker.template.TemplateModelException; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.io.StringWriter; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.validator.constraints.Length; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.DeleteMapping; + +@Slf4j +public class Generator { + + private DataEntity dataEntity; + + private Generator() { + + } + + public static Generator getInstance(String entityId) { + + DataEntityBuilder builder = ApplicationUtil.getBean(DataEntityBuilder.class); + Generator generator = new Generator(); + + generator.setDataEntity(builder.build(entityId)); + + return generator; + } + + private void setDataEntity(DataEntity dataEntity) { + + this.dataEntity = dataEntity; + } + + public List generateAll() { + + List results = new ArrayList<>(); + // Java代码 + GenerateDto entityJava = this.generateEntity(); + GenerateDto mapperJava = this.generateMapper(); + GenerateDto mapperXml = this.generateListMapperXml(); + GenerateDto queryVoJava = this.generateQueryVo(); + GenerateDto createVoJava = this.generateCreateVo(); + GenerateDto updateVoJava = this.generateUpdateVo(); + GenerateDto serviceJava = this.generateService(); + GenerateDto serviceImplJava = this.generateServiceImpl(); + GenerateDto queryBoJava = this.generateQueryBo(); + GenerateDto getBoJava = this.generateGetBo(); + GenerateDto controllerJava = this.generateController(); + + results.add(entityJava); + if (queryVoJava != null) { + results.add(queryVoJava); + } + results.add(mapperJava); + results.add(mapperXml); + if (createVoJava != null) { + results.add(createVoJava); + } + if (updateVoJava != null) { + results.add(updateVoJava); + } + results.add(serviceJava); + results.add(serviceImplJava); + if (queryBoJava != null) { + results.add(queryBoJava); + } + if (getBoJava != null) { + results.add(getBoJava); + } + results.add(controllerJava); + + // Vue代码 + GenerateDto apiJs = this.generateApiJs(); + GenerateDto indexVue = this.generateIndexVue(); + GenerateDto addVue = this.generateAddVue(); + GenerateDto modifyVue = this.generateModifyVue(); + GenerateDto detailVue = this.generateDetailVue(); + GenerateDto createVoVue = this.generateCreateVoVue(); + GenerateDto queryVoVue = this.generateQueryVoVue(); + GenerateDto updateVoVue = this.generateUpdateVoVue(); + GenerateDto queryBoVue = this.generateQueryBoVue(); + GenerateDto getBoVue = this.generateGetBoVue(); + + results.add(apiJs); + results.add(indexVue); + if (addVue != null) { + results.add(addVue); + } + if (modifyVue != null) { + results.add(modifyVue); + } + if (detailVue != null) { + results.add(detailVue); + } + if (createVoVue != null) { + results.add(createVoVue); + } + if (queryVoVue != null) { + results.add(queryVoVue); + } + if (updateVoVue != null) { + results.add(updateVoVue); + } + if (queryBoVue != null) { + results.add(queryBoVue); + } + if (getBoVue != null) { + results.add(getBoVue); + } + + // sql + GenerateDto sql = this.generateSql(); + results.add(sql); + + return results; + } + + /** + * 生成Entity.java代码 + * + * @return + */ + public GenerateDto generateEntity() { + + EntityTemplate template = this.getEntityTemplate(); + + String content = this.generate("entity.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "entity", template.getClassName() + ".java", content); + } + + /** + * 生成Mapper.java代码 + * + * @return + */ + public GenerateDto generateMapper() { + + MapperTemplate template = this.getMapperTemplate(); + + String content = this.generate("mapper.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "mappers", template.getClassName() + "Mapper.java", content); + } + + /** + * 生成Mapper.xml代码 + * + * @return + */ + public GenerateDto generateListMapperXml() { + + MapperTemplate template = this.getMapperTemplate(); + + String content = this.generate("mapper.list.xml.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "resources" + + File.separator + "mappers" + File.separator + template.getModuleName(), + template.getClassName() + "Mapper.xml", content); + } + + /** + * 生成QueryVo.java代码 + * + * @return + */ + public GenerateDto generateQueryVo() { + + QueryParamsTemplate template = this.getQueryParamsTemplate(); + if (template == null) { + return null; + } + + String content = this.generate("queryvo.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "vo" + + File.separator + template.getModuleName() + File.separator + template.getBizName(), + "Query" + template.getClassName() + "Vo.java", content); + } + + /** + * 生成Service.java代码 + * + * @return + */ + public GenerateDto generateService() { + + ServiceTemplate template = this.getServiceTemplate(); + + String content = this.generate("service.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "service" + File.separator + template.getModuleName(), + template.getClassName() + "Service.java", content); + } + + /** + * 生成ServiceImpl.java代码 + * + * @return + */ + public GenerateDto generateServiceImpl() { + + ServiceTemplate template = this.getServiceTemplate(); + + String content = this.generate("serviceimpl.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "impl" + + File.separator + template.getModuleName(), + template.getClassName() + "ServiceImpl.java", + content); + } + + /** + * 生成CreateVo.java代码 + * + * @return + */ + public GenerateDto generateCreateVo() { + + CreateTemplate template = this.getCreateTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("createvo.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "vo" + + File.separator + template.getModuleName() + File.separator + template.getBizName(), + "Create" + template.getClassName() + "Vo.java", content); + } + + /** + * 生成UpdateVo.java代码 + * + * @return + */ + public GenerateDto generateUpdateVo() { + + UpdateTemplate template = this.getUpdateTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("updatevo.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "vo" + + File.separator + template.getModuleName() + File.separator + template.getBizName(), + "Update" + template.getClassName() + "Vo.java", content); + } + + /** + * 生成QueryBo.java代码 + * + * @return + */ + public GenerateDto generateQueryBo() { + + QueryTemplate template = this.getQueryTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("querybo.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "bo" + + File.separator + template.getModuleName() + File.separator + template.getBizName(), + "Query" + template.getClassName() + "Bo.java", content); + } + + /** + * 生成GetBo.java代码 + * + * @return + */ + public GenerateDto generateGetBo() { + + DetailTemplate template = this.getDetailTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("getbo.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "bo" + + File.separator + template.getModuleName() + File.separator + template.getBizName(), + "Get" + template.getClassName() + "Bo.java", content); + } + + /** + * 生成Controller.java代码 + * + * @return + */ + public GenerateDto generateController() { + + ControllerTemplate template = this.getControllerTemplate(); + + String content = this.generate("controller.java.ftl", template); + + return this.buildGenerateResult( + "java" + File.separator + "src" + File.separator + "main" + File.separator + "java" + + File.separator + + template.getPackageName().replaceAll("\\.", "\\" + File.separator) + File.separator + + "controller" + File.separator + template.getModuleName(), + template.getClassName() + "Controller.java", content); + } + + /** + * 生成api.js代码 + * + * @return + */ + public GenerateDto generateApiJs() { + + ControllerTemplate template = this.getControllerTemplate(); + + String content = this.generate("api.ts.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "api" + File.separator + + template.getModuleName() + File.separator + template.getBizName(), "index.ts", + content); + } + + /** + * 生成index.vue代码 + * + * @return + */ + public GenerateDto generateIndexVue() { + + ControllerTemplate template = this.getControllerTemplate(); + String content = this.generate("index.vue.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "views" + File.separator + + template.getModuleName() + + File.separator + template.getBizName(), "index.vue", content); + } + + /** + * add.vue代码 + * + * @return + */ + public GenerateDto generateAddVue() { + + CreateTemplate template = this.getCreateTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("add.vue.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "views" + File.separator + + template.getModuleName() + + File.separator + template.getBizName(), "add.vue", content); + } + + /** + * modify.vue代码 + * + * @return + */ + public GenerateDto generateModifyVue() { + + UpdateTemplate template = this.getUpdateTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("modify.vue.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "views" + File.separator + + template.getModuleName() + + File.separator + template.getBizName(), "modify.vue", content); + } + + /** + * detail.vue代码 + * + * @return + */ + public GenerateDto generateDetailVue() { + + DetailTemplate template = this.getDetailTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("detail.vue.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "views" + File.separator + + template.getModuleName() + + File.separator + template.getBizName(), "detail.vue", content); + } + + /** + * detail.vue代码 + * + * @return + */ + public GenerateDto generateSql() { + + SqlTemplate template = this.getSqlTemplate(); + + String content = this.generate("sql.ftl", template); + + return this.buildGenerateResult(StringPool.EMPTY_STR, "sql.sql", content); + } + + /** + * 获取freeMarker Template + * + * @param templateName + * @return + */ + private Template getTemplate(String templateName) { + + Configuration cfg = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); + cfg.setClassForTemplateLoading(Generator.class, "/templates"); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setSharedVariable(FormatDirective.DIRECTIVE_NAME, new FormatDirective()); + try { + return cfg.getTemplate(templateName); + } catch (IOException e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } + } + + /** + * Entity.java模板数据 + * + * @return + */ + private EntityTemplate getEntityTemplate() { + + EntityTemplate entityTemplate = new EntityTemplate(); + entityTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + entityTemplate.setTableName(dataEntity.getTable().getTableName()); + entityTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + entityTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + entityTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + entityTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + entityTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + + Set importPackages = new HashSet<>(); + importPackages.add(BaseEntity.class.getName()); + importPackages.add(BaseDto.class.getName()); + List columns = new ArrayList<>(); + for (DataEntityColumn column : dataEntity.getColumns()) { + EntityTemplate.Column columnObj = new EntityTemplate.Column(); + columnObj.setIsKey(column.getIsKey()); + if (columnObj.getIsKey()) { + // 如果是主键,判断是否是自增主键 + columnObj.setAutoIncrKey(dataEntity.getGenerateInfo().getKeyType() == GenKeyType.AUTO); + if (columnObj.getAutoIncrKey()) { + importPackages.add(TableId.class.getName()); + importPackages.add(IdType.class.getName()); + } + } + if (column.getFixEnum()) { + // 如果是枚举类型 + columnObj.setDataType( + column.getEnumBack().substring(column.getEnumBack().lastIndexOf(".") + 1)); + columnObj.setFrontType(column.getEnumFront()); + importPackages.add(column.getEnumBack()); + } else { + columnObj.setDataType(column.getDataType().getDesc()); + } + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + columnObj.setName(column.getColumnName()); + // MybatisPlus默认命名规则是下划线转驼峰,所以如果不是这个规则的话,需要单独指定TableField和TableId + columnObj.setColumnName(column.getTableColumn().getDbColumnName()); + columnObj.setDefaultConvertType( + dataEntity.getTable().getConvertType() == GenConvertType.UNDERLINE_TO_CAMEL); + if (!columnObj.getDefaultConvertType()) { + importPackages.add(TableId.class.getName()); + importPackages.add(TableField.class.getName()); + } + columnObj.setDescription(column.getName()); + if (!columnObj.getIsKey()) { + // 如果不是主键,需要判断是否需要字段填充 + if (MyBatisStringPool.COLUMN_CREATE_BY.equals(columnObj.getName()) + || MyBatisStringPool.COLUMN_CREATE_BY_ID.equals(columnObj.getName()) + || MyBatisStringPool.COLUMN_CREATE_TIME.equals(columnObj.getName())) { + columnObj.setFill(Boolean.TRUE); + columnObj.setFillStrategy(FieldFill.INSERT.name()); + importPackages.add(TableField.class.getName()); + importPackages.add(FieldFill.class.getName()); + } else if (MyBatisStringPool.COLUMN_UPDATE_BY.equals(columnObj.getName()) + || MyBatisStringPool.COLUMN_UPDATE_BY_ID.equals(columnObj.getName()) + || MyBatisStringPool.COLUMN_UPDATE_TIME.equals(columnObj.getName())) { + columnObj.setFill(Boolean.TRUE); + columnObj.setFillStrategy(FieldFill.INSERT_UPDATE.name()); + importPackages.add(TableField.class.getName()); + importPackages.add(FieldFill.class.getName()); + } + } + + columns.add(columnObj); + } + entityTemplate.setColumns(columns); + + entityTemplate.setImportPackages(importPackages); + + return entityTemplate; + } + + /** + * 生成CreateVo.ts代码 + * + * @return + */ + public GenerateDto generateCreateVoVue() { + + CreateTemplate template = this.getCreateTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("createvo.ts.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "api" + File.separator + + template.getModuleName() + File.separator + template.getBizName() + File.separator + + "model", "create" + template.getClassName() + "Vo.ts", + content); + } + + /** + * 生成QueryVo.ts代码 + * + * @return + */ + public GenerateDto generateQueryVoVue() { + + QueryParamsTemplate template = this.getQueryParamsTemplate(); + if (template == null) { + return null; + } + + String content = this.generate("queryvo.ts.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "api" + File.separator + + template.getModuleName() + File.separator + template.getBizName() + File.separator + + "model", "query" + template.getClassName() + "Vo.ts", + content); + } + + /** + * 生成UpdateVo.ts代码 + * + * @return + */ + public GenerateDto generateUpdateVoVue() { + + UpdateTemplate template = this.getUpdateTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("updatevo.ts.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "api" + File.separator + + template.getModuleName() + File.separator + template.getBizName() + File.separator + + "model", "update" + template.getClassName() + "Vo.ts", + content); + } + + /** + * 生成QueryBo.ts代码 + * + * @return + */ + public GenerateDto generateQueryBoVue() { + + QueryTemplate template = this.getQueryTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("querybo.ts.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "api" + File.separator + + template.getModuleName() + File.separator + template.getBizName() + File.separator + + "model", "query" + template.getClassName() + "Bo.ts", + content); + } + + /** + * 生成GetBo.ts代码 + * + * @return + */ + public GenerateDto generateGetBoVue() { + + DetailTemplate template = this.getDetailTemplate(); + + if (template == null) { + return null; + } + + String content = this.generate("getbo.ts.ftl", template); + + return this.buildGenerateResult( + "vue" + File.separator + "src" + File.separator + "api" + File.separator + + template.getModuleName() + File.separator + template.getBizName() + File.separator + + "model", "get" + template.getClassName() + "Bo.ts", + content); + } + + /** + * Mapper.java模板数据 + * + * @return + */ + private MapperTemplate getMapperTemplate() { + + MapperTemplate mapperTemplate = new MapperTemplate(); + mapperTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + mapperTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + mapperTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + mapperTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + mapperTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + mapperTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + Set importPackages = new HashSet<>(); + importPackages.add(BaseMapper.class.getName()); + List keys = new ArrayList<>(); + for (DataEntityColumn column : dataEntity.getColumns()) { + if (column.getIsKey()) { + MapperTemplate.Key key = new MapperTemplate.Key(); + // 主键不允许是枚举,所以直接取desc + key.setDataType(column.getDataType().getDesc()); + key.setName(column.getColumnName()); + key.setColumnName(column.getTableColumn().getDbColumnName()); + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + keys.add(key); + } + } + + mapperTemplate.setKeys(keys); + List orderColumns = new ArrayList<>(); + for (DataEntityColumn column : dataEntity.getColumns()) { + if (!column.getIsOrder()) { + continue; + } + MapperTemplate.OrderColumn orderColumn = new MapperTemplate.OrderColumn(); + orderColumn.setColumnName(column.getTableColumn().getDbColumnName()); + orderColumn.setOrderType(column.getOrderType().getCode()); + orderColumns.add(orderColumn); + } + mapperTemplate.setOrderColumns(orderColumns); + mapperTemplate.setEntity(this.getEntityTemplate()); + mapperTemplate.setImportPackages(importPackages); + mapperTemplate.setQueryParams(this.getQueryParamsTemplate()); + if (mapperTemplate.getQueryParams() != null) { + mapperTemplate.getImportPackages() + .addAll(mapperTemplate.getQueryParams().getImportPackages()); + } + + return mapperTemplate; + } + + private ServiceTemplate getServiceTemplate() { + + ServiceTemplate serviceTemplate = new ServiceTemplate(); + serviceTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + serviceTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + serviceTemplate.setClassNameProperty( + dataEntity.getGenerateInfo().getClassName().substring(0, 1).toLowerCase() + + dataEntity.getGenerateInfo() + .getClassName().substring(1)); + serviceTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + serviceTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + serviceTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + serviceTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + serviceTemplate.setIsCache(dataEntity.getGenerateInfo().getIsCache()); + serviceTemplate.setHasDelete(dataEntity.getGenerateInfo().getHasDelete()); + Set importPackages = new HashSet<>(); + importPackages.add(PageResult.class.getName()); + importPackages.add(BaseMpService.class.getName()); + importPackages.add(StringUtil.class.getName()); + importPackages.add(BaseMpServiceImpl.class.getName()); + importPackages.add(DefaultClientException.class.getName()); + importPackages.add(Assert.class.getName()); + importPackages.add(ObjectUtil.class.getName()); + importPackages.add(OpLog.class.getName()); + importPackages.add(DefaultOpLogType.class.getName()); + importPackages.add(OpLogUtil.class.getName()); + importPackages.add(PageHelperUtil.class.getName()); + importPackages.add(PageResultUtil.class.getName()); + importPackages.add(EnumUtil.class.getName()); + if (serviceTemplate.getHasDelete()) { + importPackages.add(Transactional.class.getName()); + } + List keys = new ArrayList<>(); + for (DataEntityColumn column : dataEntity.getColumns()) { + if (column.getIsKey()) { + ServiceTemplate.Key key = new ServiceTemplate.Key(); + // 主键不允许是枚举,所以直接取desc + key.setDataType(column.getDataType().getDesc()); + key.setName(column.getColumnName()); + key.setNameProperty( + column.getColumnName().substring(0, 1).toUpperCase() + column.getColumnName() + .substring(1)); + key.setColumnName(column.getTableColumn().getDbColumnName()); + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + keys.add(key); + } + } + + serviceTemplate.setKeys(keys); + serviceTemplate.setImportPackages(importPackages); + serviceTemplate.setQueryParams(this.getQueryParamsTemplate()); + serviceTemplate.setCreate(this.getCreateTemplate()); + serviceTemplate.setUpdate(this.getUpdateTemplate()); + if (serviceTemplate.getIsCache()) { + importPackages.add(Serializable.class.getName()); + } + if (serviceTemplate.getQueryParams() != null) { + serviceTemplate.getImportPackages() + .addAll(serviceTemplate.getQueryParams().getImportPackages()); + } + if (serviceTemplate.getCreate() != null) { + serviceTemplate.getImportPackages().addAll(serviceTemplate.getCreate().getImportPackages()); + } + if (serviceTemplate.getUpdate() != null) { + serviceTemplate.getImportPackages().addAll(serviceTemplate.getUpdate().getImportPackages()); + } + + return serviceTemplate; + } + + private QueryParamsTemplate getQueryParamsTemplate() { + + List targetColumns = dataEntity.getColumns().stream() + .filter(t -> t.getQueryParamsConfig() != null) + .sorted(Comparator.comparing(t -> t.getQueryParamsConfig().getOrderNo())) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(targetColumns)) { + return null; + } + QueryParamsTemplate queryParamsTemplate = new QueryParamsTemplate(); + queryParamsTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + queryParamsTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + queryParamsTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + queryParamsTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + queryParamsTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + queryParamsTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + Set importPackages = new HashSet<>(); + importPackages.add(BaseVo.class.getName()); + importPackages.add(PageVo.class.getName()); + importPackages.add(TypeMismatch.class.getName()); + importPackages.add(ApiModelProperty.class.getName()); + List columns = new ArrayList<>(); + for (DataEntityColumn column : targetColumns) { + QueryParamsTemplate.Column columnObj = new QueryParamsTemplate.Column(); + if (column.getFixEnum()) { + // 如果是枚举类型 + columnObj.setDataType( + column.getEnumBack().substring(column.getEnumBack().lastIndexOf(".") + 1)); + columnObj.setFrontType(column.getEnumFront()); + columnObj.setFrontDataType("number"); + columnObj.setViewType(column.getViewType().getCode()); + columnObj.setEnumCodeType(column.getDataType().getDesc()); + importPackages.add(column.getEnumBack()); + importPackages.add(IsEnum.class.getName()); + } else { + columnObj.setDataType(column.getDataType().getDesc()); + columnObj.setFrontDataType(column.getDataType().getFrontDesc()); + columnObj.setViewType(column.getViewType().getCode()); + } + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + columnObj.setName(column.getColumnName()); + columnObj.setColumnName(column.getTableColumn().getDbColumnName()); + columnObj.setQueryType(column.getQueryParamsConfig().getQueryType().getCode()); + columnObj.setNameProperty( + column.getColumnName().substring(0, 1).toUpperCase() + column.getColumnName() + .substring(1)); + columnObj.setDescription(column.getName()); + columnObj.setHasAvailableTag( + column.getViewType() == GenViewType.SELECT && column.getDataType() == GenDataType.BOOLEAN + && "available".equals(column.getColumnName())); + columnObj.setFixEnum(column.getFixEnum()); + if (!StringUtil.isBlank(column.getRegularExpression())) { + columnObj.setRegularExpression(column.getRegularExpression()); + importPackages.add(Pattern.class.getName()); + } + if (column.getViewType() == GenViewType.DATA_DIC) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dic = sysDataDicService.findById(column.getDataDicId()); + columnObj.setDataDicCode(dic.getCode()); + } else if (column.getViewType() == GenViewType.CUSTOM_SELECTOR) { + columnObj.setCustomSelectorId(column.getCustomSelectorId()); + } + + columns.add(columnObj); + } + queryParamsTemplate.setColumns(columns); + queryParamsTemplate.setImportPackages(importPackages); + + return queryParamsTemplate; + } + + private CreateTemplate getCreateTemplate() { + + List targetColumns = dataEntity.getColumns().stream() + .filter(t -> t.getCreateConfig() != null) + .sorted(Comparator.comparing(t -> t.getCreateConfig().getOrderNo())) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(targetColumns)) { + return null; + } + Set importPackages = new HashSet<>(); + importPackages.add(ApiModelProperty.class.getName()); + CreateTemplate createTemplate = new CreateTemplate(); + createTemplate.setAppointId(dataEntity.getGenerateInfo().getKeyType() != GenKeyType.AUTO); + if (dataEntity.getGenerateInfo().getKeyType() == GenKeyType.UUID) { + // 如果是UUID,则引入IdUtil包 + importPackages.add(IdUtil.class.getName()); + createTemplate.setIdCode(IdUtil.class.getSimpleName() + ".getUUID()"); + } else if (dataEntity.getGenerateInfo().getKeyType() == GenKeyType.SNOW_FLAKE) { + // 如果是雪花算法,则引入IdWorker包 + importPackages.add(IdUtil.class.getName()); + createTemplate.setIdCode(IdUtil.class.getSimpleName() + ".getId()"); + } + createTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + createTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + createTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + createTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + createTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + createTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + importPackages.add(TypeMismatch.class.getName()); + importPackages.add(BaseVo.class.getName()); + + List columns = new ArrayList<>(); + for (DataEntityColumn column : targetColumns) { + CreateTemplate.Column columnObj = new CreateTemplate.Column(); + columnObj.setIsKey(column.getIsKey()); + columnObj.setRequired(column.getCreateConfig().getRequired()); + if (column.getFixEnum()) { + // 如果是枚举类型 + columnObj.setDataType( + column.getEnumBack().substring(column.getEnumBack().lastIndexOf(".") + 1)); + columnObj.setFrontType(column.getEnumFront()); + columnObj.setFrontDataType("number"); + columnObj.setViewType(column.getViewType().getCode()); + importPackages.add(column.getEnumBack()); + importPackages.add(EnumUtil.class.getName()); + } else { + columnObj.setDataType(column.getDataType().getDesc()); + columnObj.setViewType(column.getViewType().getCode()); + columnObj.setFrontDataType(column.getDataType().getFrontDesc()); + } + if (column.getViewType() == GenViewType.DATE_RANGE) { + if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + columnObj.setViewType(GenViewType.DATETIME.getCode()); + } else { + columnObj.setViewType(GenViewType.DATE.getCode()); + } + } + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + columnObj.setFixEnum(column.getFixEnum()); + if (columnObj.getFixEnum()) { + columnObj.setEnumCodeType(column.getDataType().getDesc()); + } + if (columnObj.getRequired()) { + // 如果必填,那么需要引Validation注解包 + if (column.getDataType() == GenDataType.STRING) { + // 如果是String,则引@NotBlank注解 + columnObj.setValidateAnno(NotBlank.class.getSimpleName()); + importPackages.add(NotBlank.class.getName()); + } else { + // 否则引@NotNull注解 + columnObj.setValidateAnno(NotNull.class.getSimpleName()); + importPackages.add(NotNull.class.getName()); + } + + if (column.getViewType() == GenViewType.SELECT + || column.getViewType() == GenViewType.DATA_DIC) { + columnObj.setValidateMsg("请选择"); + } else { + columnObj.setValidateMsg("请输入"); + } + + if (columnObj.getFixEnum()) { + // 如果是内置枚举,那么引IsEnum注解包 + importPackages.add(IsEnum.class.getName()); + } + } + columnObj.setName(column.getColumnName()); + columnObj.setColumnName(column.getTableColumn().getDbColumnName()); + columnObj.setNameProperty( + column.getColumnName().substring(0, 1).toUpperCase() + column.getColumnName() + .substring(1)); + columnObj.setDescription(column.getName()); + columnObj.setHasAvailableTag( + column.getViewType() == GenViewType.SELECT && column.getDataType() == GenDataType.BOOLEAN + && "available".equals(column.getColumnName())); + if (!StringUtil.isBlank(column.getRegularExpression())) { + columnObj.setRegularExpression(column.getRegularExpression()); + importPackages.add(Pattern.class.getName()); + } + + columnObj.setIsNumberType(GenDataType.isNumberType(column.getDataType())); + columnObj.setIsDecimalType(GenDataType.isDecimalType(column.getDataType())); + if (column.getViewType() == GenViewType.DATA_DIC) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dic = sysDataDicService.findById(column.getDataDicId()); + columnObj.setDataDicCode(dic.getCode()); + } else if (column.getViewType() == GenViewType.CUSTOM_SELECTOR) { + columnObj.setCustomSelectorId(column.getCustomSelectorId()); + } + columnObj.setLen(column.getLen()); + columnObj.setDecimals(column.getDecimals()); + if (columnObj.getIsNumberType()) { + if (columnObj.getIsDecimalType()) { + importPackages.add(IsNumberPrecision.class.getName()); + } + } else if (column.getDataType() == GenDataType.STRING) { + if (column.getViewType() == GenViewType.INPUT + || column.getViewType() == GenViewType.TEXTATREA) { + importPackages.add(Length.class.getName()); + } + } + columns.add(columnObj); + } + + createTemplate.setColumns(columns); + createTemplate.setImportPackages(importPackages); + List keyColumns = dataEntity.getColumns().stream() + .filter(DataEntityColumn::getIsKey) + .collect(Collectors.toList()); + List keys = keyColumns.stream().map(t -> { + CreateTemplate.Key key = new CreateTemplate.Key(); + // 主键不会是枚举 + key.setDataType(t.getDataType().getDesc()); + key.setName(t.getColumnName()); + key.setNameProperty( + t.getColumnName().substring(0, 1).toUpperCase() + t.getColumnName().substring(1)); + key.setColumnName(t.getTableColumn().getDbColumnName()); + key.setDescription(t.getName()); + + return key; + }).collect(Collectors.toList()); + + createTemplate.setKeys(keys); + + return createTemplate; + } + + private UpdateTemplate getUpdateTemplate() { + + List targetColumns = dataEntity.getColumns().stream() + .filter(t -> t.getUpdateConfig() != null) + .sorted(Comparator.comparing(t -> t.getUpdateConfig().getOrderNo())) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(targetColumns)) { + return null; + } + Set importPackages = new HashSet<>(); + UpdateTemplate updateTemplate = new UpdateTemplate(); + updateTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + updateTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + updateTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + updateTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + updateTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + updateTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + importPackages.add(TypeMismatch.class.getName()); + importPackages.add(ApiModelProperty.class.getName()); + importPackages.add(BaseVo.class.getName()); + + List columns = new ArrayList<>(); + for (DataEntityColumn column : targetColumns) { + UpdateTemplate.Column columnObj = new UpdateTemplate.Column(); + columnObj.setIsKey(column.getIsKey()); + columnObj.setRequired(column.getUpdateConfig().getRequired()); + if (column.getFixEnum()) { + // 如果是枚举类型 + columnObj.setDataType( + column.getEnumBack().substring(column.getEnumBack().lastIndexOf(".") + 1)); + columnObj.setFrontType(column.getEnumFront()); + columnObj.setViewType(column.getViewType().getCode()); + columnObj.setFrontDataType("number"); + importPackages.add(column.getEnumBack()); + importPackages.add(EnumUtil.class.getName()); + } else { + columnObj.setDataType(column.getDataType().getDesc()); + columnObj.setFrontDataType(column.getDataType().getFrontDesc()); + columnObj.setViewType(column.getViewType().getCode()); + } + if (column.getViewType() == GenViewType.DATE_RANGE) { + if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + columnObj.setViewType(GenViewType.DATETIME.getCode()); + } else { + columnObj.setViewType(GenViewType.DATE.getCode()); + } + } + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + columnObj.setFixEnum(column.getFixEnum()); + if (columnObj.getFixEnum()) { + columnObj.setEnumCodeType(column.getDataType().getDesc()); + } + if (columnObj.getRequired()) { + // 如果必填,那么需要引Validation注解包 + if (column.getDataType() == GenDataType.STRING) { + // 如果是String,则引@NotBlank注解 + columnObj.setValidateAnno(NotBlank.class.getSimpleName()); + importPackages.add(NotBlank.class.getName()); + } else { + // 否则引@NotNull注解 + columnObj.setValidateAnno(NotNull.class.getSimpleName()); + importPackages.add(NotNull.class.getName()); + } + + if (column.getViewType() == GenViewType.SELECT + || column.getViewType() == GenViewType.DATA_DIC) { + columnObj.setValidateMsg("请选择"); + } else { + columnObj.setValidateMsg("请输入"); + } + + if (columnObj.getFixEnum()) { + // 如果是内置枚举,那么引IsEnum注解包 + importPackages.add(IsEnum.class.getName()); + } + } + columnObj.setName(column.getColumnName()); + columnObj.setColumnName(column.getTableColumn().getDbColumnName()); + columnObj.setNameProperty( + column.getColumnName().substring(0, 1).toUpperCase() + column.getColumnName() + .substring(1)); + columnObj.setDescription(column.getName()); + columnObj.setHasAvailableTag( + column.getViewType() == GenViewType.SELECT && column.getDataType() == GenDataType.BOOLEAN + && "available".equals(column.getColumnName())); + if (!StringUtil.isBlank(column.getRegularExpression())) { + columnObj.setRegularExpression(column.getRegularExpression()); + importPackages.add(Pattern.class.getName()); + } + columnObj.setIsNumberType(GenDataType.isNumberType(column.getDataType())); + columnObj.setIsDecimalType(GenDataType.isDecimalType(column.getDataType())); + columnObj.setLen(column.getLen()); + columnObj.setDecimals(column.getDecimals()); + if (columnObj.getIsNumberType()) { + if (columnObj.getIsDecimalType()) { + importPackages.add(IsNumberPrecision.class.getName()); + } + } else if (column.getDataType() == GenDataType.STRING) { + if (column.getViewType() == GenViewType.INPUT + || column.getViewType() == GenViewType.TEXTATREA) { + importPackages.add(Length.class.getName()); + } + } + + if (column.getViewType() == GenViewType.DATA_DIC) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dic = sysDataDicService.findById(column.getDataDicId()); + columnObj.setDataDicCode(dic.getCode()); + } else if (column.getViewType() == GenViewType.CUSTOM_SELECTOR) { + columnObj.setCustomSelectorId(column.getCustomSelectorId()); + } + + columns.add(columnObj); + } + + updateTemplate.setColumns(columns); + updateTemplate.setImportPackages(importPackages); + List keyColumns = dataEntity.getColumns().stream() + .filter(DataEntityColumn::getIsKey) + .collect(Collectors.toList()); + List keys = keyColumns.stream().map(t -> { + UpdateTemplate.Key key = new UpdateTemplate.Key(); + // 主键不会是枚举 + key.setDataType(t.getDataType().getDesc()); + key.setFrontDataType(t.getDataType().getFrontDesc()); + key.setName(t.getColumnName()); + key.setNameProperty( + t.getColumnName().substring(0, 1).toUpperCase() + t.getColumnName().substring(1)); + key.setColumnName(t.getTableColumn().getDbColumnName()); + key.setDescription(t.getName()); + if (t.getDataType() == GenDataType.STRING) { + // 如果是String,则引@NotBlank注解 + importPackages.add(NotBlank.class.getName()); + } else { + // 否则引@NotNull注解 + importPackages.add(NotNull.class.getName()); + } + return key; + }).collect(Collectors.toList()); + updateTemplate.setKeys(keys); + + return updateTemplate; + } + + private QueryTemplate getQueryTemplate() { + + List targetColumns = dataEntity.getColumns().stream() + .filter(t -> t.getQueryConfig() != null) + .sorted(Comparator.comparing(t -> t.getQueryConfig().getOrderNo())) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(targetColumns)) { + return null; + } + QueryTemplate queryTemplate = new QueryTemplate(); + queryTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + queryTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + queryTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + queryTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + queryTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + queryTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + + Set importPackages = new HashSet<>(); + importPackages.add(TypeMismatch.class.getName()); + importPackages.add(ApiModelProperty.class.getName()); + importPackages.add(StringPool.class.getName()); + importPackages.add(BaseBo.class.getName()); + List columns = new ArrayList<>(); + for (DataEntityColumn column : targetColumns) { + QueryTemplate.Column columnObj = new QueryTemplate.Column(); + if (column.getFixEnum()) { + // 如果是枚举类型 + columnObj.setDataType( + column.getEnumBack().substring(column.getEnumBack().lastIndexOf(".") + 1)); + columnObj.setFrontType(column.getEnumFront()); + columnObj.setFrontDataType("number"); + columnObj.setViewType(column.getViewType().getCode()); + importPackages.add(column.getEnumBack()); + importPackages.add(EnumUtil.class.getName()); + } else { + columnObj.setDataType(column.getDataType().getDesc()); + columnObj.setFrontDataType(column.getDataType().getFrontDesc()); + columnObj.setIsNumberType(GenDataType.isNumberType(column.getDataType())); + columnObj.setViewType(column.getViewType().getCode()); + columnObj.setHasAvailableTag( + column.getViewType() == GenViewType.SELECT + && column.getDataType() == GenDataType.BOOLEAN + && "available".equals(column.getColumnName())); + } + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + columnObj.setFixEnum(column.getFixEnum()); + if (columnObj.getFixEnum()) { + columnObj.setEnumCodeType(column.getDataType().getDesc()); + } + columnObj.setName(column.getColumnName()); + columnObj.setNameProperty( + column.getColumnName().substring(0, 1).toUpperCase() + column.getColumnName() + .substring(1)); + columnObj.setWidthType(column.getQueryConfig().getWidthType().getCode()); + columnObj.setWidth(column.getQueryConfig().getWidth()); + columnObj.setSortable(column.getQueryConfig().getSortable()); + columnObj.setDescription(column.getName()); + if (column.getViewType() == GenViewType.DATA_DIC) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dic = sysDataDicService.findById(column.getDataDicId()); + columnObj.setDataDicCode(dic.getCode()); + importPackages.add(SysDataDicItemService.class.getName()); + importPackages.add(StringUtil.class.getName()); + importPackages.add(ApplicationUtil.class.getName()); + importPackages.add(StringPool.class.getName()); + } + + columns.add(columnObj); + } + + queryTemplate.setColumns(columns); + queryTemplate.setHasFixEnum(columns.stream().anyMatch(QueryTemplate.Column::getFixEnum)); + + List keyColumns = dataEntity.getColumns().stream() + .filter(DataEntityColumn::getIsKey) + .collect(Collectors.toList()); + List keys = keyColumns.stream().map(t -> { + QueryTemplate.Key key = new QueryTemplate.Key(); + // 主键不会是枚举 + key.setDataType(t.getDataType().getDesc()); + key.setFrontDataType(t.getDataType().getFrontDesc()); + key.setName(t.getColumnName()); + key.setNameProperty( + t.getColumnName().substring(0, 1).toUpperCase() + t.getColumnName().substring(1)); + key.setDescription(t.getName()); + + return key; + }).collect(Collectors.toList()); + + queryTemplate.setKeys(keys); + + queryTemplate.setImportPackages(importPackages); + + return queryTemplate; + } + + private DetailTemplate getDetailTemplate() { + + List targetColumns = dataEntity.getColumns().stream() + .filter(t -> t.getDetailConfig() != null) + .sorted(Comparator.comparing(t -> t.getDetailConfig().getOrderNo())) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(targetColumns)) { + return null; + } + DetailTemplate detailTemplate = new DetailTemplate(); + detailTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + detailTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + detailTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + detailTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + detailTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + detailTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + + Set importPackages = new HashSet<>(); + importPackages.add(TypeMismatch.class.getName()); + importPackages.add(ApiModelProperty.class.getName()); + importPackages.add(StringPool.class.getName()); + importPackages.add(BaseBo.class.getName()); + List columns = new ArrayList<>(); + for (DataEntityColumn column : targetColumns) { + DetailTemplate.Column columnObj = new DetailTemplate.Column(); + if (column.getFixEnum()) { + // 如果是枚举类型 + columnObj.setDataType( + column.getEnumBack().substring(column.getEnumBack().lastIndexOf(".") + 1)); + columnObj.setFrontType(column.getEnumFront()); + columnObj.setFrontDataType("number"); + importPackages.add(column.getEnumBack()); + importPackages.add(EnumUtil.class.getName()); + } else { + columnObj.setDataType(column.getDataType().getDesc()); + columnObj.setFrontDataType(column.getDataType().getFrontDesc()); + columnObj.setHasAvailableTag( + column.getViewType() == GenViewType.SELECT + && column.getDataType() == GenDataType.BOOLEAN + && "available".equals(column.getColumnName())); + if (columnObj.getHasAvailableTag()) { + detailTemplate.setHasAvailableTag(Boolean.TRUE); + } + } + // 以下类型需要单独引包 + if (column.getDataType() == GenDataType.LOCAL_DATE) { + importPackages.add(LocalDate.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_DATE_TIME) { + importPackages.add(LocalDateTime.class.getName()); + } else if (column.getDataType() == GenDataType.LOCAL_TIME) { + importPackages.add(LocalTime.class.getName()); + } else if (column.getDataType() == GenDataType.BIG_DECIMAL) { + importPackages.add(BigDecimal.class.getName()); + } + columnObj.setFixEnum(column.getFixEnum()); + if (columnObj.getFixEnum()) { + columnObj.setEnumCodeType(column.getDataType().getDesc()); + } + columnObj.setName(column.getColumnName()); + columnObj.setNameProperty( + column.getColumnName().substring(0, 1).toUpperCase() + column.getColumnName() + .substring(1)); + columnObj.setDescription(column.getName()); + columnObj.setSpan(column.getDetailConfig().getSpan()); + + if (column.getViewType() == GenViewType.DATA_DIC) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dic = sysDataDicService.findById(column.getDataDicId()); + columnObj.setDataDicCode(dic.getCode()); + importPackages.add(SysDataDicItemService.class.getName()); + importPackages.add(StringUtil.class.getName()); + importPackages.add(ApplicationUtil.class.getName()); + importPackages.add(StringPool.class.getName()); + } + + columns.add(columnObj); + } + + detailTemplate.setColumns(columns); + detailTemplate.setHasFixEnum(columns.stream().anyMatch(DetailTemplate.Column::getFixEnum)); + detailTemplate.setDetailSpan(dataEntity.getGenerateInfo().getDetailSpan()); + List keyColumns = dataEntity.getColumns().stream() + .filter(DataEntityColumn::getIsKey) + .collect(Collectors.toList()); + List keys = keyColumns.stream().map(t -> { + DetailTemplate.Key key = new DetailTemplate.Key(); + // 主键不会是枚举 + key.setDataType(t.getDataType().getDesc()); + key.setFrontDataType(t.getDataType().getFrontDesc()); + key.setName(t.getColumnName()); + key.setNameProperty( + t.getColumnName().substring(0, 1).toUpperCase() + t.getColumnName().substring(1)); + key.setDescription(t.getName()); + + return key; + }).collect(Collectors.toList()); + + detailTemplate.setKeys(keys); + + detailTemplate.setImportPackages(importPackages); + + return detailTemplate; + } + + private ControllerTemplate getControllerTemplate() { + + Set importPackages = new HashSet<>(); + ControllerTemplate controllerTemplate = new ControllerTemplate(); + controllerTemplate.setPackageName(dataEntity.getGenerateInfo().getPackageName()); + controllerTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + controllerTemplate.setClassNameProperty( + dataEntity.getGenerateInfo().getClassName().substring(0, 1).toLowerCase() + + dataEntity.getGenerateInfo() + .getClassName().substring(1)); + controllerTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + controllerTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + controllerTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + controllerTemplate.setAuthor(dataEntity.getGenerateInfo().getAuthor()); + controllerTemplate.setIsCache(dataEntity.getGenerateInfo().getIsCache()); + controllerTemplate.setHasDelete(dataEntity.getGenerateInfo().getHasDelete()); + if (controllerTemplate.getHasDelete()) { + importPackages.add(DeleteMapping.class.getName()); + } + importPackages.add(DefaultClientException.class.getName()); + importPackages.add(CollectionUtil.class.getName()); + importPackages.add(PageResult.class.getName()); + importPackages.add(PageResultUtil.class.getName()); + importPackages.add(InvokeResult.class.getName()); + importPackages.add(InvokeResultBuilder.class.getName()); + importPackages.add(Api.class.getName()); + importPackages.add(ApiOperation.class.getName()); + importPackages.add(ApiImplicitParam.class.getName()); + importPackages.add(ApiImplicitParams.class.getName()); + + List keyColumns = dataEntity.getColumns().stream() + .filter(DataEntityColumn::getIsKey) + .collect(Collectors.toList()); + List keys = keyColumns.stream().map(t -> { + ControllerTemplate.Key key = new ControllerTemplate.Key(); + // 主键不会是枚举 + key.setDataType(t.getDataType().getDesc()); + key.setName(t.getColumnName()); + key.setNameProperty(t.getColumnName().substring(0, 1).toUpperCase() + t.getColumnName() + .substring(1)); + + if (t.getDataType() == GenDataType.STRING) { + importPackages.add(NotBlank.class.getName()); + } else { + importPackages.add(NotNull.class.getName()); + } + + return key; + }).collect(Collectors.toList()); + + controllerTemplate.setKeys(keys); + controllerTemplate.setImportPackages(importPackages); + controllerTemplate.setCreate(this.getCreateTemplate()); + controllerTemplate.setUpdate(this.getUpdateTemplate()); + controllerTemplate.setQuery(this.getQueryTemplate()); + controllerTemplate.setQueryParams(this.getQueryParamsTemplate()); + controllerTemplate.setDetail(this.getDetailTemplate()); + if (controllerTemplate.getCreate() != null) { + importPackages.addAll(controllerTemplate.getCreate().getImportPackages()); + } + if (controllerTemplate.getUpdate() != null) { + importPackages.addAll(controllerTemplate.getUpdate().getImportPackages()); + } + if (controllerTemplate.getQuery() != null) { + importPackages.addAll(controllerTemplate.getQuery().getImportPackages()); + if (!controllerTemplate.getHasAvailableTag()) { + controllerTemplate.setHasAvailableTag(controllerTemplate.getQuery().getColumns().stream() + .anyMatch(QueryTemplate.Column::getHasAvailableTag)); + } + } + if (controllerTemplate.getQueryParams() != null) { + importPackages.addAll(controllerTemplate.getQueryParams().getImportPackages()); + if (!controllerTemplate.getHasAvailableTag()) { + controllerTemplate.setHasAvailableTag( + controllerTemplate.getQueryParams().getColumns().stream() + .anyMatch(QueryParamsTemplate.Column::getHasAvailableTag)); + } + } + if (controllerTemplate.getDetail() != null) { + importPackages.addAll(controllerTemplate.getDetail().getImportPackages()); + } + + return controllerTemplate; + } + + private SqlTemplate getSqlTemplate() { + + SqlTemplate sqlTemplate = new SqlTemplate(); + sqlTemplate.setModuleName(dataEntity.getGenerateInfo().getModuleName()); + sqlTemplate.setBizName(dataEntity.getGenerateInfo().getBizName()); + sqlTemplate.setClassName(dataEntity.getGenerateInfo().getClassName()); + sqlTemplate.setClassDescription(dataEntity.getGenerateInfo().getClassDescription()); + sqlTemplate.setParentMenuId(dataEntity.getGenerateInfo().getParentMenuId()); + sqlTemplate.setMenuId(dataEntity.getGenerateInfo().getId()); + sqlTemplate.setMenuCode(dataEntity.getGenerateInfo().getMenuCode()); + sqlTemplate.setMenuName(dataEntity.getGenerateInfo().getMenuName()); + sqlTemplate.setCreate(this.getCreateTemplate()); + sqlTemplate.setUpdate(this.getUpdateTemplate()); + + return sqlTemplate; + } + + /** + * 生成代码 + * + * @param templateName 模板名称 + * @param data 数据 + * @return + */ + private String generate(String templateName, Object data) { + + Template template = this.getTemplate(templateName); + Map root = JsonUtil.convert(data, Map.class); + StringWriter stringWriter = new StringWriter(); + BufferedWriter writer = new BufferedWriter(stringWriter); + + loadStaticClasses(root); + + try { + template.process(root, writer); + } catch (TemplateException | IOException e) { + log.error(e.getMessage(), e); + throw new DefaultSysException(e.getMessage()); + } + + return stringWriter.toString(); + } + + private GenerateDto buildGenerateResult(String path, String fileName, String content) { + + if (StringUtil.isBlank(content)) { + return null; + } + GenerateDto result = new GenerateDto(); + result.setPath(path); + result.setFileName(fileName); + result.setContent(content); + + return result; + } + + private void loadStaticClasses(Map root) { + + BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); + + TemplateHashModel staticModels = wrapper.getStaticModels(); + + TemplateHashModel fileStatics = null; + try { + fileStatics = (TemplateHashModel) staticModels.get(IdUtil.class.getName()); + } catch (TemplateModelException e) { + log.error("加载静态类失败", e); + throw new DefaultSysException("加载静态类失败"); + } + + root.put(IdUtil.class.getSimpleName(), fileStatics); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/ControllerTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/ControllerTemplate.java new file mode 100644 index 0000000..88aa822 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/ControllerTemplate.java @@ -0,0 +1,116 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 用于Controller.java、index.vue、api.js生成 + */ +@Data +public class ControllerTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 类名(首字母小写) + */ + private String classNameProperty; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 是否应用缓存 + */ + private Boolean isCache; + + /** + * 是否内置删除功能 + */ + private Boolean hasDelete; + + /** + * 是否包含状态Tag + */ + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 主键 + */ + private List keys; + + /** + * 需要import的包 + */ + private Set importPackages; + + /** + * 新增配置 + */ + private CreateTemplate create; + + /** + * 修改配置 + */ + private UpdateTemplate update; + + /** + * 查询配置 + */ + private QueryTemplate query; + + /** + * 查询参数配置 + */ + private QueryParamsTemplate queryParams; + + /** + * 详情配置 + */ + private DetailTemplate detail; + + @Data + public static class Key { + + /** + * 类型 + */ + private String dataType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/CreateTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/CreateTemplate.java new file mode 100644 index 0000000..6409297 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/CreateTemplate.java @@ -0,0 +1,210 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 新增功能Template + */ +@Data +public class CreateTemplate { + + /** + * 是否指定ID 如果是自增ID就不需要指定ID + */ + private Boolean appointId; + + /** + * 指定ID的代码 当appointId == true时生效 + */ + private String idCode; + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 字段 + */ + private List columns; + + /** + * 需要import的包 + */ + private Set importPackages; + + /** + * 主键 + */ + private List keys; + + @Data + public static class Key { + + /** + * 字段类型 + */ + private String dataType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段名 + */ + private String columnName; + + /** + * 字段备注 + */ + private String description; + } + + @Data + public static class Column { + + /** + * 是否主键 + */ + private Boolean isKey; + + /** + * 是否必填 + */ + private Boolean required; + + /** + * 验证注解 + */ + private String validateAnno; + + /** + * 验证信息 当required == true时生效 + */ + private String validateMsg; + + /** + * 是否内置枚举 + */ + private Boolean fixEnum; + + /** + * 枚举的Code的类型 当fixEnum == true时生效 + */ + private String enumCodeType; + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + private String frontType; + + /** + * 显示类型 + */ + private Integer viewType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段名 + */ + private String columnName; + + /** + * 正则表达式 + */ + private String regularExpression; + + /** + * 字段备注 + */ + private String description; + + /** + * 是否包含状态Tag + */ + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 是否数字类型 + */ + private Boolean isNumberType = Boolean.FALSE; + + /** + * 是否小数类型 + */ + private Boolean isDecimalType = Boolean.FALSE; + + /** + * 数据字典编号 + */ + private String dataDicCode; + + /** + * 自定义选择器ID + */ + private String customSelectorId; + + /** + * 长度 + */ + private Long len; + + /** + * 小数点位数 + */ + private Integer decimals; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/DetailTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/DetailTemplate.java new file mode 100644 index 0000000..dfd38ca --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/DetailTemplate.java @@ -0,0 +1,160 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 详情功能Template + */ +@Data +public class DetailTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 是否包含状态Tag + */ + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 字段 + */ + private List columns; + + /** + * 主键 + */ + private List keys; + + /** + * 是否存在内置枚举 + */ + private Boolean hasFixEnum; + + /** + * 详情页Span总数量 + */ + private Integer detailSpan; + + /** + * 需要import的包 + */ + private Set importPackages; + + @Data + public static class Key { + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段备注 + */ + private String description; + } + + @Data + public static class Column { + + /** + * 是否内置枚举 + */ + private Boolean fixEnum; + + /** + * 枚举的Code的类型 当fixEnum == true时生效 + */ + private String enumCodeType; + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + private String frontType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段备注 + */ + private String description; + + /** + * 列宽 + */ + private Integer span; + + /** + * 是否包含状态Tag + */ + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 数据字典Code + */ + private String dataDicCode; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/EntityTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/EntityTemplate.java new file mode 100644 index 0000000..ea5fae3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/EntityTemplate.java @@ -0,0 +1,112 @@ +package com.lframework.xingyun.template.gen.generate.templates; + + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 实体类Template + */ +@Data +public class EntityTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 库表名 + */ + private String tableName; + + /** + * 类名 + */ + private String className; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 列信息 + */ + private List columns; + + /** + * 需要import的包 + */ + private Set importPackages; + + @Data + public static class Column { + + /** + * 是否主键 + */ + private Boolean isKey; + + /** + * 是否自增主键 + */ + private Boolean autoIncrKey; + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + private String frontType; + + /** + * 字段名称 + */ + private String name; + + /** + * 是否默认字段名转换方式(下划线转驼峰) + */ + private Boolean defaultConvertType; + + /** + * 数据库字段名称 + */ + private String columnName; + + /** + * 字段备注 + */ + private String description; + + /** + * 是否填充字段 isKey == false时生效 + */ + private Boolean fill; + + /** + * 填充策略 + */ + private String fillStrategy; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/MapperTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/MapperTemplate.java new file mode 100644 index 0000000..7ad9050 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/MapperTemplate.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 用于生成Mapper.java、Mapper.xml + */ +@Data +public class MapperTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 主键 + */ + private List keys; + + /** + * 排序字段 + */ + private List orderColumns; + + /** + * 实体类配置 + */ + private EntityTemplate entity; + + /** + * 需要import的包 + */ + private Set importPackages; + + /** + * 查询参数配置 + */ + private QueryParamsTemplate queryParams; + + @Data + public static class Key { + + /** + * 类型 + */ + private String dataType; + + /** + * 字段名称 + */ + private String name; + + /** + * 数据表列名 + */ + private String columnName; + } + + @Data + public static class OrderColumn { + + /** + * 数据表列名 + */ + private String columnName; + + /** + * 排序类型 + */ + private String orderType; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/QueryParamsTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/QueryParamsTemplate.java new file mode 100644 index 0000000..51a5443 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/QueryParamsTemplate.java @@ -0,0 +1,131 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 查询参数Template + */ +@Data +public class QueryParamsTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 字段 + */ + private List columns; + + /** + * 需要import的包 + */ + private Set importPackages; + + @Data + public static class Column { + + /** + * 是否内置枚举 + */ + private Boolean fixEnum; + + /** + * 正则表达式 + */ + private String regularExpression; + + /** + * 枚举的Code的类型 当fixEnum == true时生效 + */ + private String enumCodeType; + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + private String frontType; + + /** + * 显示类型 + */ + private Integer viewType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段名 + */ + private String columnName; + + /** + * 查询类型 + */ + private Integer queryType; + + /** + * 字段备注 + */ + private String description; + + /** + * 是否包含状态Tag + */ + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 数据字典Code + */ + private String dataDicCode; + + /** + * 自定义选择器ID + */ + private String customSelectorId; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/QueryTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/QueryTemplate.java new file mode 100644 index 0000000..0ce6dc4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/QueryTemplate.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 查询功能Template + */ +@Data +public class QueryTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 字段 + */ + private List columns; + + /** + * 主键 + */ + private List keys; + + /** + * 是否存在内置枚举 + */ + private Boolean hasFixEnum; + + /** + * 需要import的包 + */ + private Set importPackages; + + @Data + public static class Key { + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段备注 + */ + private String description; + } + + @Data + public static class Column { + + /** + * 是否内置枚举 + */ + private Boolean fixEnum; + + /** + * 枚举的Code的类型 当fixEnum == true时生效 + */ + private String enumCodeType; + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + private String frontType; + + /** + * 是否数字类型 + */ + private Boolean isNumberType = Boolean.FALSE; + + /** + * 显示类型 + */ + private Integer viewType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 宽度类型 + */ + private Integer widthType; + + /** + * 宽度 + */ + private Integer width; + + /** + * 是否页面排序 + */ + private Boolean sortable; + + /** + * 字段备注 + */ + private String description; + + /** + * 是否包含状态Tag + */ + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 数据字典Code + */ + private String dataDicCode; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/ServiceTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/ServiceTemplate.java new file mode 100644 index 0000000..457f4e1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/ServiceTemplate.java @@ -0,0 +1,106 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 用于Service.java、ServiceImpl.java生成 + */ +@Data +public class ServiceTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 类名(首字母小写) + */ + private String classNameProperty; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 是否应用缓存 + */ + private Boolean isCache; + + /** + * 是否内置删除功能 + */ + private Boolean hasDelete; + + /** + * 需要import的包 + */ + private Set importPackages; + + /** + * 主键 + */ + private List keys; + + /** + * 查询参数配置 + */ + private QueryParamsTemplate queryParams; + + /** + * 新增配置 + */ + private CreateTemplate create; + + /** + * 修改配置 + */ + private UpdateTemplate update; + + @Data + public static class Key { + + /** + * 类型 + */ + private String dataType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 数据表列名 + */ + private String columnName; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/SqlTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/SqlTemplate.java new file mode 100644 index 0000000..03d9530 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/SqlTemplate.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import lombok.Data; + +/** + * 用于生成Sql + */ +@Data +public class SqlTemplate { + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类名 + */ + private String className; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 父级菜单ID + */ + private String parentMenuId; + + /** + * 菜单ID + */ + private String menuId; + + /** + * 本级菜单编号 + */ + private String menuCode; + + /** + * 本级菜单名称 + */ + private String menuName; + + /** + * 新增配置 + */ + private CreateTemplate create; + + /** + * 修改配置 + */ + private UpdateTemplate update; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/UpdateTemplate.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/UpdateTemplate.java new file mode 100644 index 0000000..938b4c4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/generate/templates/UpdateTemplate.java @@ -0,0 +1,205 @@ +package com.lframework.xingyun.template.gen.generate.templates; + +import java.util.List; +import java.util.Set; +import lombok.Data; + +/** + * 修改功能Template + */ +@Data +public class UpdateTemplate { + + /** + * 包名 + */ + private String packageName; + + /** + * 类名 + */ + private String className; + + /** + * 模块名称 + */ + private String moduleName; + + /** + * 业务名称 + */ + private String bizName; + + /** + * 类描述 + */ + private String classDescription; + + /** + * 作者 + */ + private String author; + + /** + * 字段 + */ + private List columns; + + /** + * 需要import的包 + */ + private Set importPackages; + + /** + * 主键 + */ + private List keys; + + @Data + public static class Key { + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段名 + */ + private String columnName; + + /** + * 字段备注 + */ + private String description; + } + + @Data + public static class Column { + + /** + * 是否主键 + */ + private Boolean isKey; + + /** + * 是否必填 + */ + private Boolean required; + + /** + * 验证注解 + */ + private String validateAnno; + + /** + * 验证信息 当required == true时生效 + */ + private String validateMsg; + + /** + * 是否内置枚举 + */ + private Boolean fixEnum; + + /** + * 枚举的Code的类型 当fixEnum == true时生效 + */ + private String enumCodeType; + + /** + * 字段类型 + */ + private String dataType; + + /** + * 前端字段类型 + */ + private String frontDataType; + + /** + * 前端字段类型 只有字段是枚举时生效,此值为前端枚举类型 + */ + private String frontType; + + /** + * 显示类型 + */ + private Integer viewType; + + /** + * 字段名称 + */ + private String name; + + /** + * 字段名称(首字母大写) + */ + private String nameProperty; + + /** + * 字段名 + */ + private String columnName; + + /** + * 正则表达式 + */ + private String regularExpression; + + /** + * 字段备注 + */ + private String description; + + /** + * 是否包含状态Tag + */ + private Boolean hasAvailableTag = Boolean.FALSE; + + /** + * 是否数字类型 + */ + private Boolean isNumberType = Boolean.FALSE; + + /** + * 是否小数类型 + */ + private Boolean isDecimalType = Boolean.FALSE; + + /** + * 数据字典编号 + */ + private String dataDicCode; + + /** + * 自定义选择器ID + */ + private String customSelectorId; + + /** + * 长度 + */ + private Long len; + + /** + * 小数点位数 + */ + private Integer decimals; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCreateColumnConfigServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCreateColumnConfigServiceImpl.java new file mode 100644 index 0000000..431fee3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCreateColumnConfigServiceImpl.java @@ -0,0 +1,74 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.dto.gen.GenCreateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenCreateColumnConfig; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.mappers.GenCreateColumnConfigMapper; +import com.lframework.xingyun.template.gen.service.GenCreateColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.vo.gen.UpdateCreateColumnConfigVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCreateColumnConfigServiceImpl + extends BaseMpServiceImpl + implements GenCreateColumnConfigService { + + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Override + public List getByDataEntityId(String entityId) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (CollectionUtil.isEmpty(columns)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateGenerate(String entityId, List vo) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (!CollectionUtil.isEmpty(columns)) { + getBaseMapper().deleteBatchIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + if (!CollectionUtil.isEmpty(vo)) { + int orderNo = 1; + for (UpdateCreateColumnConfigVo updateCreateColumnConfigVo : vo) { + GenCreateColumnConfig record = new GenCreateColumnConfig(); + record.setId(updateCreateColumnConfigVo.getId()); + record.setRequired(updateCreateColumnConfigVo.getRequired()); + record.setOrderNo(orderNo++); + + getBaseMapper().insert(record); + } + } + } + + @Override + public GenCreateColumnConfigDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + getBaseMapper().deleteById(id); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListCategoryServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListCategoryServiceImpl.java new file mode 100644 index 0000000..4b622c2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListCategoryServiceImpl.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.xingyun.template.gen.mappers.GenCustomListCategoryMapper; +import com.lframework.xingyun.template.gen.service.GenCustomListCategoryService; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.vo.custom.list.category.CreateGenCustomListCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.list.category.GenCustomListCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.list.category.UpdateGenCustomListCategoryVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomListCategoryServiceImpl extends + BaseMpServiceImpl implements + GenCustomListCategoryService { + + @Autowired + private GenCustomListService genCustomListService; + + @Cacheable(value = GenCustomListCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + 'all'") + @Override + public List queryList() { + return getBaseMapper().query(); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomListCategorySelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenCustomListCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenCustomListCategory findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenCustomListCategoryVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(GenCustomListCategory.class) + .eq(GenCustomListCategory::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenCustomListCategory.class) + .eq(GenCustomListCategory::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenCustomListCategory record = new GenCustomListCategory(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenCustomListCategoryVo vo) { + Wrapper checkWrapper = Wrappers.lambdaQuery(GenCustomListCategory.class) + .eq(GenCustomListCategory::getCode, vo.getCode()) + .ne(GenCustomListCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenCustomListCategory.class) + .eq(GenCustomListCategory::getName, vo.getName()) + .ne(GenCustomListCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenCustomListCategory record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("自定义列表分类不存在!"); + } + + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.updateById(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenCustomList.class) + .eq(GenCustomList::getCategoryId, id); + if (genCustomListService.count(queryWrapper) > 0) { + throw new DefaultClientException("此分类下存在自定义列表,无法删除!"); + } + + this.removeById(id); + } + + @CacheEvict(value = GenCustomListCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListDetailServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListDetailServiceImpl.java new file mode 100644 index 0000000..1392e43 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListDetailServiceImpl.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.gen.entity.GenCustomListDetail; +import com.lframework.xingyun.template.gen.mappers.GenCustomListDetailMapper; +import com.lframework.xingyun.template.gen.service.GenCustomListDetailService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomListDetailServiceImpl extends + BaseMpServiceImpl implements + GenCustomListDetailService { + + @Override + public List getByCustomListId(String customListId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(GenCustomListDetail.class) + .eq(GenCustomListDetail::getCustomListId, customListId) + .orderByAsc(GenCustomListDetail::getOrderNo); + return this.list(queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByCustomListId(String customListId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery(GenCustomListDetail.class) + .eq(GenCustomListDetail::getCustomListId, customListId); + this.remove(deleteWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListHandleColumnServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListHandleColumnServiceImpl.java new file mode 100644 index 0000000..dbaa7e1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListHandleColumnServiceImpl.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.gen.entity.GenCustomListHandleColumn; +import com.lframework.xingyun.template.gen.mappers.GenCustomListHandleColumnMapper; +import com.lframework.xingyun.template.gen.service.GenCustomListHandleColumnService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomListHandleColumnServiceImpl extends + BaseMpServiceImpl implements + GenCustomListHandleColumnService { + + @Override + public List getByCustomListId(String customListId) { + return getBaseMapper().getByCustomListId(customListId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByCustomListId(String customListId) { + + Wrapper deleteWrapper = Wrappers + .lambdaQuery(GenCustomListHandleColumn.class) + .eq(GenCustomListHandleColumn::getCustomListId, customListId); + this.remove(deleteWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListQueryParamsServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListQueryParamsServiceImpl.java new file mode 100644 index 0000000..63a1ede --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListQueryParamsServiceImpl.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.gen.entity.GenCustomListQueryParams; +import com.lframework.xingyun.template.gen.mappers.GenCustomListQueryParamsMapper; +import com.lframework.xingyun.template.gen.service.GenCustomListQueryParamsService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomListQueryParamsServiceImpl extends + BaseMpServiceImpl implements + GenCustomListQueryParamsService { + + @Override + public List getByCustomListId(String customListId) { + Wrapper queryWrapper = Wrappers.lambdaQuery( + GenCustomListQueryParams.class).eq(GenCustomListQueryParams::getCustomListId, customListId) + .orderByAsc(GenCustomListQueryParams::getOrderNo); + return this.list(queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByCustomListId(String customListId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery( + GenCustomListQueryParams.class) + .eq(GenCustomListQueryParams::getCustomListId, customListId); + this.remove(deleteWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListServiceImpl.java new file mode 100644 index 0000000..8a9ff4f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListServiceImpl.java @@ -0,0 +1,526 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.xingyun.template.gen.components.custom.list.CustomListConfig; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListDetail; +import com.lframework.xingyun.template.gen.entity.GenCustomListHandleColumn; +import com.lframework.xingyun.template.gen.entity.GenCustomListQueryParams; +import com.lframework.xingyun.template.gen.entity.GenCustomListToolbar; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnType; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnViewType; +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.xingyun.template.gen.enums.GenCustomListType; +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; +import com.lframework.xingyun.template.gen.events.CustomListDeleteEvent; +import com.lframework.xingyun.template.gen.mappers.GenCustomListMapper; +import com.lframework.xingyun.template.gen.service.GenCustomListDetailService; +import com.lframework.xingyun.template.gen.service.GenCustomListHandleColumnService; +import com.lframework.xingyun.template.gen.service.GenCustomListQueryParamsService; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.service.GenCustomListToolbarService; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.gen.vo.custom.list.CreateGenCustomListVo; +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListDetailVo; +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListHandleColumnVo; +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListQueryParamsVo; +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListToolbarVo; +import com.lframework.xingyun.template.gen.vo.custom.list.QueryGenCustomListVo; +import com.lframework.xingyun.template.gen.vo.custom.list.UpdateGenCustomListVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.JsonUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomListServiceImpl extends + BaseMpServiceImpl implements GenCustomListService { + + @Autowired + private GenCustomListQueryParamsService genCustomListQueryParamsService; + + @Autowired + private GenCustomListDetailService genCustomListDetailService; + + @Autowired + private GenCustomListToolbarService genCustomListToolbarService; + + @Autowired + private GenCustomListHandleColumnService genCustomListHandleColumnService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryGenCustomListVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryGenCustomListVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomListSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenCustomList.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenCustomList findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenCustomListVo data) { + GenCustomList record = new GenCustomList(); + record.setId(IdUtil.getId()); + record.setName(data.getName()); + if (!StringUtil.isBlank(data.getCategoryId())) { + record.setCategoryId(data.getCategoryId()); + } + record.setListType(EnumUtil.getByCode(GenCustomListType.class, data.getListType())); + record.setQueryPrefixSql(StringUtil.isBlank(data.getQueryPrefixSql()) ? StringPool.EMPTY_STR + : data.getQueryPrefixSql()); + record.setQuerySuffixSql(StringUtil.isBlank(data.getQuerySuffixSql()) ? StringPool.EMPTY_STR + : data.getQuerySuffixSql()); + record.setSuffixSql( + StringUtil.isBlank(data.getSuffixSql()) ? StringPool.EMPTY_STR : data.getSuffixSql()); + + record.setLabelWidth(data.getLabelWidth()); + record.setHasPage(data.getHasPage()); + record.setTreeData(data.getTreeData()); + // 如果是树形列表,那么分页必须禁用 + // 如果分页没有禁用,那么一定不是树形列表 + if (record.getTreeData()) { + record.setHasPage(Boolean.FALSE); + } + + if (record.getHasPage()) { + record.setTreeData(Boolean.FALSE); + } + + record.setIdColumn(data.getIdColumn()); + record.setIdColumnRelaId(data.getIdColumnRelaId()); + + if (record.getTreeData()) { + + if (StringUtil.isBlank(data.getTreePidColumn())) { + throw new DefaultClientException("父级ID字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreePidColumnRelaId())) { + throw new DefaultClientException("父级ID字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreeNodeColumn())) { + throw new DefaultClientException("树形节点字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreeNodeColumnRelaId())) { + throw new DefaultClientException("树形节点字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreeChildrenKey())) { + throw new DefaultClientException("子节点Key值不能为空!"); + } + record.setTreePidColumn(data.getTreePidColumn()); + record.setTreePidColumnRelaId(data.getTreePidColumnRelaId()); + record.setTreeNodeColumn(data.getTreeNodeColumn()); + record.setTreeNodeColumnRelaId(data.getTreeNodeColumnRelaId()); + record.setTreeChildrenKey(data.getTreeChildrenKey()); + } + record.setAllowExport(data.getAllowExport()); + record.setDataObjId(data.getDataObjId()); + record.setAvailable(Boolean.TRUE); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + if (!CollectionUtil.isEmpty(data.getQueryParams())) { + int orderNo = 1; + for (GenCustomListQueryParamsVo queryParam : data.getQueryParams()) { + GenCustomListQueryParams genCustomListQueryParams = new GenCustomListQueryParams(); + genCustomListQueryParams.setId(IdUtil.getId()); + genCustomListQueryParams.setCustomListId(record.getId()); + genCustomListQueryParams.setRelaId(queryParam.getRelaId()); + genCustomListQueryParams.setDataEntityId(queryParam.getId()); + genCustomListQueryParams.setQueryType( + EnumUtil.getByCode(GenQueryType.class, queryParam.getQueryType())); + genCustomListQueryParams.setFrontShow(queryParam.getFrontShow()); + genCustomListQueryParams.setFormWidth(queryParam.getFormWidth()); + genCustomListQueryParams.setDefaultValue(queryParam.getDefaultValue() == null ? null + : queryParam.getDefaultValue() instanceof String ? queryParam.getDefaultValue() + .toString() : JsonUtil.toJsonString(queryParam.getDefaultValue())); + genCustomListQueryParams.setOrderNo(orderNo); + genCustomListQueryParams.setType( + EnumUtil.getByCode(GenCustomListDetailType.class, queryParam.getType())); + + genCustomListQueryParamsService.save(genCustomListQueryParams); + + orderNo++; + } + } + + int orderNo = 1; + for (GenCustomListDetailVo detail : data.getDetails()) { + GenCustomListDetail genCustomListDetail = new GenCustomListDetail(); + genCustomListDetail.setId(IdUtil.getId()); + genCustomListDetail.setCustomListId(record.getId()); + genCustomListDetail.setDataEntityId(detail.getId()); + genCustomListDetail.setRelaId(detail.getRelaId()); + genCustomListDetail.setWidthType( + EnumUtil.getByCode(GenQueryWidthType.class, detail.getWidthType())); + genCustomListDetail.setWidth(detail.getWidth()); + genCustomListDetail.setSortable(detail.getSortable()); + genCustomListDetail.setOrderNo(orderNo); + genCustomListDetail.setType( + EnumUtil.getByCode(GenCustomListDetailType.class, detail.getType())); + if (genCustomListDetail.getType() == GenCustomListDetailType.CUSTOM) { + genCustomListDetail.setDataEntityId(null); + } + if (!StringUtil.isBlank(detail.getFormatter())) { + genCustomListDetail.setFormatter(detail.getFormatter()); + } + + genCustomListDetailService.save(genCustomListDetail); + + orderNo++; + } + + if (!CollectionUtil.isEmpty(data.getToolbars())) { + orderNo = 1; + for (GenCustomListToolbarVo tb : data.getToolbars()) { + GenCustomListToolbar toolbar = new GenCustomListToolbar(); + toolbar.setId(IdUtil.getId()); + toolbar.setCustomListId(record.getId()); + toolbar.setName(tb.getName()); + toolbar.setViewType(EnumUtil.getByCode(GenCustomListBtnViewType.class, tb.getViewType())); + toolbar.setBtnType(EnumUtil.getByCode(GenCustomListBtnType.class, tb.getBtnType())); + toolbar.setBtnConfig(tb.getBtnConfig()); + if (!StringUtil.isBlank(tb.getIcon())) { + toolbar.setIcon(tb.getIcon()); + } + toolbar.setOrderNo(orderNo); + orderNo++; + + genCustomListToolbarService.save(toolbar); + } + } + + if (!CollectionUtil.isEmpty(data.getHandleColumns())) { + orderNo = 1; + for (GenCustomListHandleColumnVo hd : data.getHandleColumns()) { + GenCustomListHandleColumn handleColumn = new GenCustomListHandleColumn(); + handleColumn.setId(IdUtil.getId()); + handleColumn.setCustomListId(record.getId()); + handleColumn.setName(hd.getName()); + handleColumn + .setViewType(EnumUtil.getByCode(GenCustomListBtnViewType.class, hd.getViewType())); + handleColumn.setBtnType(EnumUtil.getByCode(GenCustomListBtnType.class, hd.getBtnType())); + handleColumn.setBtnConfig(hd.getBtnConfig()); + if (!StringUtil.isBlank(hd.getIcon())) { + handleColumn.setIcon(hd.getIcon()); + } + handleColumn.setOrderNo(orderNo); + handleColumn.setWidth(hd.getWidth()); + orderNo++; + + genCustomListHandleColumnService.save(handleColumn); + } + } + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenCustomListVo data) { + GenCustomList record = this.getById(data.getId()); + if (record == null) { + throw new DefaultClientException("自定义列表不存在!"); + } + + record.setHasPage(data.getHasPage()); + record.setTreeData(data.getTreeData()); + + // 如果是树形列表,那么分页必须禁用 + // 如果分页没有禁用,那么一定不是树形列表 + if (record.getTreeData()) { + record.setHasPage(Boolean.FALSE); + } + + if (record.getHasPage()) { + record.setTreeData(Boolean.FALSE); + } + + if (record.getTreeData()) { + + if (StringUtil.isBlank(data.getTreePidColumn())) { + throw new DefaultClientException("父级ID字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreePidColumnRelaId())) { + throw new DefaultClientException("父级ID字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreeNodeColumn())) { + throw new DefaultClientException("树形节点字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreeNodeColumnRelaId())) { + throw new DefaultClientException("树形节点字段不能为空!"); + } + + if (StringUtil.isBlank(data.getTreeChildrenKey())) { + throw new DefaultClientException("子节点Key值不能为空!"); + } + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(GenCustomList.class) + .eq(GenCustomList::getId, data.getId()).set(GenCustomList::getName, data.getName()) + .set(GenCustomList::getCategoryId, + StringUtil.isBlank(data.getCategoryId()) ? null : data.getCategoryId()) + .set(GenCustomList::getListType, + EnumUtil.getByCode(GenCustomListType.class, data.getListType())) + .set(GenCustomList::getLabelWidth, data.getLabelWidth()) + .set(GenCustomList::getHasPage, record.getHasPage()) + .set(GenCustomList::getTreeData, record.getTreeData()) + .set(GenCustomList::getIdColumn, data.getIdColumn()) + .set(GenCustomList::getIdColumnRelaId, data.getIdColumnRelaId()) + .set(GenCustomList::getTreePidColumn, record.getTreeData() ? data.getTreePidColumn() : null) + .set(GenCustomList::getTreePidColumnRelaId, + record.getTreeData() ? data.getTreePidColumnRelaId() : null) + .set(GenCustomList::getTreeNodeColumn, + record.getTreeData() ? data.getTreeNodeColumn() : null) + .set(GenCustomList::getTreeNodeColumnRelaId, + record.getTreeData() ? data.getTreeNodeColumnRelaId() : null) + .set(GenCustomList::getTreeChildrenKey, + record.getTreeData() ? data.getTreeChildrenKey() : null) + .set(GenCustomList::getQueryPrefixSql, + StringUtil.isBlank(data.getQueryPrefixSql()) ? StringPool.EMPTY_STR + : data.getQueryPrefixSql()) + .set(GenCustomList::getQuerySuffixSql, + StringUtil.isBlank(data.getQuerySuffixSql()) ? StringPool.EMPTY_STR + : data.getQuerySuffixSql()) + .set(GenCustomList::getSuffixSql, + StringUtil.isBlank(data.getSuffixSql()) ? StringPool.EMPTY_STR : data.getSuffixSql()) + .set(GenCustomList::getDescription, + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR + : data.getDescription()).set(GenCustomList::getAvailable, data.getAvailable()) + .set(GenCustomList::getAllowExport, data.getAllowExport()); + + this.update(updateWrapper); + + genCustomListDetailService.deleteByCustomListId(data.getId()); + genCustomListQueryParamsService.deleteByCustomListId(data.getId()); + + if (!CollectionUtil.isEmpty(data.getQueryParams())) { + int orderNo = 1; + for (GenCustomListQueryParamsVo queryParam : data.getQueryParams()) { + GenCustomListQueryParams genCustomListQueryParams = new GenCustomListQueryParams(); + genCustomListQueryParams.setId(IdUtil.getId()); + genCustomListQueryParams.setCustomListId(record.getId()); + genCustomListQueryParams.setRelaId(queryParam.getRelaId()); + genCustomListQueryParams.setDataEntityId(queryParam.getId()); + genCustomListQueryParams.setQueryType( + EnumUtil.getByCode(GenQueryType.class, queryParam.getQueryType())); + genCustomListQueryParams.setFrontShow(queryParam.getFrontShow()); + genCustomListQueryParams.setFormWidth(queryParam.getFormWidth()); + genCustomListQueryParams.setDefaultValue(queryParam.getDefaultValue() == null ? null + : queryParam.getDefaultValue() instanceof String ? queryParam.getDefaultValue() + .toString() : JsonUtil.toJsonString(queryParam.getDefaultValue())); + genCustomListQueryParams.setOrderNo(orderNo); + genCustomListQueryParams.setType( + EnumUtil.getByCode(GenCustomListDetailType.class, queryParam.getType())); + + genCustomListQueryParamsService.save(genCustomListQueryParams); + + orderNo++; + } + } + + int orderNo = 1; + for (GenCustomListDetailVo detail : data.getDetails()) { + GenCustomListDetail genCustomListDetail = new GenCustomListDetail(); + genCustomListDetail.setId(IdUtil.getId()); + genCustomListDetail.setCustomListId(record.getId()); + genCustomListDetail.setDataEntityId(detail.getId()); + genCustomListDetail.setRelaId(detail.getRelaId()); + genCustomListDetail.setWidthType( + EnumUtil.getByCode(GenQueryWidthType.class, detail.getWidthType())); + genCustomListDetail.setWidth(detail.getWidth()); + genCustomListDetail.setSortable(detail.getSortable()); + genCustomListDetail.setOrderNo(orderNo); + genCustomListDetail.setType( + EnumUtil.getByCode(GenCustomListDetailType.class, detail.getType())); + if (genCustomListDetail.getType() == GenCustomListDetailType.CUSTOM) { + genCustomListDetail.setDataEntityId(null); + } + genCustomListDetail.setFormatter(detail.getFormatter()); + + genCustomListDetailService.save(genCustomListDetail); + + orderNo++; + } + + genCustomListToolbarService.deleteByCustomListId(record.getId()); + + if (!CollectionUtil.isEmpty(data.getToolbars())) { + orderNo = 1; + for (GenCustomListToolbarVo tb : data.getToolbars()) { + GenCustomListToolbar toolbar = new GenCustomListToolbar(); + toolbar.setId(IdUtil.getId()); + toolbar.setCustomListId(record.getId()); + toolbar.setName(tb.getName()); + toolbar.setViewType(EnumUtil.getByCode(GenCustomListBtnViewType.class, tb.getViewType())); + toolbar.setBtnType(EnumUtil.getByCode(GenCustomListBtnType.class, tb.getBtnType())); + toolbar.setBtnConfig(tb.getBtnConfig()); + if (!StringUtil.isBlank(tb.getIcon())) { + toolbar.setIcon(tb.getIcon()); + } + toolbar.setOrderNo(orderNo); + orderNo++; + + genCustomListToolbarService.save(toolbar); + } + } + + genCustomListHandleColumnService.deleteByCustomListId(record.getId()); + + if (!CollectionUtil.isEmpty(data.getHandleColumns())) { + orderNo = 1; + for (GenCustomListHandleColumnVo hd : data.getHandleColumns()) { + GenCustomListHandleColumn handleColumn = new GenCustomListHandleColumn(); + handleColumn.setId(IdUtil.getId()); + handleColumn.setCustomListId(record.getId()); + handleColumn.setName(hd.getName()); + handleColumn + .setViewType(EnumUtil.getByCode(GenCustomListBtnViewType.class, hd.getViewType())); + handleColumn.setBtnType(EnumUtil.getByCode(GenCustomListBtnType.class, hd.getBtnType())); + handleColumn.setBtnConfig(hd.getBtnConfig()); + if (!StringUtil.isBlank(hd.getIcon())) { + handleColumn.setIcon(hd.getIcon()); + } + handleColumn.setWidth(hd.getWidth()); + handleColumn.setOrderNo(orderNo); + orderNo++; + + genCustomListHandleColumnService.save(handleColumn); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(String id) { + GenCustomList data = this.getById(id); + + this.removeById(id); + genCustomListDetailService.deleteByCustomListId(id); + genCustomListQueryParamsService.deleteByCustomListId(id); + + if (data != null) { + CustomListDeleteEvent event = new CustomListDeleteEvent(this); + event.setId(id); + event.setName(data.getName()); + ApplicationUtil.publishEvent(event); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + for (String id : ids) { + this.delete(id); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenCustomList.class) + .set(GenCustomList::getAvailable, Boolean.TRUE).in(GenCustomList::getId, ids); + getBaseMapper().update(wrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenCustomList.class) + .set(GenCustomList::getAvailable, Boolean.FALSE).in(GenCustomList::getId, ids); + getBaseMapper().update(wrapper); + } + + @Override + public List getRelaGenDataObjIds(String objId) { + return getBaseMapper().getRelaGenDataObjIds(objId); + } + + @Override + public List getRelaGenDataEntityIds(String entityId) { + return getBaseMapper().getRelaGenDataEntityIds(entityId); + } + + @CacheEvict(value = {GenCustomList.CACHE_NAME, CustomListConfig.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + ThreadUtil.execAsync(() -> { + GenCustomSelectorService genCustomSelectorService = ApplicationUtil + .getBean(GenCustomSelectorService.class); + List ids = genCustomSelectorService.getRelaGenCustomListIds(String.valueOf(key)); + if (CollectionUtil.isNotEmpty(ids)) { + genCustomSelectorService.cleanCacheByKeys(ids); + } + }); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListToolbarServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListToolbarServiceImpl.java new file mode 100644 index 0000000..ee9b94e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomListToolbarServiceImpl.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.gen.entity.GenCustomListToolbar; +import com.lframework.xingyun.template.gen.mappers.GenCustomListToolbarMapper; +import com.lframework.xingyun.template.gen.service.GenCustomListToolbarService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomListToolbarServiceImpl extends + BaseMpServiceImpl implements + GenCustomListToolbarService { + + @Override + public List getByCustomListId(String customListId) { + return getBaseMapper().getByCustomListId(customListId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByCustomListId(String customListId) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(GenCustomListToolbar.class) + .eq(GenCustomListToolbar::getCustomListId, customListId); + this.remove(deleteWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomPageCategoryServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomPageCategoryServiceImpl.java new file mode 100644 index 0000000..d60fd03 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomPageCategoryServiceImpl.java @@ -0,0 +1,135 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.service.GenCustomPageCategoryService; +import com.lframework.xingyun.template.gen.service.GenCustomPageService; +import com.lframework.xingyun.template.gen.vo.custom.page.category.CreateGenCustomPageCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.page.category.UpdateGenCustomPageCategoryVo; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.xingyun.template.gen.mappers.GenCustomPageCategoryMapper; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomPageCategoryServiceImpl extends + BaseMpServiceImpl implements + GenCustomPageCategoryService { + + @Autowired + private GenCustomPageService genCustomPageService; + + @Cacheable(value = GenCustomPageCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + 'all'") + @Override + public List queryList() { + return getBaseMapper().query(); + } + + @Cacheable(value = GenCustomPageCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenCustomPageCategory findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenCustomPageCategoryVo vo) { + + Wrapper checkWrapper = Wrappers + .lambdaQuery(GenCustomPageCategory.class) + .eq(GenCustomPageCategory::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenCustomPageCategory.class) + .eq(GenCustomPageCategory::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenCustomPageCategory record = new GenCustomPageCategory(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + record.setParentId(StringUtil.isBlank(vo.getParentId()) ? null : vo.getParentId()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenCustomPageCategoryVo vo) { + Wrapper checkWrapper = Wrappers + .lambdaQuery(GenCustomPageCategory.class) + .eq(GenCustomPageCategory::getCode, vo.getCode()) + .ne(GenCustomPageCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenCustomPageCategory.class) + .eq(GenCustomPageCategory::getName, vo.getName()) + .ne(GenCustomPageCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenCustomPageCategory record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("自定义列表分类不存在!"); + } + + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.updateById(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + Set categoryIds = new HashSet<>(); + categoryIds.add(id); + while (true) { + Wrapper queryCategoryWrapper = Wrappers.lambdaQuery( + GenCustomPageCategory.class).in(GenCustomPageCategory::getParentId, categoryIds); + List categoryList = this.list(queryCategoryWrapper); + + int oldSize = categoryIds.size(); + categoryIds.addAll( + categoryList.stream().map(GenCustomPageCategory::getId).collect(Collectors.toList())); + if (oldSize == categoryIds.size()) { + break; + } + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenCustomPage.class) + .in(GenCustomPage::getCategoryId, categoryIds); + if (genCustomPageService.count(queryWrapper) > 0) { + throw new DefaultClientException("此分类或其子分类下存在自定义页面,无法删除!"); + } + + this.removeByIds(categoryIds); + } + + @CacheEvict(value = GenCustomPageCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomPageServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomPageServiceImpl.java new file mode 100644 index 0000000..b735f9e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomPageServiceImpl.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.components.custom.page.CustomPageConfig; +import com.lframework.xingyun.template.gen.service.GenCustomPageService; +import com.lframework.xingyun.template.gen.vo.custom.page.CreateGenCustomPageVo; +import com.lframework.xingyun.template.gen.vo.custom.page.GenCustomPageSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.page.QueryGenCustomPageVo; +import com.lframework.xingyun.template.gen.vo.custom.page.UpdateGenCustomPageVo; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.xingyun.template.gen.mappers.GenCustomPageMapper; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomPageServiceImpl extends + BaseMpServiceImpl implements + GenCustomPageService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryGenCustomPageVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryGenCustomPageVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomPageSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenCustomPage.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenCustomPage findById(Integer id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public Integer create(CreateGenCustomPageVo data) { + GenCustomPage record = new GenCustomPage(); + + record.setName(data.getName()); + if (!StringUtil.isBlank(data.getCategoryId())) { + record.setCategoryId(data.getCategoryId()); + } + record.setPageCode(data.getPageCode()); + record.setScriptCode(data.getScriptCode()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenCustomPageVo data) { + GenCustomPage record = this.getById(data.getId()); + if (record == null) { + throw new DefaultClientException("自定义表单不存在!"); + } + + record.setPageCode(data.getPageCode()); + record.setScriptCode(data.getScriptCode()); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + this.updateAllColumnById(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(Integer id) { + this.removeById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + for (Integer id : ids) { + this.delete(id); + } + } + + @CacheEvict(value = {GenCustomPage.CACHE_NAME, + CustomPageConfig.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + super.cleanCacheByKey(key); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomSelectorCategoryServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomSelectorCategoryServiceImpl.java new file mode 100644 index 0000000..4e1ae60 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomSelectorCategoryServiceImpl.java @@ -0,0 +1,134 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.xingyun.template.gen.mappers.GenCustomSelectorCategoryMapper; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorCategoryService; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.CreateGenCustomSelectorCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.GenCustomSelectorCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.UpdateGenCustomSelectorCategoryVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomSelectorCategoryServiceImpl extends + BaseMpServiceImpl implements + GenCustomSelectorCategoryService { + + @Autowired + private GenCustomSelectorService genCustomSelectorService; + + @Cacheable(value = GenCustomSelectorCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + 'all'") + @Override + public List queryList() { + return getBaseMapper().query(); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomSelectorCategorySelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenCustomSelectorCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenCustomSelectorCategory findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenCustomSelectorCategoryVo vo) { + + Wrapper checkWrapper = Wrappers + .lambdaQuery(GenCustomSelectorCategory.class) + .eq(GenCustomSelectorCategory::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenCustomSelectorCategory.class) + .eq(GenCustomSelectorCategory::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenCustomSelectorCategory record = new GenCustomSelectorCategory(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenCustomSelectorCategoryVo vo) { + Wrapper checkWrapper = Wrappers + .lambdaQuery(GenCustomSelectorCategory.class) + .eq(GenCustomSelectorCategory::getCode, vo.getCode()) + .ne(GenCustomSelectorCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenCustomSelectorCategory.class) + .eq(GenCustomSelectorCategory::getName, vo.getName()) + .ne(GenCustomSelectorCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenCustomSelectorCategory record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("自定义列表分类不存在!"); + } + + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.updateById(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenCustomSelector.class) + .eq(GenCustomSelector::getCategoryId, id); + if (genCustomSelectorService.count(queryWrapper) > 0) { + throw new DefaultClientException("此分类下存在自定义选择器,无法删除!"); + } + + this.removeById(id); + } + + @CacheEvict(value = GenCustomSelectorCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomSelectorServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomSelectorServiceImpl.java new file mode 100644 index 0000000..d7f0c74 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenCustomSelectorServiceImpl.java @@ -0,0 +1,184 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.components.custom.selector.CustomSelectorConfig; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.mappers.GenCustomSelectorMapper; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import com.lframework.xingyun.template.gen.vo.custom.selector.CreateGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.GenCustomSelectorSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.QueryGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.UpdateGenCustomSelectorVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenCustomSelectorServiceImpl extends + BaseMpServiceImpl implements + GenCustomSelectorService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryGenCustomSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryGenCustomSelectorVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomSelectorSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenCustomSelector.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenCustomSelector findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenCustomSelectorVo data) { + GenCustomSelector record = new GenCustomSelector(); + + record.setId(IdUtil.getId()); + record.setName(data.getName()); + if (!StringUtil.isBlank(data.getCategoryId())) { + record.setCategoryId(data.getCategoryId()); + } + record.setCustomListId(data.getCustomListId()); + record.setAvailable(Boolean.TRUE); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + record.setIdColumn(data.getIdColumn()); + record.setIdColumnRelaId(data.getIdColumnRelaId()); + record.setNameColumn(data.getNameColumn()); + record.setNameColumnRelaId(data.getNameColumnRelaId()); + record.setDialogTittle( + StringUtil.isBlank(data.getDialogTittle()) ? StringPool.EMPTY_STR : data.getDialogTittle()); + record.setDialogWidth(data.getDialogWidth()); + record.setPlaceholder( + StringUtil.isBlank(data.getPlaceholder()) ? StringPool.EMPTY_STR : data.getPlaceholder()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenCustomSelectorVo data) { + GenCustomSelector record = this.getById(data.getId()); + if (record == null) { + throw new DefaultClientException("自定义列表不存在!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(GenCustomSelector.class) + .eq(GenCustomSelector::getId, data.getId()).set(GenCustomSelector::getName, data.getName()) + .set(GenCustomSelector::getCategoryId, + StringUtil.isBlank(data.getCategoryId()) ? null : data.getCategoryId()) + .set(GenCustomSelector::getDialogTittle, + StringUtil.isBlank(data.getDialogTittle()) ? StringPool.EMPTY_STR + : data.getDialogTittle()) + .set(GenCustomSelector::getDialogWidth, data.getDialogWidth()) + .set(GenCustomSelector::getPlaceholder, + StringUtil.isBlank(data.getPlaceholder()) ? StringPool.EMPTY_STR + : data.getPlaceholder()) + .set(GenCustomSelector::getIdColumn, data.getIdColumn()) + .set(GenCustomSelector::getIdColumnRelaId, data.getIdColumnRelaId()) + .set(GenCustomSelector::getNameColumn, data.getNameColumn()) + .set(GenCustomSelector::getNameColumnRelaId, data.getNameColumnRelaId()) + .set(GenCustomSelector::getDescription, + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR + : data.getDescription()).set(GenCustomSelector::getAvailable, data.getAvailable()); + + this.update(updateWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(String id) { + this.removeById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + for (String id : ids) { + this.delete(id); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenCustomSelector.class) + .set(GenCustomSelector::getAvailable, Boolean.TRUE).in(GenCustomSelector::getId, ids); + getBaseMapper().update(wrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenCustomSelector.class) + .set(GenCustomSelector::getAvailable, Boolean.FALSE).in(GenCustomSelector::getId, ids); + getBaseMapper().update(wrapper); + } + + @Override + public List getRelaGenCustomListIds(String customListId) { + return getBaseMapper().getRelaGenCustomListIds(customListId); + } + + @CacheEvict(value = {GenCustomSelector.CACHE_NAME, CustomSelectorConfig.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + super.cleanCacheByKey(key); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityCategoryServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityCategoryServiceImpl.java new file mode 100644 index 0000000..c5a5f39 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityCategoryServiceImpl.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.mappers.GenDataEntityCategoryMapper; +import com.lframework.xingyun.template.gen.service.GenDataEntityCategoryService; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.vo.data.entity.category.CreateGenDataEntityCategoryVo; +import com.lframework.xingyun.template.gen.vo.data.entity.category.GenDataEntityCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.category.UpdateGenDataEntityCategoryVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDataEntityCategoryServiceImpl extends + BaseMpServiceImpl implements + GenDataEntityCategoryService { + + @Autowired + private GenDataEntityService genDataEntityService; + + @Cacheable(value = GenDataEntityCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + 'all'") + @Override + public List queryList() { + return getBaseMapper().query(); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenDataEntityCategorySelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenDataEntityCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenDataEntityCategory findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenDataEntityCategoryVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(GenDataEntityCategory.class) + .eq(GenDataEntityCategory::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenDataEntityCategory.class) + .eq(GenDataEntityCategory::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenDataEntityCategory record = new GenDataEntityCategory(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenDataEntityCategoryVo vo) { + Wrapper checkWrapper = Wrappers.lambdaQuery(GenDataEntityCategory.class) + .eq(GenDataEntityCategory::getCode, vo.getCode()) + .ne(GenDataEntityCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenDataEntityCategory.class) + .eq(GenDataEntityCategory::getName, vo.getName()) + .ne(GenDataEntityCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenDataEntityCategory record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("数据实体分类不存在!"); + } + + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.updateById(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataEntity.class) + .eq(GenDataEntity::getCategoryId, id); + if (genDataEntityService.count(queryWrapper) > 0) { + throw new DefaultClientException("此分类下存在数据实体,无法删除!"); + } + + this.removeById(id); + } + + @CacheEvict(value = GenDataEntityCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityDetailServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityDetailServiceImpl.java new file mode 100644 index 0000000..392af9a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityDetailServiceImpl.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.mappers.GenDataEntityDetailMapper; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntityDetailSelectorVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDataEntityDetailServiceImpl extends + BaseMpServiceImpl implements + GenDataEntityDetailService { + + @Override + public List getByEntityId(String entityId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataEntityDetail.class) + .eq(GenDataEntityDetail::getEntityId, entityId) + .orderByAsc(GenDataEntityDetail::getColumnOrder); + + return getBaseMapper().selectList(queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByEntityId(String entityId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataEntityDetail.class) + .eq(GenDataEntityDetail::getEntityId, entityId); + getBaseMapper().delete(queryWrapper); + } + + @Override + public List selector(GenDataEntityDetailSelectorVo vo) { + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataEntityDetail.class) + .eq(GenDataEntityDetail::getEntityId, vo.getEntityId()) + .orderByAsc(GenDataEntityDetail::getColumnOrder); + + return getBaseMapper().selectList(queryWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityServiceImpl.java new file mode 100644 index 0000000..2d1f8ce --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataEntityServiceImpl.java @@ -0,0 +1,546 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.converters.GenStringConverter; +import com.lframework.xingyun.template.gen.converters.GenViewTypeConverter; +import com.lframework.xingyun.template.gen.dto.data.entity.DataEntityGenerateDto; +import com.lframework.xingyun.template.gen.dto.gen.GenCreateColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenDetailColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import com.lframework.xingyun.template.gen.dto.gen.GenQueryColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenQueryParamsColumnConfigDto; +import com.lframework.xingyun.template.gen.dto.gen.GenUpdateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.xingyun.template.gen.enums.GenConvertType; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenKeyType; +import com.lframework.xingyun.template.gen.enums.GenOrderType; +import com.lframework.xingyun.template.gen.enums.GenStatus; +import com.lframework.xingyun.template.gen.enums.GenTemplateType; +import com.lframework.xingyun.template.gen.enums.GenViewType; +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.mappers.GenDataEntityMapper; +import com.lframework.xingyun.template.gen.service.GenCreateColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDataEntityService; +import com.lframework.xingyun.template.gen.service.GenDetailColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenQueryColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenQueryParamsColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenUpdateColumnConfigService; +import com.lframework.xingyun.template.gen.service.GenerateInfoService; +import com.lframework.xingyun.template.gen.service.SimpleDBService; +import com.lframework.xingyun.template.gen.vo.data.entity.CreateDataEntityVo; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntityDetailVo; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntitySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.QueryDataEntityVo; +import com.lframework.xingyun.template.gen.vo.data.entity.UpdateDataEntityGenerateVo; +import com.lframework.xingyun.template.gen.vo.data.entity.UpdateDataEntityVo; +import com.lframework.xingyun.template.gen.vo.gen.UpdateGenerateInfoVo; +import com.lframework.xingyun.template.gen.dto.simpledb.OriSimpleTableDto; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import lombok.NonNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDataEntityServiceImpl extends + BaseMpServiceImpl implements GenDataEntityService { + + @Autowired + private GenerateInfoService generateInfoService; + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Autowired + private SimpleDBService simpleDBService; + + @Autowired + private GenCreateColumnConfigService genCreateColumnConfigService; + + @Autowired + private GenUpdateColumnConfigService genUpdateColumnConfigService; + + @Autowired + private GenQueryColumnConfigService genQueryColumnConfigService; + + @Autowired + private GenQueryParamsColumnConfigService genQueryParamsColumnConfigService; + + @Autowired + private GenDetailColumnConfigService genDetailColumnConfigService; + + @Autowired + private GenViewTypeConverter genViewTypeConverter; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QueryDataEntityVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryDataEntityVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenDataEntitySelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public GenDataEntity findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateDataEntityVo data) { + GenDataEntity record = new GenDataEntity(); + record.setId(IdUtil.getId()); + record.setName(data.getName()); + if (!StringUtil.isBlank(data.getCategoryId())) { + record.setCategoryId(data.getCategoryId()); + } + record.setAvailable(Boolean.TRUE); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + + + OriSimpleTableDto table = simpleDBService.getByTableName(data.getTableName()); + if (ObjectUtil.isNull(table)) { + throw new DefaultClientException("数据表【" + data.getTableName() + "】不存在!"); + } + + record.setTableSchema(table.getTableSchema()); + record.setTableName(table.getTableName()); + record.setEngine(table.getEngine()); + record.setTableCollation(table.getTableCollation()); + record.setTableComment(table.getTableComment()); + record.setConvertType(GenConvertType.UNDERLINE_TO_CAMEL); + + this.save(record); + + int orderNo = 1; + for (GenDataEntityDetailVo column : data.getColumns()) { + GenSimpleTableColumn columnDto = table.getColumns().stream() + .filter(t -> t.getDbColumnName().equals(column.getId())).findFirst().orElse(null); + if (columnDto == null) { + throw new DefaultClientException("字段【" + column.getId() + "】不存在!"); + } + + GenDataEntityDetail detail = this.buildDetail(column, columnDto); + detail.setId(IdUtil.getId()); + detail.setEntityId(record.getId()); + detail.setColumnOrder(orderNo); + + genDataEntityDetailService.save(detail); + + orderNo++; + } + + // 设置默认的基础设置 + UpdateGenerateInfoVo updateGenerateInfoVo = new UpdateGenerateInfoVo(); + updateGenerateInfoVo.setTemplateType(GenTemplateType.LIST.getCode()); + updateGenerateInfoVo.setPackageName("com.lframework"); + updateGenerateInfoVo.setModuleName(StringPool.EMPTY_STR); + updateGenerateInfoVo.setBizName( + GenStringConverter.convertToNormalLowerCase(GenConvertType.UNDERLINE_TO_CAMEL, + record.getTableName())); + // 强制转驼峰并且首字母大写 + String className = GenStringConverter.convertToCamelCase(GenConvertType.UNDERLINE_TO_CAMEL, + record.getTableName()); + updateGenerateInfoVo.setClassName( + className.substring(0, 1).toUpperCase() + className.substring(1)); + updateGenerateInfoVo.setClassDescription( + StringUtil.isEmpty(record.getTableComment()) ? StringPool.EMPTY_STR + : record.getTableComment()); + updateGenerateInfoVo.setKeyType(GenKeyType.SNOW_FLAKE.getCode()); + updateGenerateInfoVo.setMenuCode(StringPool.EMPTY_STR); + updateGenerateInfoVo.setMenuName(StringPool.EMPTY_STR); + updateGenerateInfoVo.setDetailSpan(4); + updateGenerateInfoVo.setIsCache(true); + updateGenerateInfoVo.setHasDelete(false); + + generateInfoService.updateGenerate(record.getId(), updateGenerateInfoVo); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateDataEntityVo vo) { + GenDataEntity record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("数据实体不存在!"); + } + Wrapper updateWrapper = Wrappers.lambdaUpdate(GenDataEntity.class) + .eq(GenDataEntity::getId, vo.getId()).set(GenDataEntity::getName, vo.getName()) + .set(GenDataEntity::getAvailable, vo.getAvailable()).set(GenDataEntity::getCategoryId, + StringUtil.isBlank(vo.getCategoryId()) ? null : vo.getCategoryId()) + .set(GenDataEntity::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + this.update(updateWrapper); + + List columnDtos = genDataEntityDetailService.getByEntityId(record.getId()); + + int orderNo = 1; + for (GenDataEntityDetailVo column : vo.getColumns()) { + GenDataEntityDetail detail = columnDtos.stream() + .filter(t -> t.getId().equals(column.getId())).findFirst().orElse(null); + detail.setName(column.getName()); + + detail.setDataType(EnumUtil.getByCode(GenDataType.class, column.getDataType())); + detail.setDescription(column.getDescription()); + detail.setViewType(EnumUtil.getByCode(GenViewType.class, column.getViewType())); + detail.setFixEnum(column.getFixEnum()); + detail.setEnumBack(column.getEnumBack()); + detail.setEnumFront(column.getEnumFront()); + detail.setRegularExpression(column.getRegularExpression()); + detail.setIsOrder(column.getIsOrder()); + detail.setOrderType(EnumUtil.getByCode(GenOrderType.class, column.getOrderType())); + detail.setLen(column.getLen()); + detail.setDecimals(column.getDecimals()); + detail.setDataDicId(StringPool.EMPTY_STR); + detail.setCustomSelectorId(StringPool.EMPTY_STR); + if (!StringUtil.isBlank(column.getDataDicId()) + && detail.getViewType() == GenViewType.DATA_DIC) { + detail.setDataDicId(column.getDataDicId()); + } + if (!StringUtil.isBlank(column.getCustomSelectorId()) + && detail.getViewType() == GenViewType.CUSTOM_SELECTOR) { + detail.setCustomSelectorId(column.getCustomSelectorId()); + } + + if (!genViewTypeConverter.canConvert(detail.getViewType(), detail.getDataType())) { + List viewTypes = genViewTypeConverter.convert(detail.getDataType()); + throw new DefaultClientException( + "字段【" + detail.getName() + "】数据类型和显示类型不匹配,当前数据类型为【" + detail.getDataType().getDesc() + + "】," + (!CollectionUtil.isEmpty(viewTypes) ? "显示类型只能为【" + CollectionUtil.join( + genViewTypeConverter.convert(detail.getDataType()).stream() + .map(GenViewType::getDesc) + .collect(Collectors.toList()), StringPool.STR_SPLIT_CN) + "】" : "暂不支持显示此数据类型")); + } + detail.setColumnOrder(orderNo); + + genDataEntityDetailService.updateById(detail); + + orderNo++; + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(@NonNull String id) { + + GenDataEntity record = getBaseMapper().selectById(id); + if (record == null) { + throw new DefaultClientException("数据实体不存在!"); + } + + List columns = genDataEntityDetailService.getByEntityId(id); + List columnIds = columns.stream().map(GenDataEntityDetail::getId) + .collect(Collectors.toList()); + + getBaseMapper().deleteById(id); + + genDataEntityDetailService.deleteByEntityId(id); + + DataEntityDeleteEvent event = new DataEntityDeleteEvent(this); + event.setId(id); + event.setName(record.getName()); + event.setColumnIds(columnIds); + + ApplicationUtil.publishEvent(event); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(@NonNull List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + for (String id : ids) { + this.delete(id); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenDataEntity.class) + .set(GenDataEntity::getAvailable, Boolean.TRUE).in(GenDataEntity::getId, ids); + getBaseMapper().update(wrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenDataEntity.class) + .set(GenDataEntity::getAvailable, Boolean.FALSE).in(GenDataEntity::getId, ids); + getBaseMapper().update(wrapper); + } + + @Override + public DataEntityGenerateDto getGenerateById(String id) { + DataEntityGenerateDto result = new DataEntityGenerateDto(); + + List columns = genDataEntityDetailService.getByEntityId(id); + result.setColumns(columns); + + GenGenerateInfoDto generateInfo = generateInfoService.getByEntityId(id); + result.setGenerateInfo(generateInfo); + + List createColumnConfigDtos = genCreateColumnConfigService.getByDataEntityId( + id); + result.setCreateConfigs(createColumnConfigDtos); + + List updateColumnConfigDtos = genUpdateColumnConfigService.getByDataEntityId( + id); + result.setUpdateConfigs(updateColumnConfigDtos); + + List queryColumnConfigDtos = genQueryColumnConfigService.getByDataEntityId( + id); + result.setQueryConfigs(queryColumnConfigDtos); + + List queryParamsColumnConfigDtos = genQueryParamsColumnConfigService.getByDataEntityId( + id); + result.setQueryParamsConfigs(queryParamsColumnConfigDtos); + + List detailColumnConfigDtos = genDetailColumnConfigService.getByDataEntityId( + id); + result.setDetailConfigs(detailColumnConfigDtos); + + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateGenerate(UpdateDataEntityGenerateVo vo) { + + generateInfoService.updateGenerate(vo.getId(), vo.getGenerateInfo()); + + genCreateColumnConfigService.updateGenerate(vo.getId(), vo.getCreateConfigs()); + + genUpdateColumnConfigService.updateGenerate(vo.getId(), vo.getUpdateConfigs()); + + genQueryColumnConfigService.updateGenerate(vo.getId(), vo.getQueryConfigs()); + + genQueryParamsColumnConfigService.updateGenerate(vo.getId(), vo.getQueryParamsConfigs()); + + genDetailColumnConfigService.updateGenerate(vo.getId(), vo.getDetailConfigs()); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(GenDataEntity.class) + .set(GenDataEntity::getGenStatus, GenStatus.SET_GEN).eq(GenDataEntity::getId, vo.getId()); + getBaseMapper().update(updateWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void syncTable(String id) { + // 查询simpleTable + GenDataEntity table = this.getById(id); + if (table == null) { + throw new DefaultClientException("数据表不存在!"); + } + List columns = genDataEntityDetailService.getByEntityId(table.getId()); + + // 最新的数据库结构 + OriSimpleTableDto oriTable = simpleDBService.getByTableName(table.getTableName()); + List oriColumns = oriTable.getColumns(); + + // 1、列是否匹配 + // db中是否有新增列 + List finalColumns = columns; + List newDbColumns = oriColumns.stream().filter( + t -> finalColumns.stream().noneMatch(c -> c.getDbColumnName().equals(t.getDbColumnName()))) + .collect(Collectors.toList()); + // 类型发生变化的列 + List changeTypeColumns = oriColumns.stream().filter( + t -> finalColumns.stream().anyMatch( + c -> c.getDbColumnName().equals(t.getDbColumnName()) && c.getDbDataType() != t.getDataType())) + .collect(Collectors.toList()); + if (!CollectionUtil.isEmpty(changeTypeColumns)) { + newDbColumns.addAll(changeTypeColumns); + } + + // db中是否有删除列 + List deleteDbColumns = columns.stream().filter( + t -> oriColumns.stream().noneMatch(c -> c.getDbColumnName().equals(t.getDbColumnName())) + || changeTypeColumns.stream() + .anyMatch(c2 -> c2.getDbColumnName().equals(t.getDbColumnName()))) + .collect(Collectors.toList()); + + // 先删除、后新增 + if (!CollectionUtil.isEmpty(deleteDbColumns)) { + for (GenDataEntityDetail deleteDbColumn : deleteDbColumns) { + genDataEntityDetailService.removeById(deleteDbColumn.getId()); + // 发布删除事件 + DataEntityDetailDeleteEvent event = new DataEntityDetailDeleteEvent(this); + event.setId(deleteDbColumn.getId()); + event.setName(deleteDbColumn.getDbColumnName()); + ApplicationUtil.publishEvent(event); + } + } + + List details = genDataEntityDetailService.getByEntityId(table.getId()); + if (CollectionUtil.isEmpty(details)) { + details = new ArrayList<>(); + } + int orderNo = 1; + for (GenDataEntityDetail detail : details) { + detail.setColumnOrder(orderNo); + genDataEntityDetailService.updateById(detail); + orderNo++; + } + + table = this.getById(id); + columns = details; + + orderNo = 1; + for (GenDataEntityDetail column : columns) { + column.setOrdinalPosition(orderNo); + genDataEntityDetailService.updateById(column); + orderNo++; + } + + if (!CollectionUtil.isEmpty(newDbColumns)) { + for (GenSimpleTableColumn columnDto : newDbColumns) { + GenDataEntityDetail detail = this.buildDetail(columnDto); + detail.setId(IdUtil.getId()); + detail.setColumnOrder(orderNo); + detail.setEntityId(table.getId()); + genDataEntityDetailService.save(detail); + + orderNo++; + } + } + } + + private GenDataEntityDetail buildDetail(GenSimpleTableColumn columnDto) { + GenDataEntityDetail detail = new GenDataEntityDetail(); + + detail.setName(columnDto.getColumnComment()); + detail.setColumnName(GenStringConverter.convertToCamelCase(GenConvertType.UNDERLINE_TO_CAMEL, + columnDto.getDbColumnName())); + detail.setIsKey(columnDto.getIsKey()); + detail.setDataType(columnDto.getDataType()); + List viewTypes = genViewTypeConverter.convert(detail.getDataType()); + if (CollectionUtil.isEmpty(viewTypes)) { + throw new DefaultClientException("字段:" + columnDto.getDbColumnName() + "类型暂不支持!"); + } + detail.setViewType(viewTypes.get(0)); + detail.setFixEnum(Boolean.FALSE); + detail.setIsOrder(Boolean.FALSE); + + detail.setDbColumnName(columnDto.getDbColumnName()); + detail.setDbDataType(columnDto.getDataType()); + detail.setIsNullable(columnDto.getIsNullable()); + detail.setIsKey(columnDto.getIsKey()); + detail.setColumnDefault(columnDto.getColumnDefault()); + detail.setOrdinalPosition(columnDto.getOrdinalPosition()); + detail.setColumnComment(columnDto.getColumnComment()); + detail.setDbLen(columnDto.getLen()); + detail.setDbDecimals(columnDto.getDecimals()); + + return detail; + } + + private GenDataEntityDetail buildDetail(GenDataEntityDetailVo column, + GenSimpleTableColumn columnDto) { + GenDataEntityDetail detail = new GenDataEntityDetail(); + detail.setColumnName(GenStringConverter.convertToCamelCase(GenConvertType.UNDERLINE_TO_CAMEL, + columnDto.getDbColumnName())); + detail.setIsKey(columnDto.getIsKey()); + + detail.setName(column.getName()); + detail.setDataType(EnumUtil.getByCode(GenDataType.class, column.getDataType())); + detail.setDescription(column.getDescription()); + detail.setViewType(EnumUtil.getByCode(GenViewType.class, column.getViewType())); + detail.setFixEnum(column.getFixEnum()); + detail.setEnumBack(column.getEnumBack()); + detail.setEnumFront(column.getEnumFront()); + detail.setRegularExpression(column.getRegularExpression()); + detail.setIsOrder(column.getIsOrder()); + detail.setOrderType(EnumUtil.getByCode(GenOrderType.class, column.getOrderType())); + detail.setLen(column.getLen()); + detail.setDecimals(column.getDecimals()); + detail.setDataDicId(StringPool.EMPTY_STR); + detail.setCustomSelectorId(StringPool.EMPTY_STR); + if (!StringUtil.isBlank(column.getDataDicId()) + && detail.getViewType() == GenViewType.DATA_DIC) { + detail.setDataDicId(column.getDataDicId()); + } + if (!StringUtil.isBlank(column.getCustomSelectorId()) + && detail.getViewType() == GenViewType.CUSTOM_SELECTOR) { + detail.setCustomSelectorId(column.getCustomSelectorId()); + } + detail.setDbColumnName(columnDto.getDbColumnName()); + detail.setDbDataType(columnDto.getDataType()); + detail.setIsNullable(columnDto.getIsNullable()); + detail.setColumnDefault(columnDto.getColumnDefault()); + detail.setOrdinalPosition(columnDto.getOrdinalPosition()); + detail.setColumnComment(columnDto.getColumnComment()); + detail.setDbLen(columnDto.getLen()); + detail.setDbDecimals(columnDto.getDecimals()); + + if (!genViewTypeConverter.canConvert(detail.getViewType(), detail.getDataType())) { + List viewTypes = genViewTypeConverter.convert(detail.getDataType()); + throw new DefaultClientException( + "字段【" + detail.getName() + "】数据类型和显示类型不匹配,当前数据类型为【" + detail.getDataType().getDesc() + + "】," + (!CollectionUtil.isEmpty(viewTypes) ? "显示类型只能为【" + CollectionUtil.join( + genViewTypeConverter.convert(detail.getDataType()).stream().map(GenViewType::getDesc) + .collect(Collectors.toList()), StringPool.STR_SPLIT_CN) + "】" : "暂不支持显示此数据类型")); + } + + return detail; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjCategoryServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjCategoryServiceImpl.java new file mode 100644 index 0000000..a7f25b7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjCategoryServiceImpl.java @@ -0,0 +1,132 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.mappers.GenDataObjCategoryMapper; +import com.lframework.xingyun.template.gen.service.GenDataObjCategoryService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import com.lframework.xingyun.template.gen.vo.data.obj.category.CreateGenDataObjCategoryVo; +import com.lframework.xingyun.template.gen.vo.data.obj.category.GenDataObjCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.obj.category.UpdateGenDataObjCategoryVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDataObjCategoryServiceImpl extends + BaseMpServiceImpl implements + GenDataObjCategoryService { + + @Autowired + private GenDataObjService genDataObjService; + + @Cacheable(value = GenDataObjCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + 'all'") + @Override + public List queryList() { + return getBaseMapper().query(); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenDataObjCategorySelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenDataObjCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenDataObjCategory findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenDataObjCategoryVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(GenDataObjCategory.class) + .eq(GenDataObjCategory::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenDataObjCategory.class) + .eq(GenDataObjCategory::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenDataObjCategory record = new GenDataObjCategory(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenDataObjCategoryVo vo) { + Wrapper checkWrapper = Wrappers.lambdaQuery(GenDataObjCategory.class) + .eq(GenDataObjCategory::getCode, vo.getCode()) + .ne(GenDataObjCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(GenDataObjCategory.class) + .eq(GenDataObjCategory::getName, vo.getName()) + .ne(GenDataObjCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + GenDataObjCategory record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("数据对象分类不存在!"); + } + + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.updateById(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataObj.class) + .eq(GenDataObj::getCategoryId, id); + if (genDataObjService.count(queryWrapper) > 0) { + throw new DefaultClientException("此分类下存在数据对象,无法删除!"); + } + + this.removeById(id); + } + + @CacheEvict(value = GenDataObjCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjDetailServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjDetailServiceImpl.java new file mode 100644 index 0000000..eebfa3c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjDetailServiceImpl.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.mappers.GenDataObjDetailMapper; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDataObjDetailServiceImpl extends + BaseMpServiceImpl implements + GenDataObjDetailService { + + @Override + public List getByObjId(String objId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataObjDetail.class) + .eq(GenDataObjDetail::getDataObjId, objId).orderByAsc(GenDataObjDetail::getOrderNo); + return this.list(queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByObjId(String objId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery(GenDataObjDetail.class) + .eq(GenDataObjDetail::getDataObjId, objId); + getBaseMapper().delete(deleteWrapper); + } + + @Override + public Boolean entityDetailIsRela(String entityDetailId) { + return getBaseMapper().entityDetailIsRela(entityDetailId); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjQueryDetailServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjQueryDetailServiceImpl.java new file mode 100644 index 0000000..eae2e8e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjQueryDetailServiceImpl.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.xingyun.template.gen.mappers.GenDataObjQueryDetailMapper; +import com.lframework.xingyun.template.gen.service.GenDataObjQueryDetailService; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDataObjQueryDetailServiceImpl extends + BaseMpServiceImpl implements + GenDataObjQueryDetailService { + + @Override + public List getByObjId(String objId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataObjQueryDetail.class) + .eq(GenDataObjQueryDetail::getDataObjId, objId) + .orderByAsc(GenDataObjQueryDetail::getOrderNo); + return this.list(queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByObjId(String objId) { + Wrapper deleteWrapper = Wrappers.lambdaQuery(GenDataObjQueryDetail.class) + .eq(GenDataObjQueryDetail::getDataObjId, objId); + getBaseMapper().delete(deleteWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjServiceImpl.java new file mode 100644 index 0000000..9ebf8de --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDataObjServiceImpl.java @@ -0,0 +1,327 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryObj; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenRelaMode; +import com.lframework.xingyun.template.gen.enums.GenRelaType; +import com.lframework.xingyun.template.gen.events.DataObjDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataObjQueryDetailDeleteEvent; +import com.lframework.xingyun.template.gen.mappers.GenDataObjMapper; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjQueryDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import com.lframework.xingyun.template.gen.vo.data.obj.CreateGenDataObjVo; +import com.lframework.xingyun.template.gen.vo.data.obj.GenDataObjDetailVo; +import com.lframework.xingyun.template.gen.vo.data.obj.GenDataObjQueryDetailVo; +import com.lframework.xingyun.template.gen.vo.data.obj.GenDataObjSelectorVo; +import com.lframework.xingyun.template.gen.vo.data.obj.QueryGenDataObjVo; +import com.lframework.xingyun.template.gen.vo.data.obj.UpdateGenDataObjVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import lombok.NonNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDataObjServiceImpl extends + BaseMpServiceImpl implements GenDataObjService { + + @Autowired + private GenDataObjDetailService genDataObjDetailService; + + @Autowired + private GenDataObjQueryDetailService genDataObjQueryDetailService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryGenDataObjVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QueryGenDataObjVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + GenDataObjSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = GenDataObj.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public GenDataObj findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateGenDataObjVo data) { + + GenDataObj record = new GenDataObj(); + record.setId(IdUtil.getId()); + record.setName(data.getName()); + if (!StringUtil.isBlank(data.getCategoryId())) { + record.setCategoryId(data.getCategoryId()); + } + record.setMainTableId(data.getMainTableId()); + record.setMainTableAlias(data.getMainTableAlias()); + record.setAvailable(Boolean.TRUE); + record.setDescription( + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR : data.getDescription()); + + this.save(record); + + int orderNo = 1; + if (!CollectionUtil.isEmpty(data.getColumns())) { + for (GenDataObjDetailVo column : data.getColumns()) { + GenDataObjDetail detail = new GenDataObjDetail(); + detail.setId(IdUtil.getId()); + detail.setDataObjId(record.getId()); + detail.setMainTableDetailIds( + CollectionUtil.join(column.getMainTableDetailIds(), StringPool.STR_SPLIT)); + detail.setRelaType(EnumUtil.getByCode(GenRelaType.class, column.getRelaType())); + detail.setRelaMode(EnumUtil.getByCode(GenRelaMode.class, column.getRelaMode())); + detail.setSubTableId(column.getSubTableId()); + detail.setSubTableAlias(column.getSubTableAlias()); + detail.setSubTableDetailIds( + CollectionUtil.join(column.getSubTableDetailIds(), StringPool.STR_SPLIT)); + detail.setOrderNo(orderNo); + + genDataObjDetailService.save(detail); + + orderNo++; + } + } + + if (!CollectionUtil.isEmpty(data.getQueryColumns())) { + orderNo = 1; + for (GenDataObjQueryDetailVo queryColumn : data.getQueryColumns()) { + GenDataObjQueryDetail detail = new GenDataObjQueryDetail(); + detail.setId(IdUtil.getId()); + detail.setDataObjId(record.getId()); + detail.setCustomName(queryColumn.getCustomName()); + detail.setCustomSql(queryColumn.getCustomSql()); + detail.setCustomAlias(queryColumn.getCustomAlias()); + detail.setDataType(EnumUtil.getByCode(GenDataType.class, queryColumn.getDataType())); + detail.setOrderNo(orderNo); + + genDataObjQueryDetailService.save(detail); + + orderNo++; + } + } + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateGenDataObjVo data) { + + GenDataObj record = this.getById(data.getId()); + if (record == null) { + throw new DefaultClientException("数据对象不存在!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(GenDataObj.class) + .eq(GenDataObj::getId, record.getId()).set(GenDataObj::getName, data.getName()) + .set(GenDataObj::getMainTableAlias, data.getMainTableAlias()).set(GenDataObj::getCategoryId, + StringUtil.isBlank(data.getCategoryId()) ? null : data.getCategoryId()) + .set(GenDataObj::getDescription, + StringUtil.isBlank(data.getDescription()) ? StringPool.EMPTY_STR + : data.getDescription()).set(GenDataObj::getAvailable, data.getAvailable()); + this.update(updateWrapper); + + List queryDetails = genDataObjQueryDetailService.getByObjId( + record.getId()); + + Wrapper deleteDetailWrapper = Wrappers.lambdaQuery(GenDataObjDetail.class) + .eq(GenDataObjDetail::getDataObjId, record.getId()); + genDataObjDetailService.remove(deleteDetailWrapper); + + Wrapper deleteQueryDetailWrapper = Wrappers.lambdaQuery( + GenDataObjQueryDetail.class).eq(GenDataObjQueryDetail::getDataObjId, record.getId()); + genDataObjQueryDetailService.remove(deleteQueryDetailWrapper); + + int orderNo = 1; + if (!CollectionUtil.isEmpty(data.getColumns())) { + for (GenDataObjDetailVo column : data.getColumns()) { + GenDataObjDetail detail = new GenDataObjDetail(); + detail.setId(column.getId()); + detail.setDataObjId(record.getId()); + detail.setMainTableDetailIds( + CollectionUtil.join(column.getMainTableDetailIds(), StringPool.STR_SPLIT)); + detail.setRelaType(EnumUtil.getByCode(GenRelaType.class, column.getRelaType())); + detail.setRelaMode(EnumUtil.getByCode(GenRelaMode.class, column.getRelaMode())); + detail.setSubTableId(column.getSubTableId()); + detail.setSubTableAlias(column.getSubTableAlias()); + detail.setSubTableDetailIds( + CollectionUtil.join(column.getSubTableDetailIds(), StringPool.STR_SPLIT)); + detail.setOrderNo(orderNo); + + genDataObjDetailService.save(detail); + + orderNo++; + } + } + + List newQueryDetailIds = new ArrayList<>(); + if (!CollectionUtil.isEmpty(data.getQueryColumns())) { + orderNo = 1; + for (GenDataObjQueryDetailVo queryColumn : data.getQueryColumns()) { + GenDataObjQueryDetail detail = new GenDataObjQueryDetail(); + detail.setId(queryColumn.getId()); + detail.setDataObjId(record.getId()); + detail.setCustomName(queryColumn.getCustomName()); + detail.setCustomSql(queryColumn.getCustomSql()); + detail.setCustomAlias(queryColumn.getCustomAlias()); + detail.setDataType(EnumUtil.getByCode(GenDataType.class, queryColumn.getDataType())); + detail.setOrderNo(orderNo); + + genDataObjQueryDetailService.save(detail); + + orderNo++; + + newQueryDetailIds.add(detail.getId()); + } + } + + List deleteQueryDetailIds = queryDetails.stream().map(GenDataObjQueryDetail::getId) + .filter(t -> !newQueryDetailIds.contains(t)).collect( + Collectors.toList()); + + if (!CollectionUtil.isEmpty(deleteQueryDetailIds)) { + for (String deleteDetailId : deleteQueryDetailIds) { + DataObjQueryDetailDeleteEvent event = new DataObjQueryDetailDeleteEvent(this); + event.setId(deleteDetailId); + event.setName( + queryDetails.stream().filter(t -> t.getId().equals(deleteDetailId)).findFirst().get() + .getCustomName()); + + ApplicationUtil.publishEvent(event); + } + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(@NonNull String id) { + GenDataObj record = this.getById(id); + if (record == null) { + return; + } + + List details = genDataObjDetailService.getByObjId(id); + List queryDetails = genDataObjQueryDetailService.getByObjId(id); + + getBaseMapper().deleteById(id); + + genDataObjDetailService.deleteByObjId(id); + + genDataObjQueryDetailService.deleteByObjId(id); + + DataObjDeleteEvent event = new DataObjDeleteEvent(this); + event.setId(id); + event.setName(record.getName()); + event.setDetailIds(details.stream().map(GenDataObjDetail::getId).collect(Collectors.toList())); + event.setQueryDetailIds(queryDetails.stream().map(GenDataObjQueryDetail::getId).collect( + Collectors.toList())); + + ApplicationUtil.publishEvent(event); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchDelete(@NonNull List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + for (String id : ids) { + this.delete(id); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenDataObj.class) + .set(GenDataObj::getAvailable, Boolean.TRUE).in(GenDataObj::getId, ids); + getBaseMapper().update(wrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(List ids) { + if (CollectionUtil.isEmpty(ids)) { + return; + } + + Wrapper wrapper = Wrappers.lambdaUpdate(GenDataObj.class) + .set(GenDataObj::getAvailable, Boolean.FALSE).in(GenDataObj::getId, ids); + getBaseMapper().update(wrapper); + } + + @Override + public List getRelaGenDataEntityIds(String entityId) { + return getBaseMapper().getRelaGenDataEntityIds(entityId); + } + + @CacheEvict(value = {GenDataObj.CACHE_NAME, DataObjectQueryObj.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + ThreadUtil.execAsync(() -> { + GenCustomListService genCustomListService = ApplicationUtil.getBean(GenCustomListService.class); + List ids = genCustomListService.getRelaGenDataObjIds(String.valueOf(key)); + if (CollectionUtil.isNotEmpty(ids)) { + genCustomListService.cleanCacheByKeys(ids); + } + }); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDetailColumnConfigServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDetailColumnConfigServiceImpl.java new file mode 100644 index 0000000..49e92fe --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenDetailColumnConfigServiceImpl.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.dto.gen.GenDetailColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenDetailColumnConfig; +import com.lframework.xingyun.template.gen.mappers.GenDetailColumnConfigMapper; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenDetailColumnConfigService; +import com.lframework.xingyun.template.gen.vo.gen.UpdateDetailColumnConfigVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenDetailColumnConfigServiceImpl + extends BaseMpServiceImpl + implements GenDetailColumnConfigService { + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Override + public List getByDataEntityId(String entityId) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (CollectionUtil.isEmpty(columns)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateGenerate(String entityId, List vo) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (!CollectionUtil.isEmpty(columns)) { + getBaseMapper().deleteBatchIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + if (!CollectionUtil.isEmpty(vo)) { + int orderNo = 1; + for (UpdateDetailColumnConfigVo updateDetailColumnConfigVo : vo) { + GenDetailColumnConfig record = new GenDetailColumnConfig(); + record.setId(updateDetailColumnConfigVo.getId()); + record.setSpan(updateDetailColumnConfigVo.getSpan()); + record.setOrderNo(orderNo++); + + getBaseMapper().insert(record); + } + } + } + + @Override + public GenDetailColumnConfigDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + getBaseMapper().deleteById(id); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenQueryColumnConfigServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenQueryColumnConfigServiceImpl.java new file mode 100644 index 0000000..3701ee7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenQueryColumnConfigServiceImpl.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.dto.gen.GenQueryColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenQueryColumnConfig; +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; +import com.lframework.xingyun.template.gen.mappers.GenQueryColumnConfigMapper; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenQueryColumnConfigService; +import com.lframework.xingyun.template.gen.vo.gen.UpdateQueryColumnConfigVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.EnumUtil; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenQueryColumnConfigServiceImpl extends + BaseMpServiceImpl + implements GenQueryColumnConfigService { + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Override + public List getByDataEntityId(String entityId) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (CollectionUtil.isEmpty(columns)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateGenerate(String entityId, List vo) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (!CollectionUtil.isEmpty(columns)) { + getBaseMapper().deleteBatchIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + if (!CollectionUtil.isEmpty(vo)) { + int orderNo = 1; + for (UpdateQueryColumnConfigVo updateQueryColumnConfigVo : vo) { + GenQueryColumnConfig record = new GenQueryColumnConfig(); + record.setId(updateQueryColumnConfigVo.getId()); + record.setWidthType( + EnumUtil.getByCode(GenQueryWidthType.class, updateQueryColumnConfigVo.getWidthType())); + record.setWidth(updateQueryColumnConfigVo.getWidth()); + record.setSortable(updateQueryColumnConfigVo.getSortable()); + record.setOrderNo(orderNo++); + + getBaseMapper().insert(record); + } + } + } + + @Override + public GenQueryColumnConfigDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + getBaseMapper().deleteById(id); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenQueryParamsColumnConfigServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenQueryParamsColumnConfigServiceImpl.java new file mode 100644 index 0000000..9bd4593 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenQueryParamsColumnConfigServiceImpl.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.dto.gen.GenQueryParamsColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenQueryParamsColumnConfig; +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.xingyun.template.gen.mappers.GenQueryParamsColumnConfigMapper; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenQueryParamsColumnConfigService; +import com.lframework.xingyun.template.gen.vo.gen.UpdateQueryParamsColumnConfigVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.EnumUtil; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenQueryParamsColumnConfigServiceImpl + extends BaseMpServiceImpl + implements GenQueryParamsColumnConfigService { + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Override + public List getByDataEntityId(String entityId) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (CollectionUtil.isEmpty(columns)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateGenerate(String entityId, List vo) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (!CollectionUtil.isEmpty(columns)) { + getBaseMapper().deleteBatchIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + if (!CollectionUtil.isEmpty(vo)) { + int orderNo = 1; + for (UpdateQueryParamsColumnConfigVo updateQueryParamsColumnConfigVo : vo) { + GenQueryParamsColumnConfig record = new GenQueryParamsColumnConfig(); + record.setId(updateQueryParamsColumnConfigVo.getId()); + record.setQueryType( + EnumUtil.getByCode(GenQueryType.class, updateQueryParamsColumnConfigVo.getQueryType())); + record.setOrderNo(orderNo++); + + getBaseMapper().insert(record); + } + } + } + + @Override + public GenQueryParamsColumnConfigDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + getBaseMapper().deleteById(id); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenUpdateColumnConfigServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenUpdateColumnConfigServiceImpl.java new file mode 100644 index 0000000..975d9a6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenUpdateColumnConfigServiceImpl.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.gen.dto.gen.GenUpdateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.entity.GenUpdateColumnConfig; +import com.lframework.xingyun.template.gen.mappers.GenUpdateColumnConfigMapper; +import com.lframework.xingyun.template.gen.service.GenDataEntityDetailService; +import com.lframework.xingyun.template.gen.service.GenUpdateColumnConfigService; +import com.lframework.xingyun.template.gen.vo.gen.UpdateUpdateColumnConfigVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenUpdateColumnConfigServiceImpl + extends BaseMpServiceImpl + implements GenUpdateColumnConfigService { + + @Autowired + private GenDataEntityDetailService genDataEntityDetailService; + + @Override + public List getByDataEntityId(String entityId) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (CollectionUtil.isEmpty(columns)) { + return CollectionUtil.emptyList(); + } + + return getBaseMapper().getByIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateGenerate(String entityId, List vo) { + + List columns = genDataEntityDetailService.getByEntityId(entityId); + if (!CollectionUtil.isEmpty(columns)) { + getBaseMapper().deleteBatchIds( + columns.stream().map(GenDataEntityDetail::getId).collect(Collectors.toList())); + } + + if (!CollectionUtil.isEmpty(vo)) { + int orderNo = 1; + for (UpdateUpdateColumnConfigVo updateUpdateColumnConfigVo : vo) { + GenUpdateColumnConfig record = new GenUpdateColumnConfig(); + record.setId(updateUpdateColumnConfigVo.getId()); + record.setRequired(updateUpdateColumnConfigVo.getRequired()); + record.setOrderNo(orderNo++); + + getBaseMapper().insert(record); + } + } + } + + @Override + public GenUpdateColumnConfigDto findById(String id) { + + return getBaseMapper().findById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + getBaseMapper().deleteById(id); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenerateInfoServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenerateInfoServiceImpl.java new file mode 100644 index 0000000..2a0c56c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/GenerateInfoServiceImpl.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import com.lframework.xingyun.template.gen.entity.GenGenerateInfo; +import com.lframework.xingyun.template.gen.enums.GenKeyType; +import com.lframework.xingyun.template.gen.enums.GenTemplateType; +import com.lframework.xingyun.template.gen.mappers.GenGenerateInfoMapper; +import com.lframework.xingyun.template.gen.service.GenerateInfoService; +import com.lframework.xingyun.template.gen.vo.gen.UpdateGenerateInfoVo; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.EnumUtil; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class GenerateInfoServiceImpl extends + BaseMpServiceImpl + implements GenerateInfoService { + + @Override + public GenGenerateInfoDto getByEntityId(String entityId) { + + return getBaseMapper().getByDataObjId(entityId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateGenerate(String dataObjId, UpdateGenerateInfoVo vo) { + + GenGenerateInfo data = getBaseMapper().selectById(dataObjId); + if (data != null) { + getBaseMapper().deleteById(data.getId()); + } else { + data = new GenGenerateInfo(); + } + data.setId(dataObjId); + data.setTemplateType(EnumUtil.getByCode(GenTemplateType.class, vo.getTemplateType())); + data.setPackageName(vo.getPackageName()); + data.setModuleName(vo.getModuleName()); + data.setBizName(vo.getBizName()); + data.setClassName(vo.getClassName()); + data.setClassDescription(vo.getClassDescription()); + if (!StringUtil.isBlank(vo.getParentMenuId())) { + data.setParentMenuId(vo.getParentMenuId()); + } + data.setKeyType(EnumUtil.getByCode(GenKeyType.class, vo.getKeyType())); + + if (!StringUtil.isBlank(vo.getAuthor())) { + data.setAuthor(vo.getAuthor()); + } + data.setMenuCode(vo.getMenuCode()); + data.setMenuName(vo.getMenuName()); + data.setDetailSpan(vo.getDetailSpan()); + data.setIsCache(vo.getIsCache()); + data.setHasDelete(vo.getHasDelete()); + + getBaseMapper().insert(data); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteByEntityId(String entityId) { + + getBaseMapper().deleteById(entityId); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/SimpleDBServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/SimpleDBServiceImpl.java new file mode 100644 index 0000000..7f2b4ae --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/SimpleDBServiceImpl.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.xingyun.template.gen.mappers.DBMapper; +import com.lframework.xingyun.template.gen.mappers.SimpleDBMapper; +import com.lframework.xingyun.template.gen.service.SimpleDBService; +import com.lframework.xingyun.template.gen.service.SimpleTableColumnService; +import com.lframework.xingyun.template.gen.vo.simpledb.QuerySimpleTableColumnVo; +import com.lframework.xingyun.template.gen.vo.simpledb.SimpleTableSelectorVo; +import com.lframework.xingyun.template.gen.dto.simpledb.OriSimpleTableDto; +import com.lframework.xingyun.template.gen.dto.simpledb.SimpleDBDto; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SimpleDBServiceImpl implements SimpleDBService { + + @Autowired + private SimpleDBMapper simpleDBMapper; + + @Autowired + private DBMapper dbMapper; + + @Autowired + private SimpleTableColumnService simpleTableColumnService; + + @Override + public String getCurrentDBName() { + return dbMapper.getCurrentDBName(); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SimpleTableSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = simpleDBMapper.selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public OriSimpleTableDto getByTableName(String tableName) { + OriSimpleTableDto table = simpleDBMapper.getByTableName(tableName); + if (ObjectUtil.isNull(table)) { + return table; + } + + QuerySimpleTableColumnVo queryVo = new QuerySimpleTableColumnVo(); + queryVo.setTableName(tableName); + + List columns = simpleTableColumnService.query(queryVo); + table.setColumns(columns); + + return table; + } + + @Override + public List listByIds(List tableNames) { + return simpleDBMapper.listByIds(tableNames); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/SimpleTableColumnServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/SimpleTableColumnServiceImpl.java new file mode 100644 index 0000000..af9876d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/impl/SimpleTableColumnServiceImpl.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.template.gen.impl; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.xingyun.template.gen.mappers.GenSimpleTableColumnMapper; +import com.lframework.xingyun.template.gen.service.SimpleDBService; +import com.lframework.xingyun.template.gen.service.SimpleTableColumnService; +import com.lframework.xingyun.template.gen.vo.simpledb.QuerySimpleTableColumnVo; +import com.lframework.xingyun.template.gen.dto.simpledb.OriSimpleTableColumnDto; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SimpleTableColumnServiceImpl extends + BaseMpServiceImpl + implements SimpleTableColumnService { + + @Autowired + private SimpleDBService simpleDBService; + + @Override + public List query(QuerySimpleTableColumnVo vo) { + if (StringUtil.isBlank(vo.getTableSchema())) { + vo.setTableSchema(simpleDBService.getCurrentDBName()); + } + List columns = getBaseMapper().query(vo); + if (!CollectionUtil.isEmpty(columns)) { + + return columns.stream().map(t -> { + GenSimpleTableColumn column = new GenSimpleTableColumn(); + column.setId(IdUtil.getId()); + column.setColumnName(t.getColumnName()); + column.setIsNullable(t.getIsNullable()); + column.setIsKey(t.getIsKey()); + column.setColumnDefault(t.getColumnDefault()); + column.setOrdinalPosition(t.getOrdinalPosition()); + column.setColumnComment(t.getColumnComment()); + column.setDataType(t.getDataType().getDataType()); + column.setLen(t.getLen()); + column.setDecimals(t.getDecimals()); + + return column; + }).collect(Collectors.toList()); + } + + return null; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/CreateColumnConfigListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/CreateColumnConfigListener.java new file mode 100644 index 0000000..7dfaab3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/CreateColumnConfigListener.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenCreateColumnConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class CreateColumnConfigListener { + + @Component + public static class DeleteEntityListener implements ApplicationListener { + + @Autowired + private GenCreateColumnConfigService genCreateColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDeleteEvent event) { + + for (String columnId : event.getColumnIds()) { + genCreateColumnConfigService.deleteById(columnId); + } + } + } + + @Component + public static class DeleteEntityDetailListener implements + ApplicationListener { + + @Autowired + private GenCreateColumnConfigService genCreateColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDetailDeleteEvent event) { + + genCreateColumnConfigService.deleteById(event.getId()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/DetailColumnConfigListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/DetailColumnConfigListener.java new file mode 100644 index 0000000..56ac627 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/DetailColumnConfigListener.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenDetailColumnConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class DetailColumnConfigListener { + + @Component + public static class DeleteEntityListener implements ApplicationListener { + + @Autowired + private GenDetailColumnConfigService genDetailColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDeleteEvent event) { + + for (String columnId : event.getColumnIds()) { + genDetailColumnConfigService.deleteById(columnId); + } + } + } + + @Component + public static class DeleteEntityDetailListener implements + ApplicationListener { + + @Autowired + private GenDetailColumnConfigService genDetailColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDetailDeleteEvent event) { + + genDetailColumnConfigService.deleteById(event.getId()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenCustomListListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenCustomListListener.java new file mode 100644 index 0000000..ff5be83 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenCustomListListener.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.entity.GenCustomListDetail; +import com.lframework.xingyun.template.gen.entity.GenCustomListQueryParams; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataObjDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataObjQueryDetailDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenCustomListDetailService; +import com.lframework.xingyun.template.gen.service.GenCustomListQueryParamsService; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class GenCustomListListener { + + @Component + public static class DataObjDeleteListener implements ApplicationListener { + + @Autowired + private GenCustomListService genCustomListService; + + @Override + public void onApplicationEvent(DataObjDeleteEvent event) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenCustomList.class) + .eq(GenCustomList::getDataObjId, event.getId()); + if (genCustomListService.count(queryWrapper) > 0) { + throw new DefaultClientException("数据对象【" + event.getName() + "】已关联自定义列表,无法删除!"); + } + } + } + + @Component + public static class DataEntityDetailDeleteListener implements + ApplicationListener { + + @Autowired + private GenCustomListDetailService genCustomListDetailService; + + @Autowired + private GenCustomListQueryParamsService genCustomListQueryParamsService; + + @Override + public void onApplicationEvent(DataEntityDetailDeleteEvent event) { + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + GenCustomListDetail.class).eq(GenCustomListDetail::getDataEntityId, event.getId()); + if (genCustomListDetailService.count(queryDetailWrapper) > 0) { + throw new DefaultClientException("字段【" + event.getName() + "】已关联自定义列表,无法删除!"); + } + + Wrapper queryQueryDetailWrapper = Wrappers.lambdaQuery( + GenCustomListQueryParams.class).eq(GenCustomListQueryParams::getRelaId, event.getId()); + if (genCustomListQueryParamsService.count(queryQueryDetailWrapper) > 0) { + throw new DefaultClientException("字段【" + event.getName() + "】已关联自定义列表,无法删除!"); + } + } + } + + @Component + public static class DataObjQueryDetailDeleteListener implements + ApplicationListener { + + @Autowired + private GenCustomListDetailService genCustomListDetailService; + + @Autowired + private GenCustomListQueryParamsService genCustomListQueryParamsService; + + @Override + public void onApplicationEvent(DataObjQueryDetailDeleteEvent event) { + Wrapper queryDetailWrapper = Wrappers.lambdaQuery( + GenCustomListDetail.class).eq(GenCustomListDetail::getDataEntityId, event.getId()); + if (genCustomListDetailService.count(queryDetailWrapper) > 0) { + throw new DefaultClientException("字段【" + event.getName() + "】已关联自定义列表,无法删除!"); + } + + Wrapper queryQueryDetailWrapper = Wrappers.lambdaQuery( + GenCustomListQueryParams.class).eq(GenCustomListQueryParams::getRelaId, event.getId()); + if (genCustomListQueryParamsService.count(queryQueryDetailWrapper) > 0) { + throw new DefaultClientException("字段【" + event.getName() + "】已关联自定义列表,无法删除!"); + } + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenCustomSelectorListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenCustomSelectorListener.java new file mode 100644 index 0000000..bfcd1a1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenCustomSelectorListener.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.events.CustomListDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenCustomSelectorService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class GenCustomSelectorListener { + + @Component + public static class CustomListDeleteListener implements + ApplicationListener { + + @Autowired + private GenCustomSelectorService genCustomSelectorService; + + @Override + public void onApplicationEvent(CustomListDeleteEvent event) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenCustomSelector.class) + .eq(GenCustomSelector::getCustomListId, event.getId()); + if (genCustomSelectorService.count(queryWrapper) > 0) { + throw new DefaultClientException("自定义列表【" + event.getName() + "】已关联自定义选择器,无法删除!"); + } + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenDataObjListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenDataObjListener.java new file mode 100644 index 0000000..20f5913 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenDataObjListener.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenDataObjDetailService; +import com.lframework.xingyun.template.gen.service.GenDataObjService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class GenDataObjListener { + + @Component + public static class DataEntityDeleteListener implements + ApplicationListener { + + @Autowired + private GenDataObjService genDataObjService; + + @Autowired + private GenDataObjDetailService genDataObjDetailService; + + @Override + public void onApplicationEvent(DataEntityDeleteEvent event) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(GenDataObj.class) + .eq(GenDataObj::getMainTableId, event.getId()); + if (genDataObjService.count(queryWrapper) > 0) { + throw new DefaultClientException("数据实体【" + event.getName() + "】已关联数据对象,无法删除!"); + } + + Wrapper queryDetailWrapper = Wrappers.lambdaQuery(GenDataObjDetail.class) + .eq(GenDataObjDetail::getSubTableId, event.getId()); + if (genDataObjDetailService.count(queryDetailWrapper) > 0) { + throw new DefaultClientException("数据实体【" + event.getName() + "】已关联数据对象,无法删除!"); + } + } + } + + @Component + public static class DataEntityDetailDeleteListener implements + ApplicationListener { + + @Autowired + private GenDataObjDetailService genDataObjDetailService; + + @Override + public void onApplicationEvent(DataEntityDetailDeleteEvent event) { + if (genDataObjDetailService.entityDetailIsRela(event.getId())) { + throw new DefaultClientException("字段【" + event.getName() + "】已关联数据对象,无法删除!"); + } + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenTenantListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenTenantListener.java new file mode 100644 index 0000000..02961fb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenTenantListener.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties; +import com.lframework.starter.web.utils.DataSourceUtil; +import com.lframework.starter.web.common.event.ReloadTenantEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.ssssssss.magicapi.datasource.model.MagicDynamicDataSource; + +public class GenTenantListener { + + @Component + public static class ReloadTenantListener implements ApplicationListener, + Ordered { + + @Autowired + private MagicDynamicDataSource magicDynamicDataSource; + + @Autowired + private DynamicDataSourceProperties dynamicDataSourceProperties; + + @Override + public void onApplicationEvent(ReloadTenantEvent event) { + DataSourceProperty dataSourceProperty = dynamicDataSourceProperties.getDatasource() + .get("master"); + magicDynamicDataSource.add(String.valueOf(event.getTenantId()), + DataSourceUtil.createDataSource(dataSourceProperty, event.getJdbcUrl(), + event.getJdbcUsername(), event.getJdbcPassword(), event.getDriver())); + } + + @Override + public int getOrder() { + return Integer.MAX_VALUE; + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenerateInfoListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenerateInfoListener.java new file mode 100644 index 0000000..25ab065 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/GenerateInfoListener.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenerateInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class GenerateInfoListener { + + @Component + public static class DeleteEntityListener implements ApplicationListener { + + @Autowired + private GenerateInfoService generateInfoService; + + @Override + public void onApplicationEvent(DataEntityDeleteEvent event) { + + generateInfoService.deleteByEntityId(event.getId()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/QueryColumnConfigListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/QueryColumnConfigListener.java new file mode 100644 index 0000000..e4814ab --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/QueryColumnConfigListener.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenQueryColumnConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class QueryColumnConfigListener { + + @Component + public static class DeleteEntityListener implements ApplicationListener { + + @Autowired + private GenQueryColumnConfigService genQueryColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDeleteEvent event) { + + for (String columnId : event.getColumnIds()) { + genQueryColumnConfigService.deleteById(columnId); + } + } + } + + @Component + public static class DeleteEntityDetailListener implements + ApplicationListener { + + @Autowired + private GenQueryColumnConfigService genQueryColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDetailDeleteEvent event) { + + genQueryColumnConfigService.deleteById(event.getId()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/QueryParamsColumnConfigListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/QueryParamsColumnConfigListener.java new file mode 100644 index 0000000..04c7e60 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/QueryParamsColumnConfigListener.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenQueryParamsColumnConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class QueryParamsColumnConfigListener { + + @Component + public static class DeleteEntityListener implements ApplicationListener { + + @Autowired + private GenQueryParamsColumnConfigService genQueryParamsColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDeleteEvent event) { + + for (String columnId : event.getColumnIds()) { + genQueryParamsColumnConfigService.deleteById(columnId); + } + } + } + + @Component + public static class DeleteEntityDetailListener implements + ApplicationListener { + + @Autowired + private GenQueryParamsColumnConfigService genQueryParamsColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDetailDeleteEvent event) { + + genQueryParamsColumnConfigService.deleteById(event.getId()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/UpdateColumnConfigListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/UpdateColumnConfigListener.java new file mode 100644 index 0000000..ceb130d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/listeners/UpdateColumnConfigListener.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.listeners; + +import com.lframework.xingyun.template.gen.events.DataEntityDeleteEvent; +import com.lframework.xingyun.template.gen.events.DataEntityDetailDeleteEvent; +import com.lframework.xingyun.template.gen.service.GenUpdateColumnConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +public class UpdateColumnConfigListener { + + @Component + public static class DeleteEntityListener implements ApplicationListener { + + @Autowired + private GenUpdateColumnConfigService genUpdateColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDeleteEvent event) { + + for (String columnId : event.getColumnIds()) { + genUpdateColumnConfigService.deleteById(columnId); + } + } + } + + @Component + public static class DeleteEntityDetailListener implements + ApplicationListener { + + @Autowired + private GenUpdateColumnConfigService genUpdateColumnConfigService; + + @Override + public void onApplicationEvent(DataEntityDetailDeleteEvent event) { + + genUpdateColumnConfigService.deleteById(event.getId()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/DBMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/DBMapper.java new file mode 100644 index 0000000..dd80222 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/DBMapper.java @@ -0,0 +1,13 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; + +public interface DBMapper extends BaseMapper { + + /** + * 查询当前数据库名称 + * + * @return + */ + String getCurrentDBName(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCreateColumnConfigMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCreateColumnConfigMapper.java new file mode 100644 index 0000000..e9ba07a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCreateColumnConfigMapper.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.gen.dto.gen.GenCreateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenCreateColumnConfig; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-10 + */ +public interface GenCreateColumnConfigMapper extends BaseMapper { + + /** + * 根据数据对象ID查询 + * + * @param ids + * @return + */ + List getByIds(@Param("ids") List ids); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCreateColumnConfigDto findById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListCategoryMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListCategoryMapper.java new file mode 100644 index 0000000..1a6afd6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListCategoryMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.vo.custom.list.category.GenCustomListCategorySelectorVo; +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 自定义列表分类 Mapper 接口 + *

+ * + * @author zmj + */ +public interface GenCustomListCategoryMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + List query(); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenCustomListCategorySelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListDetailMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListDetailMapper.java new file mode 100644 index 0000000..9b62031 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListDetailMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenCustomListDetail; +import com.lframework.starter.web.mapper.BaseMapper; + +public interface GenCustomListDetailMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListHandleColumnMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListHandleColumnMapper.java new file mode 100644 index 0000000..e3ed9f8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListHandleColumnMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenCustomListHandleColumn; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface GenCustomListHandleColumnMapper extends BaseMapper { + + /** + * 根据自定义列表ID查询 + * + * @param customListId + * @return + */ + List getByCustomListId(@Param("customListId") String customListId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListMapper.java new file mode 100644 index 0000000..54ab1d8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListMapper.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.list.QueryGenCustomListVo; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 自定义列表 Mapper 接口 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +public interface GenCustomListMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryGenCustomListVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenCustomListSelectorVo vo); + + /** + * 查询所有关联了数据对象的自定义列表ID + * + * @param objId + * @return + */ + List getRelaGenDataObjIds(@Param("objId") String objId); + + /** + * 查询所有关联了数据实体的自定义列表ID + * + * @param entityId + * @return + */ + List getRelaGenDataEntityIds(@Param("entityId") String entityId); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListQueryParamsMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListQueryParamsMapper.java new file mode 100644 index 0000000..b0e9a68 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListQueryParamsMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenCustomListQueryParams; +import com.lframework.starter.web.mapper.BaseMapper; + +public interface GenCustomListQueryParamsMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListToolbarMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListToolbarMapper.java new file mode 100644 index 0000000..baaed27 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomListToolbarMapper.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenCustomListToolbar; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface GenCustomListToolbarMapper extends BaseMapper { + + /** + * 根据自定义列表ID查询 + * + * @param customListId + * @return + */ + List getByCustomListId(@Param("customListId") String customListId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomPageCategoryMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomPageCategoryMapper.java new file mode 100644 index 0000000..68546bf --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomPageCategoryMapper.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; + +/** + *

+ * 自定义页面分类 Mapper 接口 + *

+ * + * @author zmj + */ +public interface GenCustomPageCategoryMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + List query(); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomPageMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomPageMapper.java new file mode 100644 index 0000000..e980df9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomPageMapper.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.xingyun.template.gen.vo.custom.page.GenCustomPageSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.page.QueryGenCustomPageVo; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 自定义页面 Mapper 接口 + *

+ * + * @author zmj + * @since 2023-06-20 + */ +public interface GenCustomPageMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryGenCustomPageVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenCustomPageSelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomSelectorCategoryMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomSelectorCategoryMapper.java new file mode 100644 index 0000000..c97fb1f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomSelectorCategoryMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.vo.custom.selector.category.GenCustomSelectorCategorySelectorVo; +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 自定义选择器分类 Mapper 接口 + *

+ * + * @author zmj + */ +public interface GenCustomSelectorCategoryMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + List query(); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenCustomSelectorCategorySelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomSelectorMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomSelectorMapper.java new file mode 100644 index 0000000..6a159ba --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenCustomSelectorMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.vo.custom.selector.GenCustomSelectorSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.QueryGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 自定义选择器 Mapper 接口 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +public interface GenCustomSelectorMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryGenCustomSelectorVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenCustomSelectorSelectorVo vo); + + /** + * 查询所有关联了自定义列表的自定义选择器ID + * + * @return + */ + List getRelaGenCustomListIds(@Param("customListId") String customListId); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityCategoryMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityCategoryMapper.java new file mode 100644 index 0000000..144de34 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityCategoryMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.vo.data.entity.category.GenDataEntityCategorySelectorVo; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据实体分类 Mapper 接口 + *

+ * + * @author zmj + */ +public interface GenDataEntityCategoryMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + List query(); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenDataEntityCategorySelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityDetailMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityDetailMapper.java new file mode 100644 index 0000000..3a1afc2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.starter.web.mapper.BaseMapper; + +/** + *

+ * 数据实体明细 Mapper 接口 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +public interface GenDataEntityDetailMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityMapper.java new file mode 100644 index 0000000..971d5b2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataEntityMapper.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntitySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.QueryDataEntityVo; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据实体 Mapper 接口 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +public interface GenDataEntityMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryDataEntityVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenDataEntitySelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjCategoryMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjCategoryMapper.java new file mode 100644 index 0000000..78f67e6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjCategoryMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.vo.data.obj.category.GenDataObjCategorySelectorVo; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据对象分类 Mapper 接口 + *

+ * + * @author zmj + */ +public interface GenDataObjCategoryMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + List query(); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenDataObjCategorySelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjDetailMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjDetailMapper.java new file mode 100644 index 0000000..5b4b808 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjDetailMapper.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.starter.web.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据对象明细 Mapper 接口 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +public interface GenDataObjDetailMapper extends BaseMapper { + + /** + * 实体明细ID是否已关联数据对象 + * + * @param entityDetailId + * @return + */ + Boolean entityDetailIsRela(@Param("entityDetailId") String entityDetailId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjMapper.java new file mode 100644 index 0000000..e54c3f0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjMapper.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.vo.data.obj.GenDataObjSelectorVo; +import com.lframework.xingyun.template.gen.vo.data.obj.QueryGenDataObjVo; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据对象 Mapper 接口 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +public interface GenDataObjMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryGenDataObjVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") GenDataObjSelectorVo vo); + + /** + * 查询所有关联了数据实体的数据对象ID + * @param entityId + * @return + */ + List getRelaGenDataEntityIds(@Param("entityId") String entityId); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjQueryDetailMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjQueryDetailMapper.java new file mode 100644 index 0000000..5ad5892 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDataObjQueryDetailMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.starter.web.mapper.BaseMapper; + +/** + *

+ * 数据对象自定义查询明细 Mapper 接口 + *

+ * + * @author zmj + * @since 2022-09-17 + */ +public interface GenDataObjQueryDetailMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDetailColumnConfigMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDetailColumnConfigMapper.java new file mode 100644 index 0000000..fc1fd24 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenDetailColumnConfigMapper.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.dto.gen.GenDetailColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDetailColumnConfig; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-10 + */ +public interface GenDetailColumnConfigMapper extends BaseMapper { + + /** + * 根据数据对象ID查询 + * + * @param ids + * @return + */ + List getByIds(@Param("ids") List ids); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenDetailColumnConfigDto findById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenGenerateInfoMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenGenerateInfoMapper.java new file mode 100644 index 0000000..4e091b2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenGenerateInfoMapper.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import com.lframework.xingyun.template.gen.entity.GenGenerateInfo; +import com.lframework.starter.web.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-08 + */ +public interface GenGenerateInfoMapper extends BaseMapper { + + /** + * 根据数据对象ID查询 + * + * @param dataObjId + * @return + */ + GenGenerateInfoDto getByDataObjId(String dataObjId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenMapper.java new file mode 100644 index 0000000..bed9fd1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenMapper.java @@ -0,0 +1,11 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.components.data.obj.DataObjectQueryObj; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.annotations.Param; + +public interface GenMapper { + + List> findList(@Param("obj") DataObjectQueryObj obj); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenQueryColumnConfigMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenQueryColumnConfigMapper.java new file mode 100644 index 0000000..5480363 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenQueryColumnConfigMapper.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.dto.gen.GenQueryColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenQueryColumnConfig; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-10 + */ +public interface GenQueryColumnConfigMapper extends BaseMapper { + + /** + * 根据数据对象ID查询 + * + * @param ids + * @return + */ + List getByIds(@Param("ids") List ids); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenQueryColumnConfigDto findById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenQueryParamsColumnConfigMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenQueryParamsColumnConfigMapper.java new file mode 100644 index 0000000..2d9f30e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenQueryParamsColumnConfigMapper.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.dto.gen.GenQueryParamsColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenQueryParamsColumnConfig; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-10 + */ +public interface GenQueryParamsColumnConfigMapper extends BaseMapper { + + /** + * 根据数据对象ID查询 + * + * @param ids + * @return + */ + List getByIds(@Param("ids") List ids); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenQueryParamsColumnConfigDto findById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenSimpleTableColumnMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenSimpleTableColumnMapper.java new file mode 100644 index 0000000..5aad67b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenSimpleTableColumnMapper.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.vo.simpledb.QuerySimpleTableColumnVo; +import com.lframework.xingyun.template.gen.dto.simpledb.OriSimpleTableColumnDto; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-05-28 + */ +public interface GenSimpleTableColumnMapper extends BaseMapper { + + /** + * 根据创建Vo查询 + * + * @param vo + * @return + */ + List query(QuerySimpleTableColumnVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenSimpleTableMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenSimpleTableMapper.java new file mode 100644 index 0000000..e118002 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenSimpleTableMapper.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.dto.simpledb.SimpleTableDto; +import com.lframework.xingyun.template.gen.entity.GenSimpleTable; +import com.lframework.starter.web.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-05-28 + */ +public interface GenSimpleTableMapper extends BaseMapper { + + /** + * 根据数据实体ID查询 + * + * @param id + * @return + */ + SimpleTableDto getByEntityId(@Param("id") String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenUpdateColumnConfigMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenUpdateColumnConfigMapper.java new file mode 100644 index 0000000..8f65be5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/GenUpdateColumnConfigMapper.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.dto.gen.GenUpdateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenUpdateColumnConfig; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-12-10 + */ +public interface GenUpdateColumnConfigMapper extends BaseMapper { + + /** + * 根据数据对象ID查询 + * + * @param ids + * @return + */ + List getByIds(@Param("ids") List ids); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenUpdateColumnConfigDto findById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/SimpleDBMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/SimpleDBMapper.java new file mode 100644 index 0000000..f86f4be --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/mappers/SimpleDBMapper.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.mappers; + +import com.lframework.xingyun.template.gen.vo.simpledb.SimpleTableSelectorVo; +import com.lframework.xingyun.template.gen.dto.simpledb.OriSimpleTableDto; +import com.lframework.xingyun.template.gen.dto.simpledb.SimpleDBDto; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SimpleDBMapper extends BaseMapper { + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(SimpleTableSelectorVo vo); + + /** + * 根据TableName查询 + * + * @param tableName + * @return + */ + OriSimpleTableDto getByTableName(@Param("tableName") String tableName); + + /** + * 批量查询 + * + * @param tableNames + * @return + */ + List listByIds(@Param("tableNames") List tableNames); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCreateColumnConfigService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCreateColumnConfigService.java new file mode 100644 index 0000000..941f53b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCreateColumnConfigService.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.dto.gen.GenCreateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenCreateColumnConfig; +import com.lframework.xingyun.template.gen.vo.gen.UpdateCreateColumnConfigVo; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCreateColumnConfigService extends BaseMpService { + + /** + * 根据数据实体ID查询 + * + * @param entityId + * @return + */ + List getByDataEntityId(String entityId); + + /** + * 修改生成器配置信息 + * + * @param vo + */ + void updateGenerate(String entityId, List vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCreateColumnConfigDto findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListCategoryService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListCategoryService.java new file mode 100644 index 0000000..da5203b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListCategoryService.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomListCategory; +import com.lframework.xingyun.template.gen.vo.custom.list.category.CreateGenCustomListCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.list.category.GenCustomListCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.list.category.UpdateGenCustomListCategoryVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +/** + * 自定义列表分类 Service + * + * @author zmj + */ +public interface GenCustomListCategoryService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + List queryList(); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomListCategorySelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCustomListCategory findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateGenCustomListCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateGenCustomListCategoryVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListDetailService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListDetailService.java new file mode 100644 index 0000000..ccb267a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListDetailService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomListDetail; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCustomListDetailService extends BaseMpService { + + /** + * 根据自定义列表ID查询 + * @param customListId + * @return + */ + List getByCustomListId(String customListId); + + /** + * 根据自定义列表ID删除 + * @param customListId + */ + void deleteByCustomListId(String customListId); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListHandleColumnService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListHandleColumnService.java new file mode 100644 index 0000000..da89da2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListHandleColumnService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomListHandleColumn; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCustomListHandleColumnService extends + BaseMpService { + + /** + * 根据自定义列表ID查询 + * + * @param customListId + * @return + */ + List getByCustomListId(String customListId); + + /** + * 根据自定义列表ID删除 + * + * @param customListId + */ + void deleteByCustomListId(String customListId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListQueryParamsService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListQueryParamsService.java new file mode 100644 index 0000000..c6fe6b6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListQueryParamsService.java @@ -0,0 +1,22 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomListQueryParams; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCustomListQueryParamsService extends BaseMpService { + + /** + * 根据自定义列表ID查询 + * @param customListId + * @return + */ + List getByCustomListId(String customListId); + + /** + * 根据自定义列表ID删除 + * @param customListId + */ + void deleteByCustomListId(String customListId); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListService.java new file mode 100644 index 0000000..1a9ccab --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListService.java @@ -0,0 +1,103 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.vo.custom.list.CreateGenCustomListVo; +import com.lframework.xingyun.template.gen.vo.custom.list.GenCustomListSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.list.QueryGenCustomListVo; +import com.lframework.xingyun.template.gen.vo.custom.list.UpdateGenCustomListVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCustomListService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryGenCustomListVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryGenCustomListVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomListSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCustomList findById(String id); + + /** + * 新增 + * + * @param data + * @return + */ + String create(CreateGenCustomListVo data); + + /** + * 修改 + * + * @param data + */ + void update(UpdateGenCustomListVo data); + + /** + * 根据ID删除 + * @param id + */ + void delete(String id); + + /** + * 批量删除 + * @param ids + */ + void batchDelete(List ids); + + /** + * 批量启用 + * + * @param ids + */ + void batchEnable(List ids); + + /** + * 批量停用 + * + * @param ids + */ + void batchUnable(List ids); + + /** + * 查询所有关联了数据对象的自定义列表ID + * @return + */ + List getRelaGenDataObjIds(String objId); + + /** + * 查询所有关联了数据实体的自定义列表ID + * @return + */ + List getRelaGenDataEntityIds(String entityId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListToolbarService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListToolbarService.java new file mode 100644 index 0000000..4bf4f0e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomListToolbarService.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomListToolbar; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCustomListToolbarService extends BaseMpService { + + /** + * 根据自定义列表ID查询 + * + * @param customListId + * @return + */ + List getByCustomListId(String customListId); + + /** + * 根据自定义列表ID删除 + * + * @param customListId + */ + void deleteByCustomListId(String customListId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomPageCategoryService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomPageCategoryService.java new file mode 100644 index 0000000..08423cf --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomPageCategoryService.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.vo.custom.page.category.CreateGenCustomPageCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.page.category.UpdateGenCustomPageCategoryVo; +import com.lframework.xingyun.template.gen.entity.GenCustomPageCategory; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +/** + * 自定义页面分类 Service + * + * @author zmj + */ +public interface GenCustomPageCategoryService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + List queryList(); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCustomPageCategory findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateGenCustomPageCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateGenCustomPageCategoryVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomPageService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomPageService.java new file mode 100644 index 0000000..7a6ac1f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomPageService.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.vo.custom.page.CreateGenCustomPageVo; +import com.lframework.xingyun.template.gen.vo.custom.page.GenCustomPageSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.page.QueryGenCustomPageVo; +import com.lframework.xingyun.template.gen.vo.custom.page.UpdateGenCustomPageVo; +import com.lframework.xingyun.template.gen.entity.GenCustomPage; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCustomPageService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryGenCustomPageVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryGenCustomPageVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomPageSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCustomPage findById(Integer id); + + /** + * 新增 + * + * @param data + * @return + */ + Integer create(CreateGenCustomPageVo data); + + /** + * 修改 + * + * @param data + */ + void update(UpdateGenCustomPageVo data); + + /** + * 根据ID删除 + * + * @param id + */ + void delete(Integer id); + + /** + * 批量删除 + * + * @param ids + */ + void batchDelete(List ids); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomSelectorCategoryService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomSelectorCategoryService.java new file mode 100644 index 0000000..c87bd43 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomSelectorCategoryService.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomSelectorCategory; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.CreateGenCustomSelectorCategoryVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.GenCustomSelectorCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.category.UpdateGenCustomSelectorCategoryVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +/** + * 自定义选择器分类 Service + * + * @author zmj + */ +public interface GenCustomSelectorCategoryService extends + BaseMpService { + + /** + * 查询列表 + * + * @return + */ + List queryList(); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomSelectorCategorySelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCustomSelectorCategory findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateGenCustomSelectorCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateGenCustomSelectorCategoryVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomSelectorService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomSelectorService.java new file mode 100644 index 0000000..88f5185 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenCustomSelectorService.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenCustomSelector; +import com.lframework.xingyun.template.gen.vo.custom.selector.CreateGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.GenCustomSelectorSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.QueryGenCustomSelectorVo; +import com.lframework.xingyun.template.gen.vo.custom.selector.UpdateGenCustomSelectorVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenCustomSelectorService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QueryGenCustomSelectorVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryGenCustomSelectorVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenCustomSelectorSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenCustomSelector findById(String id); + + /** + * 新增 + * + * @param data + * @return + */ + String create(CreateGenCustomSelectorVo data); + + /** + * 修改 + * + * @param data + */ + void update(UpdateGenCustomSelectorVo data); + + /** + * 根据ID删除 + * + * @param id + */ + void delete(String id); + + /** + * 批量删除 + * + * @param ids + */ + void batchDelete(List ids); + + /** + * 批量启用 + * + * @param ids + */ + void batchEnable(List ids); + + /** + * 批量停用 + * + * @param ids + */ + void batchUnable(List ids); + + /** + * 查询所有关联了自定义列表的自定义选择器ID + * + * @return + */ + List getRelaGenCustomListIds(String customListId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityCategoryService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityCategoryService.java new file mode 100644 index 0000000..d94bbae --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityCategoryService.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityCategory; +import com.lframework.xingyun.template.gen.vo.data.entity.category.CreateGenDataEntityCategoryVo; +import com.lframework.xingyun.template.gen.vo.data.entity.category.GenDataEntityCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.category.UpdateGenDataEntityCategoryVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +/** + * 数据实体分类 Service + * + * @author zmj + */ +public interface GenDataEntityCategoryService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + List queryList(); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenDataEntityCategorySelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenDataEntityCategory findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateGenDataEntityCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateGenDataEntityCategoryVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityDetailService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityDetailService.java new file mode 100644 index 0000000..be288b9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityDetailService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenDataEntityDetail; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntityDetailSelectorVo; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenDataEntityDetailService extends BaseMpService { + + /** + * 根据实体ID查询 + * + * @param entityId + * @return + */ + List getByEntityId(String entityId); + + /** + * 根据实体ID删除 + * + * @param entityId + */ + void deleteByEntityId(String entityId); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(GenDataEntityDetailSelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityService.java new file mode 100644 index 0000000..6ed37be --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataEntityService.java @@ -0,0 +1,118 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.dto.data.entity.DataEntityGenerateDto; +import com.lframework.xingyun.template.gen.entity.GenDataEntity; +import com.lframework.xingyun.template.gen.vo.data.entity.CreateDataEntityVo; +import com.lframework.xingyun.template.gen.vo.data.entity.GenDataEntitySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.entity.QueryDataEntityVo; +import com.lframework.xingyun.template.gen.vo.data.entity.UpdateDataEntityGenerateVo; +import com.lframework.xingyun.template.gen.vo.data.entity.UpdateDataEntityVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenDataEntityService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryDataEntityVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryDataEntityVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenDataEntitySelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenDataEntity findById(String id); + + /** + * 创建 + * + * @param data + * @return + */ + String create(CreateDataEntityVo data); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateDataEntityVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void delete(String id); + + /** + * 根据ID批量删除 + * + * @param ids + */ + void batchDelete(List ids); + + /** + * 批量启用 + * + * @param ids + */ + void batchEnable(List ids); + + /** + * 批量停用 + * + * @param ids + */ + void batchUnable(List ids); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + DataEntityGenerateDto getGenerateById(String id); + + /** + * 修改生成器配置信息 + * + * @param vo + */ + void updateGenerate(UpdateDataEntityGenerateVo vo); + + /** + * 同步数据表 + * + * @param id + */ + void syncTable(String id); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjCategoryService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjCategoryService.java new file mode 100644 index 0000000..a7eda58 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjCategoryService.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenDataObjCategory; +import com.lframework.xingyun.template.gen.vo.data.obj.category.CreateGenDataObjCategoryVo; +import com.lframework.xingyun.template.gen.vo.data.obj.category.GenDataObjCategorySelectorVo; +import com.lframework.xingyun.template.gen.vo.data.obj.category.UpdateGenDataObjCategoryVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +/** + * 数据对象分类 Service + * + * @author zmj + */ +public interface GenDataObjCategoryService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + List queryList(); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + GenDataObjCategorySelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenDataObjCategory findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateGenDataObjCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateGenDataObjCategoryVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjDetailService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjDetailService.java new file mode 100644 index 0000000..ef87c7e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjDetailService.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenDataObjDetail; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenDataObjDetailService extends BaseMpService { + + /** + * 根据数据对象ID查询 + * + * @param objId + * @return + */ + List getByObjId(String objId); + + /** + * 根据数据对象ID删除 + * + * @param objId + */ + void deleteByObjId(String objId); + + /** + * 实体明细ID是否已关联数据对象 + * + * @param entityDetailId + * @return + */ + Boolean entityDetailIsRela(String entityDetailId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjQueryDetailService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjQueryDetailService.java new file mode 100644 index 0000000..f11fcdd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjQueryDetailService.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenDataObjQueryDetail; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenDataObjQueryDetailService extends BaseMpService { + + /** + * 根据数据对象ID查询 + * + * @param objId + * @return + */ + List getByObjId(String objId); + + /** + * 根据数据对象ID删除 + * + * @param objId + */ + void deleteByObjId(String objId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjService.java new file mode 100644 index 0000000..6c4d455 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDataObjService.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.entity.GenDataObj; +import com.lframework.xingyun.template.gen.vo.data.obj.CreateGenDataObjVo; +import com.lframework.xingyun.template.gen.vo.data.obj.GenDataObjSelectorVo; +import com.lframework.xingyun.template.gen.vo.data.obj.QueryGenDataObjVo; +import com.lframework.xingyun.template.gen.vo.data.obj.UpdateGenDataObjVo; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenDataObjService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryGenDataObjVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QueryGenDataObjVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, GenDataObjSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenDataObj findById(String id); + + /** + * 新增 + * + * @param data + * @return + */ + String create(CreateGenDataObjVo data); + + /** + * 修改 + * + * @param data + */ + void update(UpdateGenDataObjVo data); + + /** + * 根据ID删除 + * + * @param id + */ + void delete(String id); + + /** + * 根据ID批量删除 + * + * @param ids + */ + void batchDelete(List ids); + + /** + * 批量启用 + * + * @param ids + */ + void batchEnable(List ids); + + /** + * 批量停用 + * + * @param ids + */ + void batchUnable(List ids); + + /** + * 查询所有关联了数据实体的数据对象ID + * @return + */ + List getRelaGenDataEntityIds(String entityId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDetailColumnConfigService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDetailColumnConfigService.java new file mode 100644 index 0000000..b6d634d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenDetailColumnConfigService.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.dto.gen.GenDetailColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenDetailColumnConfig; +import com.lframework.xingyun.template.gen.vo.gen.UpdateDetailColumnConfigVo; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenDetailColumnConfigService extends BaseMpService { + + /** + * 根据数据实体ID查询 + * + * @param entityId + * @return + */ + List getByDataEntityId(String entityId); + + /** + * 修改生成器配置信息 + * + * @param vo + */ + void updateGenerate(String entityId, List vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenDetailColumnConfigDto findById(String id); + + /** + * 根据ID查询 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenQueryColumnConfigService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenQueryColumnConfigService.java new file mode 100644 index 0000000..0d17eca --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenQueryColumnConfigService.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.dto.gen.GenQueryColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenQueryColumnConfig; +import com.lframework.xingyun.template.gen.vo.gen.UpdateQueryColumnConfigVo; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenQueryColumnConfigService extends BaseMpService { + + /** + * 根据数据对象ID查询 + * + * @param entityId + * @return + */ + List getByDataEntityId(String entityId); + + /** + * 修改生成器配置信息 + * + * @param vo + */ + void updateGenerate(String entityId, List vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenQueryColumnConfigDto findById(String id); + + /** + * 根据ID查询 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenQueryParamsColumnConfigService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenQueryParamsColumnConfigService.java new file mode 100644 index 0000000..3cd6a18 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenQueryParamsColumnConfigService.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.dto.gen.GenQueryParamsColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenQueryParamsColumnConfig; +import com.lframework.xingyun.template.gen.vo.gen.UpdateQueryParamsColumnConfigVo; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenQueryParamsColumnConfigService extends + BaseMpService { + + /** + * 根据数据实体ID查询 + * + * @param entityId + * @return + */ + List getByDataEntityId(String entityId); + + /** + * 修改生成器配置信息 + * + * @param vo + */ + void updateGenerate(String entityId, List vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenQueryParamsColumnConfigDto findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenUpdateColumnConfigService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenUpdateColumnConfigService.java new file mode 100644 index 0000000..76aa98d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenUpdateColumnConfigService.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.dto.gen.GenUpdateColumnConfigDto; +import com.lframework.xingyun.template.gen.entity.GenUpdateColumnConfig; +import com.lframework.xingyun.template.gen.vo.gen.UpdateUpdateColumnConfigVo; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface GenUpdateColumnConfigService extends BaseMpService { + + /** + * 根据数据实体ID查询 + * + * @param entityId + * @return + */ + List getByDataEntityId(String entityId); + + /** + * 修改生成器配置信息 + * + * @param vo + */ + void updateGenerate(String entityId, List vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + GenUpdateColumnConfigDto findById(String id); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenerateInfoService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenerateInfoService.java new file mode 100644 index 0000000..5b73540 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/GenerateInfoService.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.dto.gen.GenGenerateInfoDto; +import com.lframework.xingyun.template.gen.entity.GenGenerateInfo; +import com.lframework.xingyun.template.gen.vo.gen.UpdateGenerateInfoVo; +import com.lframework.starter.web.service.BaseMpService; + +public interface GenerateInfoService extends BaseMpService { + + /** + * 根据数据实体ID查询 + * + * @param entityId + * @return + */ + GenGenerateInfoDto getByEntityId(String entityId); + + /** + * 修改生成器配置信息 + * + * @param vo + */ + void updateGenerate(String dataObjId, UpdateGenerateInfoVo vo); + + /** + * 根据数据实体ID删除 + * + * @param entityId + */ + void deleteByEntityId(String entityId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/SimpleDBService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/SimpleDBService.java new file mode 100644 index 0000000..66bbb84 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/SimpleDBService.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.vo.simpledb.SimpleTableSelectorVo; +import com.lframework.xingyun.template.gen.dto.simpledb.OriSimpleTableDto; +import com.lframework.xingyun.template.gen.dto.simpledb.SimpleDBDto; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseService; +import java.util.List; + +public interface SimpleDBService extends BaseService { + + /** + * 查询当前数据库名称 + * + * @return + */ + String getCurrentDBName(); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SimpleTableSelectorVo vo); + + /** + * 根据表名查询 + * + * @return + */ + OriSimpleTableDto getByTableName(String tableName); + + /** + * 批量查询 + * + * @param tableNames + * @return + */ + List listByIds(List tableNames); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/SimpleTableColumnService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/SimpleTableColumnService.java new file mode 100644 index 0000000..9e3c670 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/service/SimpleTableColumnService.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.template.gen.service; + +import com.lframework.xingyun.template.gen.vo.simpledb.QuerySimpleTableColumnVo; +import com.lframework.xingyun.template.gen.entity.GenSimpleTableColumn; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface SimpleTableColumnService extends BaseMpService { + + /** + * 查询列信息 + * + * @param vo + * @return + */ + List query(QuerySimpleTableColumnVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/utils/WebUtils.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/utils/WebUtils.java new file mode 100644 index 0000000..668c401 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/utils/WebUtils.java @@ -0,0 +1,117 @@ +package com.lframework.xingyun.template.gen.utils; + +import cn.hutool.core.collection.ArrayIter; +import cn.hutool.core.collection.IterUtil; +import cn.hutool.core.map.CaseInsensitiveMap; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.text.CharSequenceUtil; +import cn.hutool.core.util.ArrayUtil; +import org.springframework.util.Assert; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.Objects; + + +public class WebUtils { + + private static final String UNKNOWN ="unknown"; + + public static HttpServletRequest getHttpRequest() { + ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); + Assert.notNull(attributes, "RequestContextHolder.getRequestAttributes can't be NULL"); + return attributes.getRequest(); + } + + public static HttpServletRequest getRequest() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + return (requestAttributes == null) ? null : ((ServletRequestAttributes) requestAttributes).getRequest(); + } + + public static HttpServletResponse getResponse() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + return (requestAttributes == null) ? null : ((ServletRequestAttributes) requestAttributes).getResponse(); + } + + public static void redirect(String url) throws Exception { + redirect(getResponse(), url); + } + + public static void redirect(HttpServletResponse response, String url) throws Exception { + response.sendRedirect(url); + } + + public static void addCookie(String name, String value) { + getResponse().addCookie(new Cookie(name, value)); + } + + public static void addCookie(String name, String value, int expiry) { + Cookie cookie = new Cookie(name, value); + cookie.setMaxAge(expiry); + cookie.setPath("/"); + getResponse().addCookie(cookie); + } + + public static String getCookie(String name) { + Map cookieMap = readCookieMap(getRequest()); + return cookieMap.containsKey(name) ? ((Cookie)cookieMap.get(name)).getValue() : null; + } + + public static Map readCookieMap(HttpServletRequest httpServletRequest) { + Cookie[] cookies = httpServletRequest.getCookies(); + return ArrayUtil.isEmpty(cookies) ? MapUtil.empty() : IterUtil.toMap(new ArrayIter(httpServletRequest.getCookies()), new CaseInsensitiveMap(), Cookie::getName); + } + + + + public static String getRemoteIpAddress() { + return getRemoteIpAddress(getRequest()); + } + + /** + * 获取请求路径 + * + */ + public static String getRequestPath() { + return Objects.requireNonNull(getRequest()).getRequestURI(); + } + + public static String getRemoteIpAddress(HttpServletRequest request) { + String ip = null; + // X-Forwarded-For:Squid 服务代理 + String ipAddresses = request.getHeader("X-Forwarded-For"); + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // Proxy-Client-IP:apache 服务代理 + ipAddresses = request.getHeader("Proxy-Client-IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + ipAddresses = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // WL-Proxy-Client-IP:weblogic 服务代理 + ipAddresses = request.getHeader("WL-Proxy-Client-IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // HTTP_CLIENT_IP:有些代理服务器 + ipAddresses = request.getHeader("HTTP_CLIENT_IP"); + } + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + // X-Real-IP:nginx服务代理 + ipAddresses = request.getHeader("X-Real-IP"); + } + // 有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP + if (CharSequenceUtil.isNotBlank(ipAddresses)) { + ip = ipAddresses.split(",")[0]; + } + // 还是不能获取到,最后再通过request.getRemoteAddr();获取 + if (CharSequenceUtil.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) { + ip = request.getRemoteAddr(); + } + return ip; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/CreateGenCustomListVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/CreateGenCustomListVo.java new file mode 100644 index 0000000..3ff6f17 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/CreateGenCustomListVo.java @@ -0,0 +1,174 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.xingyun.template.gen.enums.GenCustomListType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateGenCustomListVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 列表类型 + */ + @ApiModelProperty(value = "列表类型", required = true) + @NotNull(message = "列表类型不能为空!") + @IsEnum(message = "列表类型不能为空!", enumClass = GenCustomListType.class) + private Integer listType; + + /** + * 数据对象ID + */ + @ApiModelProperty(value = "数据对象ID", required = true) + @NotBlank(message = "数据对象ID不能为空!") + private String dataObjId; + + /** + * 表单Label宽度 + */ + @ApiModelProperty(value = "表单Label宽度", required = true) + @NotNull(message = "表单Label宽度不能为空!") + @Min(value = 1, message = "表单Label宽度不允许小于0!") + private Integer labelWidth; + + /** + * 是否分页 + */ + @ApiModelProperty(value = "是否分页", required = true) + @NotNull(message = "是否分页不能为空!") + private Boolean hasPage; + + /** + * 是否树形列表 + */ + @ApiModelProperty(value = "是否树形列表", required = true) + @NotNull(message = "是否树形列表不能为空!") + private Boolean treeData; + + /** + * ID字段 + */ + @ApiModelProperty(value = "ID字段", required = true) + @NotBlank(message = "ID字段不能为空!") + private String idColumn; + + /** + * ID字段关联ID + */ + @ApiModelProperty(value = "ID字段关联ID", required = true) + @NotBlank(message = "ID字段不能为空!") + private String idColumnRelaId; + + /** + * 父级ID字段 + */ + @ApiModelProperty("父级ID字段") + private String treePidColumn; + + /** + * 父级ID字段关联ID + */ + @ApiModelProperty("父级ID字段关联ID") + private String treePidColumnRelaId; + + /** + * 树形节点字段 + */ + @ApiModelProperty("树形节点字段") + private String treeNodeColumn; + + /** + * 树形节点字段关联ID + */ + @ApiModelProperty("树形节点字段关联ID") + private String treeNodeColumnRelaId; + + /** + * 子节点Key值 + */ + @ApiModelProperty("子节点Key值") + private String treeChildrenKey; + + /** + * 是否允许导出 + */ + @ApiModelProperty("是否允许导出") + @NotNull(message = "是否允许导出不能为空!") + private Boolean allowExport; + + /** + * 查询条件 + */ + @ApiModelProperty("查询条件") + @Valid + private List queryParams; + + /** + * 列表配置 + */ + @ApiModelProperty(value = "列表配置", required = true) + @NotEmpty(message = "列表配置不能为空!") + @Valid + private List details; + + /** + * 查询前置SQL + */ + @ApiModelProperty("查询前置SQL") + private String queryPrefixSql; + + /** + * 查询后置SQL + */ + @ApiModelProperty("查询后置SQL") + private String querySuffixSql; + + /** + * 后置SQL + */ + @ApiModelProperty("后置SQL") + private String suffixSql; + + /** + * 工具栏 + */ + @Valid + @ApiModelProperty("工具栏") + private List toolbars; + + /** + * 操作列 + */ + @Valid + @ApiModelProperty("操作列") + private List handleColumns; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListDetailVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListDetailVo.java new file mode 100644 index 0000000..36acf5f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListDetailVo.java @@ -0,0 +1,67 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class GenCustomListDetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 关联ID + */ + @ApiModelProperty(value = "关联ID") + private String relaId; + + /** + * 宽度类型 + */ + @ApiModelProperty(value = "宽度类型", required = true) + @NotNull(message = "宽度类型不能为空!") + @IsEnum(message = "宽度类型不能为空!", enumClass = GenQueryWidthType.class) + private Integer widthType; + + /** + * 是否页面排序 + */ + @ApiModelProperty(value = "是否页面排序", required = true) + @NotNull(message = "请选择是否页面排序!") + private Boolean sortable; + + /** + * 宽度 + */ + @ApiModelProperty(value = "宽度", required = true) + @NotNull(message = "宽度不能为空!") + @Min(value = 1, message = "宽度必须大于0!") + private Integer width; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型", required = true) + @NotNull(message = "类型不能为空!") + @IsEnum(message = "类型不能为空!", enumClass = GenCustomListDetailType.class) + private Integer type; + + /** + * 格式化脚本 + */ + @ApiModelProperty("格式化脚本") + private String formatter; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListHandleColumnVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListHandleColumnVo.java new file mode 100644 index 0000000..c8e644d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListHandleColumnVo.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnType; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnViewType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class GenCustomListHandleColumnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + @NotNull(message = "显示名称不能为空!") + private String name; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + @NotNull(message = "显示类型不能为空!") + @IsEnum(enumClass = GenCustomListBtnViewType.class, message = "显示类型格式错误!") + private String viewType; + + /** + * 按钮类型 + */ + @ApiModelProperty("按钮类型") + @NotNull(message = "按钮类型不能为空!") + @IsEnum(enumClass = GenCustomListBtnType.class, message = "显示类型格式错误!") + private Integer btnType; + + /** + * 按钮配置 + */ + @ApiModelProperty("按钮配置") + private String btnConfig; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 请求参数 + */ + @ApiModelProperty("请求参数") + private String requestParam; + + /** + * 宽度 + */ + @ApiModelProperty(value = "宽度", required = true) + @NotNull(message = "宽度不能为空!") + @Min(value = 0, message = "宽度必须大于0!") + private Integer width; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListQueryParamsVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListQueryParamsVo.java new file mode 100644 index 0000000..34628a4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListQueryParamsVo.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.xingyun.template.gen.enums.GenCustomListDetailType; +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class GenCustomListQueryParamsVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 关联ID + */ + @ApiModelProperty(value = "关联ID", required = true) + @NotBlank(message = "关联ID不能为空!") + private String relaId; + + /** + * 前端显示 + */ + @ApiModelProperty(value = "前端显示", required = true) + @NotNull(message = "前端显示不能为空!") + private Boolean frontShow; + + /** + * 查询类型 + */ + @ApiModelProperty(value = "查询类型", required = true) + @NotNull(message = "查询类型不能为空!") + @IsEnum(message = "查询类型不能为空!", enumClass = GenQueryType.class) + private Integer queryType; + + /** + * 表单宽度 + */ + @ApiModelProperty(value = "表单宽度", required = true) + @NotNull(message = "表单宽度不能为空!") + @Min(value = 1, message = "表单宽度不允许小于0!") + @Max(value = 24, message = "表单宽度不允许大于24!") + private Integer formWidth; + + /** + * 默认值 + */ + @ApiModelProperty("默认值") + private Object defaultValue; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型", required = true) + @NotNull(message = "类型不能为空!") + @IsEnum(message = "类型不能为空!", enumClass = GenCustomListDetailType.class) + private Integer type; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListSelectorVo.java new file mode 100644 index 0000000..02d491c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListSelectorVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomListSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListToolbarVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListToolbarVo.java new file mode 100644 index 0000000..8beb586 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/GenCustomListToolbarVo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnType; +import com.lframework.xingyun.template.gen.enums.GenCustomListBtnViewType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class GenCustomListToolbarVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 显示名称 + */ + @ApiModelProperty("显示名称") + @NotNull(message = "显示名称不能为空!") + private String name; + + /** + * 显示类型 + */ + @ApiModelProperty("显示类型") + @NotNull(message = "显示类型不能为空!") + @IsEnum(enumClass = GenCustomListBtnViewType.class, message = "显示类型格式错误!") + private String viewType; + + /** + * 按钮类型 + */ + @ApiModelProperty("按钮类型") + @NotNull(message = "按钮类型不能为空!") + @IsEnum(enumClass = GenCustomListBtnType.class, message = "显示类型格式错误!") + private Integer btnType; + + /** + * 按钮配置 + */ + @ApiModelProperty("按钮配置") + private String btnConfig; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 请求参数 + */ + @ApiModelProperty("请求参数") + private String requestParam; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/QueryGenCustomListVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/QueryGenCustomListVo.java new file mode 100644 index 0000000..5eaeb8e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/QueryGenCustomListVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 查询自定义列表Vo + */ +@Data +public class QueryGenCustomListVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/UpdateGenCustomListVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/UpdateGenCustomListVo.java new file mode 100644 index 0000000..ecec21f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/UpdateGenCustomListVo.java @@ -0,0 +1,187 @@ +package com.lframework.xingyun.template.gen.vo.custom.list; + +import com.lframework.xingyun.template.gen.enums.GenCustomListType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenCustomListVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 列表类型 + */ + @ApiModelProperty(value = "列表类型", required = true) + @NotNull(message = "列表类型不能为空!") + @IsEnum(message = "列表类型不能为空!", enumClass = GenCustomListType.class) + private Integer listType; + + /** + * 表单Label宽度 + */ + @ApiModelProperty(value = "表单Label宽度", required = true) + @NotNull(message = "表单Label宽度不能为空!") + @Min(value = 1, message = "表单Label宽度不允许小于0!") + private Integer labelWidth; + + /** + * 是否分页 + */ + @ApiModelProperty(value = "是否分页", required = true) + @NotNull(message = "是否分页不能为空!") + private Boolean hasPage; + + /** + * 是否树形列表 + */ + @ApiModelProperty(value = "是否树形列表", required = true) + @NotNull(message = "是否树形列表不能为空!") + private Boolean treeData; + + /** + * ID字段 + */ + @ApiModelProperty(value = "ID字段", required = true) + @NotBlank(message = "ID字段不能为空!") + private String idColumn; + + /** + * ID字段关联ID + */ + @ApiModelProperty(value = "ID字段关联ID", required = true) + @NotBlank(message = "ID字段不能为空!") + private String idColumnRelaId; + + /** + * 父级ID字段 + */ + @ApiModelProperty("父级ID字段") + private String treePidColumn; + + /** + * 父级ID字段关联ID + */ + @ApiModelProperty("父级ID字段关联ID") + private String treePidColumnRelaId; + + /** + * 树形节点字段 + */ + @ApiModelProperty("树形节点字段") + private String treeNodeColumn; + + /** + * 树形节点字段关联ID + */ + @ApiModelProperty("树形节点字段关联ID") + private String treeNodeColumnRelaId; + + /** + * 子节点Key值 + */ + @ApiModelProperty("子节点Key值") + private String treeChildrenKey; + + /** + * 默认值 + */ + @ApiModelProperty("默认值") + private String defaultValue; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 是否允许导出 + */ + @ApiModelProperty("是否允许导出") + @NotNull(message = "是否允许导出不能为空!") + private Boolean allowExport; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 查询条件 + */ + @ApiModelProperty("查询条件") + @Valid + private List queryParams; + + /** + * 列表配置 + */ + @ApiModelProperty(value = "列表配置", required = true) + @NotEmpty(message = "列表配置不能为空!") + @Valid + private List details; + + /** + * 查询前置SQL + */ + @ApiModelProperty("查询前置SQL") + private String queryPrefixSql; + + /** + * 查询后置SQL + */ + @ApiModelProperty("查询后置SQL") + private String querySuffixSql; + + /** + * 后置SQL + */ + @ApiModelProperty("后置SQL") + private String suffixSql; + + /** + * 工具栏 + */ + @Valid + @ApiModelProperty("工具栏") + private List toolbars; + + /** + * 操作列 + */ + @Valid + @ApiModelProperty("操作列") + private List handleColumns; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/CreateGenCustomListCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/CreateGenCustomListCategoryVo.java new file mode 100644 index 0000000..a452137 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/CreateGenCustomListCategoryVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.custom.list.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenCustomListCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/GenCustomListCategorySelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/GenCustomListCategorySelectorVo.java new file mode 100644 index 0000000..e6d369f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/GenCustomListCategorySelectorVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.gen.vo.custom.list.category; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomListCategorySelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/UpdateGenCustomListCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/UpdateGenCustomListCategoryVo.java new file mode 100644 index 0000000..064c41f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/list/category/UpdateGenCustomListCategoryVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.vo.custom.list.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenCustomListCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/CreateGenCustomPageVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/CreateGenCustomPageVo.java new file mode 100644 index 0000000..60fb258 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/CreateGenCustomPageVo.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.template.gen.vo.custom.page; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenCustomPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 页面代码 + */ + @ApiModelProperty(value = "页面代码", required = true) + @NotBlank(message = "页面代码不能为空!") + private String pageCode; + + /** + * 脚本代码 + */ + @ApiModelProperty(value = "脚本代码", required = true) + @NotBlank(message = "脚本代码不能为空!") + private String scriptCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/GenCustomPageSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/GenCustomPageSelectorVo.java new file mode 100644 index 0000000..b52a5ef --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/GenCustomPageSelectorVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.custom.page; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomPageSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private Integer id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/QueryGenCustomPageVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/QueryGenCustomPageVo.java new file mode 100644 index 0000000..9f17ffb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/QueryGenCustomPageVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.vo.custom.page; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 查询自定义页面Vo + */ +@Data +public class QueryGenCustomPageVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private Integer id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/UpdateGenCustomPageVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/UpdateGenCustomPageVo.java new file mode 100644 index 0000000..ed8b012 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/UpdateGenCustomPageVo.java @@ -0,0 +1,47 @@ +package com.lframework.xingyun.template.gen.vo.custom.page; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenCustomPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private Integer id; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 页面代码 + */ + @ApiModelProperty(value = "页面代码", required = true) + @NotBlank(message = "页面代码不能为空!") + private String pageCode; + + /** + * 脚本代码 + */ + @ApiModelProperty(value = "脚本代码", required = true) + @NotBlank(message = "脚本代码不能为空!") + private String scriptCode; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/category/CreateGenCustomPageCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/category/CreateGenCustomPageCategoryVo.java new file mode 100644 index 0000000..4aa93d4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/category/CreateGenCustomPageCategoryVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.gen.vo.custom.page.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenCustomPageCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty(value = "父级ID") + private String parentId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/category/UpdateGenCustomPageCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/category/UpdateGenCustomPageCategoryVo.java new file mode 100644 index 0000000..5eb6dfe --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/page/category/UpdateGenCustomPageCategoryVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.vo.custom.page.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenCustomPageCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/CreateGenCustomSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/CreateGenCustomSelectorVo.java new file mode 100644 index 0000000..d481edf --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/CreateGenCustomSelectorVo.java @@ -0,0 +1,86 @@ +package com.lframework.xingyun.template.gen.vo.custom.selector; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenCustomSelectorVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 自定义列表ID + */ + @ApiModelProperty(value = "自定义列表ID", required = true) + @NotBlank(message = "自定义列表ID不能为空!") + private String customListId; + + /** + * 对话框标题 + */ + @ApiModelProperty(value = "对话框标题") + private String dialogTittle; + + /** + * 对话框宽度 + */ + @ApiModelProperty(value = "对话框宽度", required = true) + @NotBlank(message = "对话框宽度不能为空!") + private String dialogWidth; + + /** + * 占位符 + */ + @ApiModelProperty("占位符") + private String placeholder; + + /** + * ID字段 + */ + @ApiModelProperty(value = "ID字段", required = true) + @NotBlank(message = "ID字段不能为空!") + private String idColumn; + + /** + * ID字段关联ID + */ + @ApiModelProperty(value = "ID字段关联ID", required = true) + @NotBlank(message = "ID字段不能为空!") + private String idColumnRelaId; + + /** + * 名称字段 + */ + @ApiModelProperty(value = "名称字段", required = true) + @NotBlank(message = "名称字段不能为空!") + private String nameColumn; + + /** + * 名称字段关联ID + */ + @ApiModelProperty(value = "名称字段关联ID", required = true) + @NotBlank(message = "名称字段不能为空!") + private String nameColumnRelaId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/GenCustomSelectorSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/GenCustomSelectorSelectorVo.java new file mode 100644 index 0000000..70abb47 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/GenCustomSelectorSelectorVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.custom.selector; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomSelectorSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/QueryGenCustomSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/QueryGenCustomSelectorVo.java new file mode 100644 index 0000000..dd50f0e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/QueryGenCustomSelectorVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.vo.custom.selector; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 查询自定义选择器Vo + */ +@Data +public class QueryGenCustomSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/UpdateGenCustomSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/UpdateGenCustomSelectorVo.java new file mode 100644 index 0000000..e302820 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/UpdateGenCustomSelectorVo.java @@ -0,0 +1,90 @@ +package com.lframework.xingyun.template.gen.vo.custom.selector; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenCustomSelectorVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 对话框标题 + */ + @ApiModelProperty(value = "对话框标题") + private String dialogTittle; + + /** + * 对话框宽度 + */ + @ApiModelProperty(value = "对话框宽度", required = true) + @NotBlank(message = "对话框宽度不能为空!") + private String dialogWidth; + + /** + * 占位符 + */ + @ApiModelProperty("占位符") + private String placeholder; + + /** + * ID字段 + */ + @ApiModelProperty("ID字段") + private String idColumn; + + /** + * ID字段关联ID + */ + @ApiModelProperty("ID字段关联ID") + private String idColumnRelaId; + + /** + * 名称字段 + */ + @ApiModelProperty("名称字段") + private String nameColumn; + + /** + * 名称字段关联ID + */ + @ApiModelProperty("名称字段关联ID") + private String nameColumnRelaId; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/CreateGenCustomSelectorCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/CreateGenCustomSelectorCategoryVo.java new file mode 100644 index 0000000..f84cb40 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/CreateGenCustomSelectorCategoryVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.custom.selector.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenCustomSelectorCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/GenCustomSelectorCategorySelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/GenCustomSelectorCategorySelectorVo.java new file mode 100644 index 0000000..b7ce894 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/GenCustomSelectorCategorySelectorVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.gen.vo.custom.selector.category; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenCustomSelectorCategorySelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/UpdateGenCustomSelectorCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/UpdateGenCustomSelectorCategoryVo.java new file mode 100644 index 0000000..5e413b0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/custom/selector/category/UpdateGenCustomSelectorCategoryVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.vo.custom.selector.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenCustomSelectorCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/CreateDataEntityVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/CreateDataEntityVo.java new file mode 100644 index 0000000..2d03016 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/CreateDataEntityVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.template.gen.vo.data.entity; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class CreateDataEntityVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 数据表 + */ + @ApiModelProperty(value = "数据表", required = true) + @NotBlank(message = "数据表不能为空!") + private String tableName; + + /** + * 字段信息 + */ + @ApiModelProperty(value = "字段信息", required = true) + @Valid + @NotEmpty(message = "字段信息不能为空!") + private List columns; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntityDetailSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntityDetailSelectorVo.java new file mode 100644 index 0000000..37162e9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntityDetailSelectorVo.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.template.gen.vo.data.entity; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class GenDataEntityDetailSelectorVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 数据实体ID + */ + @ApiModelProperty("数据实体ID") + @NotBlank(message = "数据实体ID不能为空!") + private String entityId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntityDetailVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntityDetailVo.java new file mode 100644 index 0000000..66bbf20 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntityDetailVo.java @@ -0,0 +1,119 @@ +package com.lframework.xingyun.template.gen.vo.data.entity; + +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.xingyun.template.gen.enums.GenOrderType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class GenDataEntityDetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 字段显示名称 + */ + @ApiModelProperty(value = "字段显示名称", required = true) + @NotBlank(message = "显示名称不能为空!") + private String name; + + /** + * 数据类型 + */ + @ApiModelProperty(value = "数据类型", required = true) + @NotNull(message = "数据类型不能为空!") + @IsEnum(message = "数据类型格式不正确!", enumClass = GenDataType.class) + private Integer dataType; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 显示类型 + */ + @ApiModelProperty(value = "显示类型", required = true) + @NotNull(message = "显示类型不能为空!") + @IsEnum(message = "显示类型格式不正确!", enumClass = GenDataType.class) + private Integer viewType; + + /** + * 是否内置枚举 + */ + @ApiModelProperty(value = "是否内置枚举", required = true) + @NotNull(message = "是否内置枚举不能为空!") + private Boolean fixEnum; + + /** + * 后端枚举名 + */ + @ApiModelProperty("后端枚举名") + private String enumBack; + + /** + * 前端枚举名 + */ + @ApiModelProperty("前端枚举名") + private String enumFront; + + /** + * 正则表达式 + */ + @ApiModelProperty("正则表达式") + private String regularExpression; + + /** + * 是否排序字段 + */ + @ApiModelProperty(value = "是否排序字段", required = true) + @NotNull(message = "是否排序字段不能为空!") + private Boolean isOrder; + + /** + * 排序类型 + */ + @ApiModelProperty("排序类型") + @IsEnum(message = "排序类型格式不正确!", enumClass = GenOrderType.class) + private String orderType; + + /** + * 数据字典ID + */ + @ApiModelProperty("数据字典ID") + private String dataDicId; + + /** + * 自定义选择器ID + */ + @ApiModelProperty("自定义选择器ID") + private String customSelectorId; + + /** + * 长度 + */ + @ApiModelProperty("长度") + @Min(value = 1, message = "长度必须大于0!") + private Long len; + + /** + * 小数位数 + */ + @ApiModelProperty("小数位数") + @Min(value = 1, message = "小数位数必须大于0!") + private Integer decimals; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntitySelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntitySelectorVo.java new file mode 100644 index 0000000..eeac666 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/GenDataEntitySelectorVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.data.entity; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataEntitySelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/QueryDataEntityVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/QueryDataEntityVo.java new file mode 100644 index 0000000..e3fd825 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/QueryDataEntityVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.vo.data.entity; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 查询数据实体列表Vo + */ +@Data +public class QueryDataEntityVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/UpdateDataEntityGenerateVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/UpdateDataEntityGenerateVo.java new file mode 100644 index 0000000..b7aeb45 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/UpdateDataEntityGenerateVo.java @@ -0,0 +1,72 @@ +package com.lframework.xingyun.template.gen.vo.data.entity; + +import com.lframework.xingyun.template.gen.vo.gen.UpdateCreateColumnConfigVo; +import com.lframework.xingyun.template.gen.vo.gen.UpdateDetailColumnConfigVo; +import com.lframework.xingyun.template.gen.vo.gen.UpdateGenerateInfoVo; +import com.lframework.xingyun.template.gen.vo.gen.UpdateQueryColumnConfigVo; +import com.lframework.xingyun.template.gen.vo.gen.UpdateQueryParamsColumnConfigVo; +import com.lframework.xingyun.template.gen.vo.gen.UpdateUpdateColumnConfigVo; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateDataEntityGenerateVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 基础设置 + */ + @ApiModelProperty(value = "基础设置", required = true) + @Valid + @NotNull(message = "基本设置不能为空!") + private UpdateGenerateInfoVo generateInfo; + + /** + * 新增配置 + */ + @ApiModelProperty("新增配置") + @Valid + private List createConfigs; + + /** + * 修改配置 + */ + @ApiModelProperty("修改配置") + @Valid + private List updateConfigs; + + /** + * 查询配置 + */ + @ApiModelProperty("查询配置") + @Valid + private List queryConfigs; + + /** + * 查询参数配置 + */ + @ApiModelProperty("查询参数配置") + @Valid + private List queryParamsConfigs; + + /** + * 详情配置 + */ + @ApiModelProperty("详情配置") + @Valid + private List detailConfigs; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/UpdateDataEntityVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/UpdateDataEntityVo.java new file mode 100644 index 0000000..6c51b45 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/UpdateDataEntityVo.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.template.gen.vo.data.entity; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateDataEntityVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 字段信息 + */ + @ApiModelProperty(value = "字段信息", required = true) + @Valid + @NotEmpty(message = "字段信息不能为空!") + private List columns; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/CreateGenDataEntityCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/CreateGenDataEntityCategoryVo.java new file mode 100644 index 0000000..3faf7d9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/CreateGenDataEntityCategoryVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.data.entity.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenDataEntityCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/GenDataEntityCategorySelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/GenDataEntityCategorySelectorVo.java new file mode 100644 index 0000000..10d78f5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/GenDataEntityCategorySelectorVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.gen.vo.data.entity.category; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataEntityCategorySelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/UpdateGenDataEntityCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/UpdateGenDataEntityCategoryVo.java new file mode 100644 index 0000000..0d76626 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/entity/category/UpdateGenDataEntityCategoryVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.vo.data.entity.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenDataEntityCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/CreateGenDataObjVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/CreateGenDataObjVo.java new file mode 100644 index 0000000..b0e73b6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/CreateGenDataObjVo.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.template.gen.vo.data.obj; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenDataObjVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 主表 + */ + @ApiModelProperty(value = "主表", required = true) + @NotBlank(message = "主表不能为空!") + private String mainTableId; + + /** + * 主表别名 + */ + @ApiModelProperty(value = "主表别名", required = true) + @NotBlank(message = "主表别名不能为空!") + private String mainTableAlias; + + /** + * 关联信息 + */ + @ApiModelProperty(value = "关联信息") + @Valid + private List columns; + + /** + * 自定义查询 + */ + @ApiModelProperty(value = "自定义查询") + @Valid + private List queryColumns; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjDetailVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjDetailVo.java new file mode 100644 index 0000000..52a7b2b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjDetailVo.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.template.gen.vo.data.obj; + +import com.lframework.xingyun.template.gen.enums.GenRelaMode; +import com.lframework.xingyun.template.gen.enums.GenRelaType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class GenDataObjDetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 主表字段 + */ + @ApiModelProperty(value = "主表字段", required = true) + @NotEmpty(message = "主表字段不能为空!") + private List mainTableDetailIds; + + /** + * 关联类型 + */ + @ApiModelProperty(value = "关联类型", required = true) + @NotNull(message = "关联类型不能为空!") + @IsEnum(message = "关联类型不能为空!", enumClass = GenRelaType.class) + private Integer relaType; + + /** + * 关联方式 + */ + @ApiModelProperty(value = "关联方式", required = true) + @NotNull(message = "关联方式不能为空!") + @IsEnum(message = "关联方式不能为空!", enumClass = GenRelaMode.class) + private Integer relaMode; + + /** + * 子表ID + */ + @ApiModelProperty(value = "子表ID", required = true) + @NotBlank(message = "子表ID不能为空!") + private String subTableId; + + /** + * 子表别名 + */ + @ApiModelProperty(value = "子表别名", required = true) + @NotBlank(message = "子表别名不能为空!") + private String subTableAlias; + + /** + * 子表字段 + */ + @ApiModelProperty(value = "子表字段", required = true) + @NotEmpty(message = "子表字段不能为空!") + private List subTableDetailIds; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjQueryDetailVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjQueryDetailVo.java new file mode 100644 index 0000000..02821bf --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjQueryDetailVo.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.template.gen.vo.data.obj; + +import com.lframework.xingyun.template.gen.enums.GenDataType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class GenDataObjQueryDetailVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 显示名称 + */ + @ApiModelProperty(value = "显示名称", required = true) + @NotBlank(message = "显示名称不能为空!") + private String customName; + + /** + * 自定义SQL + */ + @ApiModelProperty(value = "自定义SQL", required = true) + @NotBlank(message = "自定义SQL不能为空!") + private String customSql; + + /** + * 别名 + */ + @ApiModelProperty(value = "别名", required = true) + @NotBlank(message = "别名不能为空!") + private String customAlias; + + /** + * 数据类型 + */ + @ApiModelProperty(value = "数据类型", required = true) + @NotNull(message = "数据类型不能为空!") + @IsEnum(message = "数据类型格式不正确!", enumClass = GenDataType.class) + private Integer dataType; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjSelectorVo.java new file mode 100644 index 0000000..373174f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/GenDataObjSelectorVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.data.obj; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataObjSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/QueryGenDataObjVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/QueryGenDataObjVo.java new file mode 100644 index 0000000..18b53d3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/QueryGenDataObjVo.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.gen.vo.data.obj; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 查询数据对象列表Vo + */ +@Data +public class QueryGenDataObjVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/UpdateGenDataObjVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/UpdateGenDataObjVo.java new file mode 100644 index 0000000..0dce245 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/UpdateGenDataObjVo.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.template.gen.vo.data.obj; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenDataObjVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 主表别名 + */ + @ApiModelProperty(value = "主表别名", required = true) + @NotBlank(message = "主表别名不能为空!") + private String mainTableAlias; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 关联信息 + */ + @ApiModelProperty(value = "关联信息") + @Valid + private List columns; + + /** + * 自定义查询 + */ + @ApiModelProperty(value = "自定义查询") + @Valid + private List queryColumns; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/CreateGenDataObjCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/CreateGenDataObjCategoryVo.java new file mode 100644 index 0000000..0f2ed75 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/CreateGenDataObjCategoryVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.gen.vo.data.obj.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateGenDataObjCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/GenDataObjCategorySelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/GenDataObjCategorySelectorVo.java new file mode 100644 index 0000000..1554d2c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/GenDataObjCategorySelectorVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.gen.vo.data.obj.category; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GenDataObjCategorySelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/UpdateGenDataObjCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/UpdateGenDataObjCategoryVo.java new file mode 100644 index 0000000..4ea5fb5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/data/obj/category/UpdateGenDataObjCategoryVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.gen.vo.data.obj.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenDataObjCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateCreateColumnConfigVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateCreateColumnConfigVo.java new file mode 100644 index 0000000..0af54b5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateCreateColumnConfigVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.vo.gen; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateCreateColumnConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 是否必填 + */ + @ApiModelProperty(value = "是否必填", required = true) + @NotNull(message = "是否必填不能为空!") + private Boolean required; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateDetailColumnConfigVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateDetailColumnConfigVo.java new file mode 100644 index 0000000..c6885d4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateDetailColumnConfigVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.vo.gen; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateDetailColumnConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 列宽 + */ + @ApiModelProperty(value = "列宽", required = true) + @NotNull(message = "列宽不能为空!") + private Integer span; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateGenerateInfoVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateGenerateInfoVo.java new file mode 100644 index 0000000..095301c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateGenerateInfoVo.java @@ -0,0 +1,117 @@ +package com.lframework.xingyun.template.gen.vo.gen; + +import com.lframework.xingyun.template.gen.enums.GenKeyType; +import com.lframework.xingyun.template.gen.enums.GenTemplateType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateGenerateInfoVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 生成模板类型 + */ + @ApiModelProperty(value = "生成模板类型", required = true) + @NotNull(message = "生成模板类型不能为空!") + @IsEnum(message = "生成模板类型格式不正确!", enumClass = GenTemplateType.class) + private Integer templateType; + + /** + * 包名 + */ + @ApiModelProperty(value = "包名", required = true) + @NotBlank(message = "包名不能为空!") + private String packageName; + + /** + * 模块名称 + */ + @ApiModelProperty(value = "模块名称", required = true) + @NotBlank(message = "模块名称不能为空!") + private String moduleName; + + /** + * 业务名称 + */ + @ApiModelProperty(value = "业务名称", required = true) + @NotBlank(message = "业务名称不能为空!") + private String bizName; + + /** + * 类名 + */ + @ApiModelProperty(value = "类名", required = true) + @NotBlank(message = "类名不能为空!") + private String className; + + /** + * 类描述 + */ + @ApiModelProperty(value = "类描述", required = true) + @NotBlank(message = "类描述不能为空!") + private String classDescription; + + /** + * 父级菜单ID + */ + @ApiModelProperty("父级菜单ID") + private String parentMenuId; + + /** + * 主键类型 + */ + @ApiModelProperty(value = "主键类型", required = true) + @NotNull(message = "主键类型不能为空!") + @IsEnum(message = "主键类型格式不正确!", enumClass = GenKeyType.class) + private Integer keyType; + + /** + * 作者 + */ + @ApiModelProperty("作者") + private String author; + + /** + * 本级菜单编号 + */ + @ApiModelProperty(value = "本级菜单编号", required = true) + @NotNull(message = "本级菜单编号不能为空!") + private String menuCode; + + /** + * 本级菜单名称 + */ + @ApiModelProperty(value = "本级菜单名称", required = true) + @NotNull(message = "本级菜单名称不能为空!") + private String menuName; + + /** + * 详情页Span总数量 + */ + @ApiModelProperty(value = "详情页Span总数量", required = true) + @NotNull(message = "详情页Span总数量不能为空!") + @Min(value = 1, message = "详情页Span总数量必须大于0!") + private Integer detailSpan; + + /** + * 是否应用缓存 + */ + @ApiModelProperty(value = "是否应用缓存", required = true) + @NotNull(message = "是否应用缓存不能为空!") + private Boolean isCache; + + /** + * 是否内置删除功能 + */ + @ApiModelProperty(value = "是否内置删除功能", required = true) + @NotNull(message = "是否内置删除功能不能为空!") + private Boolean hasDelete; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateQueryColumnConfigVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateQueryColumnConfigVo.java new file mode 100644 index 0000000..44cf497 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateQueryColumnConfigVo.java @@ -0,0 +1,46 @@ +package com.lframework.xingyun.template.gen.vo.gen; + +import com.lframework.xingyun.template.gen.enums.GenQueryWidthType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateQueryColumnConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 宽度类型 + */ + @ApiModelProperty(value = "宽度类型", required = true) + @NotNull(message = "宽度类型不能为空!") + @IsEnum(message = "宽度类型不能为空!", enumClass = GenQueryWidthType.class) + private Integer widthType; + + /** + * 是否页面排序 + */ + @ApiModelProperty(value = "是否页面排序", required = true) + @NotNull(message = "请选择是否页面排序!") + private Boolean sortable; + + /** + * 宽度 + */ + @ApiModelProperty(value = "宽度", required = true) + @NotNull(message = "宽度不能为空!") + @Min(value = 1, message = "宽度必须大于0!") + private Integer width; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateQueryParamsColumnConfigVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateQueryParamsColumnConfigVo.java new file mode 100644 index 0000000..23cf77e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateQueryParamsColumnConfigVo.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.template.gen.vo.gen; + +import com.lframework.xingyun.template.gen.enums.GenQueryType; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateQueryParamsColumnConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 查询类型 + */ + @ApiModelProperty(value = "查询类型", required = true) + @NotNull(message = "查询类型不能为空!") + @IsEnum(message = "查询类型不能为空!", enumClass = GenQueryType.class) + private Integer queryType; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateUpdateColumnConfigVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateUpdateColumnConfigVo.java new file mode 100644 index 0000000..939f286 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/gen/UpdateUpdateColumnConfigVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.gen.vo.gen; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateUpdateColumnConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private String id; + + /** + * 是否必填 + */ + @ApiModelProperty(value = "是否必填", required = true) + @NotNull(message = "是否必填不能为空!") + private Boolean required; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/simpledb/QuerySimpleTableColumnVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/simpledb/QuerySimpleTableColumnVo.java new file mode 100644 index 0000000..8920089 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/simpledb/QuerySimpleTableColumnVo.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.template.gen.vo.simpledb; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QuerySimpleTableColumnVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 数据表所属的数据库名 + */ + @ApiModelProperty(value = "数据表所属的数据库名", required = true) + private String tableSchema; + + /** + * 数据库表名 + */ + @ApiModelProperty(value = "数据库表名", required = true) + @NotBlank(message = "请输入数据库表名!") + private String tableName; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/simpledb/SimpleTableSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/simpledb/SimpleTableSelectorVo.java new file mode 100644 index 0000000..7912e49 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/gen/vo/simpledb/SimpleTableSelectorVo.java @@ -0,0 +1,17 @@ +package com.lframework.xingyun.template.gen.vo.simpledb; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SimpleTableSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/CollectMenuBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/CollectMenuBo.java new file mode 100644 index 0000000..ef39e66 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/CollectMenuBo.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.inner.bo.auth; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.VoidDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CollectMenuBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 路由路径 + */ + @ApiModelProperty("路由路径") + private String path; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/ForgetPswUserInfoBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/ForgetPswUserInfoBo.java new file mode 100644 index 0000000..cb7a533 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/ForgetPswUserInfoBo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.inner.bo.auth; + +import com.lframework.starter.web.bo.SuperBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ForgetPswUserInfoBo implements SuperBo { + + /** + * 用户名 + */ + @ApiModelProperty("用户名") + private String username; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱,脱敏") + private String email; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话,脱敏") + private String telephone; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/LoginBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/LoginBo.java new file mode 100644 index 0000000..bd4e763 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/LoginBo.java @@ -0,0 +1,62 @@ +package com.lframework.xingyun.template.inner.bo.auth; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.template.inner.dto.LoginDto; +import com.lframework.xingyun.template.inner.dto.LoginDto.UserInfoDto; +import io.swagger.annotations.ApiModelProperty; +import java.util.Set; +import lombok.Data; + +@Data +public class LoginBo extends BaseBo { + + /** + * Token + */ + @ApiModelProperty("Token") + private String token; + + /** + * 用户信息 + */ + @ApiModelProperty("用户信息") + private UserInfoBo user; + + /** + * 角色 + */ + @ApiModelProperty("角色") + private Set roles; + + public LoginBo() { + } + + public LoginBo(LoginDto dto) { + super(dto); + } + + @Override + protected void afterInit(LoginDto dto) { + + this.user = new UserInfoBo(dto.getUser()); + } + + @Data + public static class UserInfoBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + public UserInfoBo() { + } + + public UserInfoBo(UserInfoDto dto) { + super(dto); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/MenuBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/MenuBo.java new file mode 100644 index 0000000..be18b20 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/MenuBo.java @@ -0,0 +1,114 @@ +package com.lframework.xingyun.template.inner.bo.auth; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.VoidDto; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.Data; + +@Data +public class MenuBo extends BaseBo { + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 组件 + */ + @ApiModelProperty("组件") + private String component; + + /** + * 子节点 + */ + @ApiModelProperty("子节点") + private List children; + + /** + * 路由路径 + */ + @ApiModelProperty("路由路径") + private String path; + + /** + * 元数据 + */ + @ApiModelProperty("元数据") + private MetaBo meta; + + public MenuBo() { + } + + @Data + public static class MetaBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 是否隐藏 + */ + @ApiModelProperty("是否隐藏") + private Boolean hideMenu; + + /** + * 是否不缓存 + */ + @ApiModelProperty("是否不缓存") + private Boolean ignoreKeepAlive; + + /** + * 是否固定 + */ + @ApiModelProperty("是否固定") + private Boolean affix = Boolean.FALSE; + + /** + * 是否外部链接 + */ + @ApiModelProperty("是否外部链接") + private Boolean isLink = Boolean.FALSE; + + /** + * 是否收藏 + */ + @ApiModelProperty("是否收藏") + private Boolean isCollect = Boolean.FALSE; + + /** + * 内嵌链接地址 + */ + @ApiModelProperty("内嵌链接地址") + private String frameSrc; + + /** + * 自定义列表ID + */ + @ApiModelProperty("自定义列表ID") + private String customListId; + + /** + * 自定义页面ID + */ + @ApiModelProperty("自定义页面ID") + private String customPageId; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/TelephoneLoginBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/TelephoneLoginBo.java new file mode 100644 index 0000000..f755f18 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/auth/TelephoneLoginBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.inner.bo.auth; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.template.inner.dto.LoginDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 手机号登录Bo + * + * @author zmj + * @since 2022/4/25 + */ +@Data +public class TelephoneLoginBo extends BaseBo { + + /** + * 登录信息 + */ + @ApiModelProperty("登录信息") + private LoginBo loginInfo; + + /** + * 是否绑定用户 + */ + @ApiModelProperty("是否绑定用户") + private Boolean isBind = Boolean.TRUE; + + public TelephoneLoginBo() { + + } + + public TelephoneLoginBo(LoginDto dto) { + + this.afterInit(dto); + } + + @Override + protected void afterInit(LoginDto dto) { + + this.loginInfo = new LoginBo(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/oplog/OpLogInUserCenterBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/oplog/OpLogInUserCenterBo.java new file mode 100644 index 0000000..4e8de4d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/oplog/OpLogInUserCenterBo.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.template.inner.bo.oplog; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.template.core.entity.OpLogs; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class OpLogInUserCenterBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 日志名称 + */ + @ApiModelProperty("日志名称") + private String name; + + /** + * 类别 + */ + @ApiModelProperty("类别") + private Integer logType; + + /** + * IP + */ + @ApiModelProperty("IP") + private String ip; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public OpLogInUserCenterBo() { + + } + + public OpLogInUserCenterBo(OpLogs dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/qrtz/GetQrtzBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/qrtz/GetQrtzBo.java new file mode 100644 index 0000000..61b415b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/qrtz/GetQrtzBo.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.template.inner.bo.qrtz; + +import com.lframework.xingyun.template.inner.dto.qrtz.QrtzDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.Data; + +@Data +public class GetQrtzBo extends BaseBo { + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分组 + */ + @ApiModelProperty("分组") + private String group; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private Integer tenantId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 执行类名 + */ + @ApiModelProperty("执行类名") + private String targetClassName; + + /** + * 执行方法名 + */ + @ApiModelProperty("执行方法名") + private String targetMethodName; + + /** + * 执行参数类型 + */ + @ApiModelProperty("执行参数类型") + private List targetParamTypes; + + /** + * 执行参数 + */ + @ApiModelProperty("执行参数") + private List targetParams; + + /** + * 脚本 + */ + @ApiModelProperty("脚本") + private String script; + + /** + * 任务类型 + */ + @ApiModelProperty("任务类型") + private Integer jobType; + + /** + * Cron表达式 + */ + @ApiModelProperty("Cron表达式") + private String cron; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private String state; + + public GetQrtzBo(QrtzDto dto) { + super(dto); + } + + @Override + public BaseBo convert(QrtzDto dto) { + return super.convert(dto, GetQrtzBo::getState); + } + + @Override + protected void afterInit(QrtzDto dto) { + this.jobType = dto.getJobType().getCode(); + if (dto.getState() != null) { + this.state = dto.getState().getCode(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/qrtz/QueryQrtzBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/qrtz/QueryQrtzBo.java new file mode 100644 index 0000000..fafda0f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/qrtz/QueryQrtzBo.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.inner.bo.qrtz; + +import com.lframework.xingyun.template.inner.dto.qrtz.QrtzDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryQrtzBo extends BaseBo { + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分组 + */ + @ApiModelProperty("分组") + private String group; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 任务类型 + */ + @ApiModelProperty("任务类型") + private Integer jobType; + + /** + * Cron表达式 + */ + @ApiModelProperty("Cron表达式") + private String cron; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private String state; + + public QueryQrtzBo(QrtzDto dto) { + super(dto); + } + + @Override + public BaseBo convert(QrtzDto dto) { + return super.convert(dto, QueryQrtzBo::getState); + } + + @Override + protected void afterInit(QrtzDto dto) { + this.jobType = dto.getJobType().getCode(); + if (dto.getState() != null) { + this.state = dto.getState().getCode(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/GetSysDeptBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/GetSysDeptBo.java new file mode 100644 index 0000000..ffdb127 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/GetSysDeptBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.template.inner.bo.system.dept; + +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysDeptBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 简称 + */ + @ApiModelProperty("简称") + private String shortName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSysDeptBo() { + + } + + public GetSysDeptBo(SysDept dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/SysDeptSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/SysDeptSelectorBo.java new file mode 100644 index 0000000..4506a1d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/SysDeptSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.inner.bo.system.dept; + +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDeptSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SysDeptSelectorBo() { + + } + + public SysDeptSelectorBo(SysDept dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/SysDeptTreeBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/SysDeptTreeBo.java new file mode 100644 index 0000000..a7d6c1a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dept/SysDeptTreeBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.inner.bo.system.dept; + +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDeptTreeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SysDeptTreeBo() { + + } + + public SysDeptTreeBo(SysDept dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/GetSysDataDicBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/GetSysDataDicBo.java new file mode 100644 index 0000000..04c4ff6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/GetSysDataDicBo.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.template.inner.bo.system.dic; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.xingyun.template.inner.service.system.SysDataDicCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysDataDicBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + + public GetSysDataDicBo() { + + } + + public GetSysDataDicBo(SysDataDic dto) { + + super(dto); + } + + @Override + protected void afterInit(SysDataDic dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + SysDataDicCategoryService sysDataDicCategoryService = ApplicationUtil.getBean( + SysDataDicCategoryService.class); + SysDataDicCategory category = sysDataDicCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/QuerySysDataDicBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/QuerySysDataDicBo.java new file mode 100644 index 0000000..c1c7816 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/QuerySysDataDicBo.java @@ -0,0 +1,64 @@ +package com.lframework.xingyun.template.inner.bo.system.dic; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.xingyun.template.inner.service.system.SysDataDicCategoryService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QuerySysDataDicBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; + + /** + * 分类名称 + */ + @ApiModelProperty("分类名称") + private String categoryName; + + + public QuerySysDataDicBo() { + + } + + public QuerySysDataDicBo(SysDataDic dto) { + + super(dto); + } + + @Override + protected void afterInit(SysDataDic dto) { + if (!StringUtil.isBlank(dto.getCategoryId())) { + SysDataDicCategoryService sysDataDicCategoryService = ApplicationUtil.getBean( + SysDataDicCategoryService.class); + SysDataDicCategory category = sysDataDicCategoryService.findById(dto.getCategoryId()); + this.categoryName = category.getName(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/SysDataDicSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/SysDataDicSelectorBo.java new file mode 100644 index 0000000..699785f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/SysDataDicSelectorBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.inner.bo.system.dic; + +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDataDicSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public SysDataDicSelectorBo() { + } + + public SysDataDicSelectorBo(SysDataDic dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/GetSysDataDicCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/GetSysDataDicCategoryBo.java new file mode 100644 index 0000000..092745c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/GetSysDataDicCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.inner.bo.system.dic.category; + +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysDataDicCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public GetSysDataDicCategoryBo() { + + } + + public GetSysDataDicCategoryBo(SysDataDicCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/QuerySysDataDicCategoryBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/QuerySysDataDicCategoryBo.java new file mode 100644 index 0000000..3af3e9f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/QuerySysDataDicCategoryBo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.inner.bo.system.dic.category; + +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QuerySysDataDicCategoryBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + + public QuerySysDataDicCategoryBo() { + + } + + public QuerySysDataDicCategoryBo(SysDataDicCategory dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/SysDataDicCategorySelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/SysDataDicCategorySelectorBo.java new file mode 100644 index 0000000..0a25a2b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/category/SysDataDicCategorySelectorBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.inner.bo.system.dic.category; + +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDataDicCategorySelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public SysDataDicCategorySelectorBo() { + } + + public SysDataDicCategorySelectorBo(SysDataDicCategory dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/GetSysDataDicItemBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/GetSysDataDicItemBo.java new file mode 100644 index 0000000..c9913d2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/GetSysDataDicItemBo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.template.inner.bo.system.dic.item; + +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysDataDicItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 字典ID + */ + @ApiModelProperty("字典ID") + private String dicId; + + /** + * 排序 + */ + @ApiModelProperty("排序") + private Integer orderNo; + + + public GetSysDataDicItemBo() { + + } + + public GetSysDataDicItemBo(SysDataDicItem dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/QuerySysDataDicItemBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/QuerySysDataDicItemBo.java new file mode 100644 index 0000000..ada02c7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/QuerySysDataDicItemBo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.template.inner.bo.system.dic.item; + +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QuerySysDataDicItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 字典ID + */ + @ApiModelProperty("字典ID") + private String dicId; + + /** + * 排序 + */ + @ApiModelProperty("排序") + private Integer orderNo; + + + public QuerySysDataDicItemBo() { + + } + + public QuerySysDataDicItemBo(SysDataDicItem dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/SysDataDicItemBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/SysDataDicItemBo.java new file mode 100644 index 0000000..e31d485 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/dic/item/SysDataDicItemBo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.template.inner.bo.system.dic.item; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDataDicItemBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + public SysDataDicItemBo() { + + } + + public SysDataDicItemBo(SysDataDicItem dto) { + + super(dto); + } + + @Override + protected void afterInit(SysDataDicItem dto) { + SysDataDicService sysDataDicService = ApplicationUtil.getBean(SysDataDicService.class); + SysDataDic dataDic = sysDataDicService.findById(dto.getDicId()); + this.id = dataDic.getCode() + StringPool.DATA_DIC_SPLIT + this.code; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/GetSysMenuBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/GetSysMenuBo.java new file mode 100644 index 0000000..eb00f7a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/GetSysMenuBo.java @@ -0,0 +1,192 @@ +package com.lframework.xingyun.template.inner.bo.system.menu; + +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.xingyun.template.gen.entity.GenCustomList; +import com.lframework.xingyun.template.gen.service.GenCustomListService; +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.xingyun.template.inner.enums.system.SysMenuComponentType; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysMenuBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称(前端使用) + */ + @ApiModelProperty("名称(前端使用)") + private String name; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 组件类型 + */ + @ApiModelProperty("组件类型(前端使用)") + private Integer componentType; + + /** + * 组件(前端使用) + */ + @ApiModelProperty("组件(前端使用)") + private String component; + + /** + * 自定义列表ID + */ + @ApiModelProperty("自定义列表ID") + private String customListId; + + /** + * 自定义列表名称 + */ + @ApiModelProperty("自定义列表名称") + private String customListName; + + /** + * 自定义表单ID + */ + @ApiModelProperty("自定义表单ID") + private String customFormId; + + /** + * 自定义表单名称 + */ + @ApiModelProperty("自定义表单名称") + private String customFormName; + + /** + * 自定义请求参数 + */ + @ApiModelProperty("自定义请求参数") + private String requestParam; + + /** + * 自定义页面ID + */ + @ApiModelProperty("自定义页面ID") + private String customPageId; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 父级名称 + */ + @ApiModelProperty("父级名称") + private String parentName; + + /** + * 路由路径(前端使用) + */ + @ApiModelProperty("路由路径(前端使用)") + private String path; + + /** + * 是否缓存(前端使用) + */ + @ApiModelProperty("是否缓存(前端使用)") + private Boolean noCache; + + /** + * 类型 0-目录 1-菜单 2-功能 + */ + @ApiModelProperty("类型 0-目录 1-菜单 2-功能") + private Integer display; + + /** + * 是否隐藏(前端使用) + */ + @ApiModelProperty("是否隐藏(前端使用)") + private Boolean hidden; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 是否特殊菜单 + */ + @ApiModelProperty("是否特殊菜单") + private Boolean isSpecial; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSysMenuBo() { + + } + + public GetSysMenuBo(SysMenu dto) { + + super(dto); + } + + @Override + public BaseBo convert(SysMenu dto) { + + return super.convert(dto, GetSysMenuBo::getDisplay); + } + + @Override + protected void afterInit(SysMenu dto) { + + this.display = dto.getDisplay().getCode(); + if (!StringUtil.isBlank(dto.getParentId())) { + SysMenuService sysMenuService = ApplicationUtil.getBean(SysMenuService.class); + this.parentName = sysMenuService.findById(dto.getParentId()).getTitle(); + } + + this.componentType = dto.getComponentType() == null ? null : dto.getComponentType().getCode(); + if (dto.getComponentType() == SysMenuComponentType.CUSTOM_LIST) { + this.customListId = dto.getComponent(); + GenCustomListService genCustomListService = ApplicationUtil + .getBean(GenCustomListService.class); + GenCustomList customList = genCustomListService.findById(dto.getComponent()); + this.customListName = customList.getName(); + } else if (dto.getComponentType() == SysMenuComponentType.CUSTOM_PAGE) { + this.customPageId = dto.getComponent(); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/QuerySysMenuBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/QuerySysMenuBo.java new file mode 100644 index 0000000..d78370b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/QuerySysMenuBo.java @@ -0,0 +1,93 @@ +package com.lframework.xingyun.template.inner.bo.system.menu; + +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QuerySysMenuBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 类型 + */ + @ApiModelProperty("类型") + private Integer display; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 是否特殊菜单 + */ + @ApiModelProperty("是否特殊菜单") + private Boolean isSpecial; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public QuerySysMenuBo() { + + } + + public QuerySysMenuBo(SysMenu dto) { + + super(dto); + } + + @Override + public BaseBo convert(SysMenu dto) { + + return super.convert(dto, QuerySysMenuBo::getDisplay); + } + + @Override + protected void afterInit(SysMenu dto) { + + this.display = dto.getDisplay().getCode(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/SysMenuSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/SysMenuSelectorBo.java new file mode 100644 index 0000000..430fad7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/menu/SysMenuSelectorBo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.template.inner.bo.system.menu; + +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysMenuSelectorBo extends BaseBo { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + public SysMenuSelectorBo() { + + } + + public SysMenuSelectorBo(SysMenu dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/module/QuerySysModuleBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/module/QuerySysModuleBo.java new file mode 100644 index 0000000..e9ec361 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/module/QuerySysModuleBo.java @@ -0,0 +1,45 @@ +package com.lframework.xingyun.template.inner.bo.system.module; + +import com.lframework.xingyun.template.inner.entity.SysModule; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySysModuleBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private Integer id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 是否启用 + */ + @ApiModelProperty("是否启用") + private Boolean enabled; + + /** + * 过期时间 + */ + @ApiModelProperty("过期时间") + private LocalDateTime expireTime; + + public QuerySysModuleBo(SysModule dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/GetSysNoticeBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/GetSysNoticeBo.java new file mode 100644 index 0000000..b451b0a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/GetSysNoticeBo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.template.inner.bo.system.notice; + +import com.lframework.xingyun.template.inner.entity.SysNotice; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 系统通知 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetSysNoticeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 内容 + */ + @ApiModelProperty("内容") + private String content; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 是否发布 + */ + @ApiModelProperty("是否发布") + private Boolean published; + + public GetSysNoticeBo() { + + } + + public GetSysNoticeBo(SysNotice dto) { + + super(dto); + } + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/QueryMySysNoticeBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/QueryMySysNoticeBo.java new file mode 100644 index 0000000..13ad41a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/QueryMySysNoticeBo.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.template.inner.bo.system.notice; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.xingyun.template.inner.dto.system.notice.QuerySysNoticeByUserDto; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 我的系统通知 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QueryMySysNoticeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 是否已读 + */ + @ApiModelProperty("是否已读") + private Boolean readed; + + /** + * 发布时间 + */ + @ApiModelProperty("发布时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime publishTime; + + public QueryMySysNoticeBo() { + + } + + public QueryMySysNoticeBo(QuerySysNoticeByUserDto dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/QuerySysNoticeBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/QuerySysNoticeBo.java new file mode 100644 index 0000000..b94376b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/notice/QuerySysNoticeBo.java @@ -0,0 +1,89 @@ +package com.lframework.xingyun.template.inner.bo.system.notice; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.xingyun.template.inner.entity.SysNotice; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统通知 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QuerySysNoticeBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 是否发布 + */ + @ApiModelProperty("是否发布") + private Boolean published; + + /** + * 发布时间 + */ + @ApiModelProperty("发布时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime publishTime; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 已读人数 + */ + @ApiModelProperty("已读人数") + private Integer readedNum; + + /** + * 未读人数 + */ + @ApiModelProperty("未读人数") + private Integer unReadNum; + + public QuerySysNoticeBo() { + + } + + public QuerySysNoticeBo(SysNotice dto) { + + super(dto); + } + + @Override + protected void afterInit(SysNotice dto) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/GetSysOpenDomainBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/GetSysOpenDomainBo.java new file mode 100644 index 0000000..21db57c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/GetSysOpenDomainBo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.template.inner.bo.system.open; + +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.starter.web.annotations.convert.EncryptConvert; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysOpenDomainBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * API密钥 + */ + @ApiModelProperty("API密钥") + @EncryptConvert + private String apiSecret; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private Integer tenantId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSysOpenDomainBo() { + + } + + public GetSysOpenDomainBo(SysOpenDomain dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/QuerySysOpenDomainBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/QuerySysOpenDomainBo.java new file mode 100644 index 0000000..1ad6fda --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/QuerySysOpenDomainBo.java @@ -0,0 +1,57 @@ +package com.lframework.xingyun.template.inner.bo.system.open; + +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.starter.web.annotations.convert.EncryptConvert; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QuerySysOpenDomainBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * API密钥 + */ + @ApiModelProperty("API密钥") + @EncryptConvert + private String apiSecret; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private Integer tenantId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public QuerySysOpenDomainBo() { + + } + + public QuerySysOpenDomainBo(SysOpenDomain dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/SysOpenDomainSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/SysOpenDomainSelectorBo.java new file mode 100644 index 0000000..5c94117 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/open/SysOpenDomainSelectorBo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.inner.bo.system.open; + +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysOpenDomainSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SysOpenDomainSelectorBo() { + } + + public SysOpenDomainSelectorBo(SysOpenDomain dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/oplog/GetOpLogBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/oplog/GetOpLogBo.java new file mode 100644 index 0000000..1ec2541 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/oplog/GetOpLogBo.java @@ -0,0 +1,65 @@ +package com.lframework.xingyun.template.inner.bo.system.oplog; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.template.core.entity.OpLogs; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class GetOpLogBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 日志名称 + */ + @ApiModelProperty("日志名称") + private String name; + + /** + * 类别 + */ + @ApiModelProperty("类别") + private Integer logType; + + /** + * IP地址 + */ + @ApiModelProperty("IP地址") + private String ip; + + /** + * 补充信息 + */ + @ApiModelProperty("补充信息") + private String extra; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public GetOpLogBo() { + + } + + public GetOpLogBo(OpLogs dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/oplog/QueryOpLogBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/oplog/QueryOpLogBo.java new file mode 100644 index 0000000..2790b15 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/oplog/QueryOpLogBo.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.template.inner.bo.system.oplog; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.template.core.entity.OpLogs; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QueryOpLogBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 日志名称 + */ + @ApiModelProperty("日志名称") + private String name; + + /** + * 类别 + */ + @ApiModelProperty("类别") + private Integer logType; + + /** + * IP地址 + */ + @ApiModelProperty("IP地址") + private String ip; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QueryOpLogBo() { + + } + + public QueryOpLogBo(OpLogs dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/parameter/GetSysParameterBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/parameter/GetSysParameterBo.java new file mode 100644 index 0000000..9c18fc7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/parameter/GetSysParameterBo.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.template.inner.bo.system.parameter; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.lframework.xingyun.template.inner.entity.SysParameter; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 系统参数 GetBo + *

+ * + * @author zmj + */ +@Data +public class GetSysParameterBo extends BaseBo { + + /** + * ID + */ + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("ID") + private Long id; + + /** + * 键 + */ + @ApiModelProperty("键") + private String pmKey; + + /** + * 值 + */ + @ApiModelProperty("值") + private String pmValue; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSysParameterBo() { + + } + + public GetSysParameterBo(SysParameter dto) { + + super(dto); + } + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/parameter/QuerySysParameterBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/parameter/QuerySysParameterBo.java new file mode 100644 index 0000000..6fa695f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/parameter/QuerySysParameterBo.java @@ -0,0 +1,73 @@ +package com.lframework.xingyun.template.inner.bo.system.parameter; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.xingyun.template.inner.entity.SysParameter; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统参数 QueryBo + *

+ * + * @author zmj + */ +@Data +public class QuerySysParameterBo extends BaseBo { + + /** + * ID + */ + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("ID") + private Long id; + + /** + * 键 + */ + @ApiModelProperty("键") + private String pmKey; + + /** + * 值 + */ + @ApiModelProperty("值") + private String pmValue; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + public QuerySysParameterBo() { + + } + + public QuerySysParameterBo(SysParameter dto) { + + super(dto); + } + + @Override + protected void afterInit(SysParameter dto) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/permission/QuerySysDataPermissionModelDetailBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/permission/QuerySysDataPermissionModelDetailBo.java new file mode 100644 index 0000000..834d0a8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/permission/QuerySysDataPermissionModelDetailBo.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.template.inner.bo.system.permission; + +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.VoidDto; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.Data; + +@Data +public class QuerySysDataPermissionModelDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 明细ID + */ + @ApiModelProperty("明细ID") + private Integer detailId; + + /** + * 节点类型 + */ + @ApiModelProperty("节点类型") + private Integer nodeType; + + /** + * 计算类型 + */ + @ApiModelProperty("计算类型") + private Integer calcType; + + /** + * 值 + */ + @ApiModelProperty("值") + private String value; + + /** + * 值 + */ + @ApiModelProperty("值") + private List values; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 模型ID + */ + @ApiModelProperty("模型ID") + private Integer modelId; + + /** + * 条件 + */ + @ApiModelProperty("条件") + private Integer[] conditionTypes; + + /** + * 输入类型 + */ + @ApiModelProperty("输入类型") + @EnumConvert + private Integer inputType; + + /** + * 条件类型 + */ + @ApiModelProperty("条件类型") + private Integer conditionType; + + /** + * 前段枚举名 + */ + @ApiModelProperty("前端枚举名") + private String enumName; + + /** + * 子节点 + */ + @ApiModelProperty("子节点") + private List children; + + public QuerySysDataPermissionModelDetailBo() { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/permission/SysDataPermissionModelDetailBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/permission/SysDataPermissionModelDetailBo.java new file mode 100644 index 0000000..5fbe83b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/permission/SysDataPermissionModelDetailBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.template.inner.bo.system.permission; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.web.annotations.convert.EnumConvert; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.template.core.entity.SysDataPermissionModelDetail; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDataPermissionModelDetailBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private Integer id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 模型ID + */ + @ApiModelProperty("模型ID") + private Integer modelId; + + /** + * 条件 + */ + @ApiModelProperty("条件") + private String[] conditionTypes; + + /** + * 输入类型 + */ + @ApiModelProperty("输入类型") + @EnumConvert + private Integer inputType; + + /** + * 前段枚举名 + */ + @ApiModelProperty("前端枚举名") + private String enumName; + + public SysDataPermissionModelDetailBo() { + } + + public SysDataPermissionModelDetailBo(SysDataPermissionModelDetail dto) { + super(dto); + } + + @Override + protected void afterInit(SysDataPermissionModelDetail dto) { + this.conditionTypes = dto.getConditionType().split(StringPool.STR_SPLIT); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/GetSysPositionBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/GetSysPositionBo.java new file mode 100644 index 0000000..14c1f2a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/GetSysPositionBo.java @@ -0,0 +1,54 @@ +package com.lframework.xingyun.template.inner.bo.system.position; + +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysPositionBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSysPositionBo() { + + } + + public GetSysPositionBo(SysPosition dto) { + + super(dto); + } + + @Override + protected void afterInit(SysPosition dto) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/QuerySysPositionBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/QuerySysPositionBo.java new file mode 100644 index 0000000..5d660bc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/QuerySysPositionBo.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.template.inner.bo.system.position; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySysPositionBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySysPositionBo() { + + } + + public QuerySysPositionBo(SysPosition dto) { + + super(dto); + } + + @Override + protected void afterInit(SysPosition dto) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/SysPositionSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/SysPositionSelectorBo.java new file mode 100644 index 0000000..4e6cffb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/position/SysPositionSelectorBo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.template.inner.bo.system.position; + +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysPositionSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SysPositionSelectorBo() { + + } + + public SysPositionSelectorBo(SysPosition dto) { + + super(dto); + } + + @Override + protected void afterInit(SysPosition dto) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/GetSysRoleBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/GetSysRoleBo.java new file mode 100644 index 0000000..bfe97b9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/GetSysRoleBo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.template.inner.bo.system.role; + +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetSysRoleBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSysRoleBo() { + + } + + public GetSysRoleBo(SysRole dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/QueryRoleMenuBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/QueryRoleMenuBo.java new file mode 100644 index 0000000..fc02d23 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/QueryRoleMenuBo.java @@ -0,0 +1,85 @@ +package com.lframework.xingyun.template.inner.bo.system.role; + +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryRoleMenuBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 类型 + */ + @ApiModelProperty("类型") + private Integer display; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 是否选择 + */ + @ApiModelProperty("是否选择") + private Boolean selected = Boolean.FALSE; + + public QueryRoleMenuBo() { + + } + + public QueryRoleMenuBo(SysMenu dto) { + + super(dto); + } + + @Override + public
BaseBo convert(SysMenu dto) { + + return super.convert(dto, QueryRoleMenuBo::getDisplay); + } + + @Override + protected void afterInit(SysMenu dto) { + + this.display = dto.getDisplay().getCode(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/QuerySysRoleBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/QuerySysRoleBo.java new file mode 100644 index 0000000..ca78fcc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/QuerySysRoleBo.java @@ -0,0 +1,88 @@ +package com.lframework.xingyun.template.inner.bo.system.role; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySysRoleBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySysRoleBo() { + + } + + public QuerySysRoleBo(SysRole dto) { + + super(dto); + } + + @Override + protected void afterInit(SysRole dto) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/SysRoleSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/SysRoleSelectorBo.java new file mode 100644 index 0000000..039f6c1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/role/SysRoleSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.inner.bo.system.role; + +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysRoleSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SysRoleSelectorBo() { + + } + + public SysRoleSelectorBo(SysRole dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/GetTenantBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/GetTenantBo.java new file mode 100644 index 0000000..c5ab240 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/GetTenantBo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.template.inner.bo.system.tenant; + +import com.lframework.starter.web.annotations.constants.EncryType; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.starter.web.annotations.convert.EncryptConvert; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class GetTenantBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * JdbcUrl + */ + @ApiModelProperty("JdbcUrl") + @EncryptConvert + private String jdbcUrl; + + /** + * Jdbc用户名 + */ + @ApiModelProperty("Jdbc用户名") + @EncryptConvert + private String jdbcUsername; + + /** + * Jdbc密码 + */ + @ApiModelProperty("Jdbc密码") + @EncryptConvert(type = EncryType.PASSWORD) + private String jdbcPassword; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public GetTenantBo(Tenant dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/QueryTenantBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/QueryTenantBo.java new file mode 100644 index 0000000..198c83b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/QueryTenantBo.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.template.inner.bo.system.tenant; + +import com.lframework.starter.web.annotations.constants.EncryType; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.starter.web.annotations.convert.EncryptConvert; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryTenantBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * JdbcUrl + */ + @ApiModelProperty("JdbcUrl") + @EncryptConvert + private String jdbcUrl; + + /** + * Jdbc用户名 + */ + @ApiModelProperty("Jdbc用户名") + @EncryptConvert + private String jdbcUsername; + + /** + * Jdbc密码 + */ + @ApiModelProperty("Jdbc密码") + @EncryptConvert(type = EncryType.PASSWORD) + private String jdbcPassword; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public QueryTenantBo(Tenant dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/TenantSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/TenantSelectorBo.java new file mode 100644 index 0000000..ed082f9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/tenant/TenantSelectorBo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.inner.bo.system.tenant; + +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class TenantSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public TenantSelectorBo() { + + } + + public TenantSelectorBo(Tenant dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/GetSysUserBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/GetSysUserBo.java new file mode 100644 index 0000000..7a5ea95 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/GetSysUserBo.java @@ -0,0 +1,228 @@ +package com.lframework.xingyun.template.inner.bo.system.user; + +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.xingyun.template.inner.entity.SysUserDept; +import com.lframework.xingyun.template.inner.entity.SysUserPosition; +import com.lframework.xingyun.template.inner.entity.SysUserRole; +import com.lframework.xingyun.template.inner.service.system.SysDeptService; +import com.lframework.xingyun.template.inner.service.system.SysPositionService; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.xingyun.template.inner.service.system.SysUserDeptService; +import com.lframework.xingyun.template.inner.service.system.SysUserPositionService; +import com.lframework.xingyun.template.inner.service.system.SysUserRoleService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.dto.VoidDto; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import lombok.Data; + +@Data +public class GetSysUserBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 用户名 + */ + @ApiModelProperty("用户名") + private String username; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱") + private String email; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 性别 + */ + @ApiModelProperty("性别") + private Integer gender; + + /** + * 岗位 + */ + @ApiModelProperty("岗位") + private List positions; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String positionName; + + /** + * 部门 + */ + @ApiModelProperty("部门") + private List depts; + + /** + * 部门名称 + */ + @ApiModelProperty("部门名称") + private String deptName; + + + /** + * 角色 + */ + @ApiModelProperty("角色") + private List roles; + + /** + * 角色名称 + */ + @ApiModelProperty("角色名称") + private String roleName; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 是否锁定 + */ + @ApiModelProperty("是否锁定") + private Boolean lockStatus; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + public GetSysUserBo() { + + } + + public GetSysUserBo(SysUser dto) { + + super(dto); + } + + @Override + protected void afterInit(SysUser dto) { + + SysUserPositionService sysUserPositionService = ApplicationUtil.getBean( + SysUserPositionService.class); + List userPositions = sysUserPositionService.getByUserId(dto.getId()); + if (!CollectionUtil.isEmpty(userPositions)) { + SysPositionService sysPositionService = ApplicationUtil.getBean(SysPositionService.class); + this.positions = userPositions.stream().map(SysUserPosition::getPositionId) + .collect(Collectors.toList()); + + this.positionName = StringUtil.join(StringPool.STR_SPLIT_CN, + userPositions.stream().map(t -> sysPositionService.findById(t.getPositionId())) + .filter(Objects::nonNull).map(SysPosition::getName) + .collect(Collectors.toList())); + } + + SysUserDeptService sysUserDeptService = ApplicationUtil.getBean(SysUserDeptService.class); + List userDepts = sysUserDeptService.getByUserId(dto.getId()); + if (!CollectionUtil.isEmpty(userDepts)) { + SysDeptService sysDeptService = ApplicationUtil.getBean(SysDeptService.class); + this.depts = userDepts.stream().map(SysUserDept::getDeptId) + .collect(Collectors.toList()); + + this.deptName = StringUtil.join(StringPool.STR_SPLIT_CN, + userDepts.stream().map(t -> sysDeptService.findById(t.getDeptId())) + .filter(Objects::nonNull).map(SysDept::getName) + .collect(Collectors.toList())); + } + + SysUserRoleService sysUserRoleService = ApplicationUtil.getBean(SysUserRoleService.class); + List userRoles = sysUserRoleService.getByUserId(dto.getId()); + if (!CollectionUtil.isEmpty(userRoles)) { + SysRoleService sysRoleService = ApplicationUtil.getBean(SysRoleService.class); + this.roles = userRoles.stream().map(SysUserRole::getRoleId) + .collect(Collectors.toList()); + + this.roleName = StringUtil.join(StringPool.STR_SPLIT_CN, + userRoles.stream().map(t -> sysRoleService.findById(t.getRoleId())) + .filter(Objects::nonNull).map(SysRole::getName) + .collect(Collectors.toList())); + } + } + + @Data + public static class PositionBo extends BaseBo { + + /** + * 岗位ID + */ + @ApiModelProperty("岗位ID") + private String id; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String name; + } + + @Data + public static class DeptBo extends BaseBo { + + /** + * 部门ID + */ + @ApiModelProperty("部门ID") + private String id; + + /** + * 部门名称 + */ + @ApiModelProperty("部门名称") + private String name; + } + + @Data + public static class RoleBo extends BaseBo { + + /** + * 角色ID + */ + @ApiModelProperty("角色ID") + private String id; + + /** + * 角色名称 + */ + @ApiModelProperty("角色名称") + private String name; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/QuerySysUserBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/QuerySysUserBo.java new file mode 100644 index 0000000..b23cf6e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/QuerySysUserBo.java @@ -0,0 +1,187 @@ +package com.lframework.xingyun.template.inner.bo.system.user; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.xingyun.template.inner.entity.SysUserDept; +import com.lframework.xingyun.template.inner.entity.SysUserPosition; +import com.lframework.xingyun.template.inner.entity.SysUserRole; +import com.lframework.xingyun.template.inner.service.system.SysDeptService; +import com.lframework.xingyun.template.inner.service.system.SysPositionService; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.xingyun.template.inner.service.system.SysUserDeptService; +import com.lframework.xingyun.template.inner.service.system.SysUserPositionService; +import com.lframework.xingyun.template.inner.service.system.SysUserRoleService; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import io.swagger.annotations.ApiModelProperty; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import lombok.Data; + +@Data +public class QuerySysUserBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + private String positionName; + + /** + * 部门名称 + */ + @ApiModelProperty("部门名称") + private String deptName; + + /** + * 角色名称 + */ + @ApiModelProperty("角色名称") + private String roleName; + + /** + * 用户名 + */ + @ApiModelProperty("用户名") + private String username; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱") + private String email; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 性别 + */ + @ApiModelProperty("性别") + private Integer gender; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 是否锁定 + */ + @ApiModelProperty("是否锁定") + private Boolean lockStatus; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime createTime; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String updateBy; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + private LocalDateTime updateTime; + + public QuerySysUserBo() { + + } + + public QuerySysUserBo(SysUser dto) { + + super(dto); + } + + @Override + protected void afterInit(SysUser dto) { + + SysUserPositionService sysUserPositionService = ApplicationUtil.getBean( + SysUserPositionService.class); + List userPositions = sysUserPositionService.getByUserId(dto.getId()); + if (!CollectionUtil.isEmpty(userPositions)) { + SysPositionService sysPositionService = ApplicationUtil.getBean(SysPositionService.class); + List positionNames = new ArrayList<>(userPositions.size()); + for (SysUserPosition userPosition : userPositions) { + SysPosition position = sysPositionService.findById(userPosition.getPositionId()); + positionNames.add(position.getName()); + } + + this.positionName = StringUtil.join(StringPool.STR_SPLIT_CN, positionNames); + } + + SysUserDeptService sysUserDeptService = ApplicationUtil.getBean(SysUserDeptService.class); + List userDepts = sysUserDeptService.getByUserId(dto.getId()); + if (!CollectionUtil.isEmpty(userDepts)) { + SysDeptService sysDeptService = ApplicationUtil.getBean(SysDeptService.class); + List deptNames = new ArrayList<>(userDepts.size()); + for (SysUserDept userDept : userDepts) { + SysDept dept = sysDeptService.findById(userDept.getDeptId()); + deptNames.add(dept.getName()); + } + + this.deptName = StringUtil.join(StringPool.STR_SPLIT_CN, deptNames); + } + + SysUserRoleService sysUserRoleService = ApplicationUtil.getBean(SysUserRoleService.class); + List userRoles = sysUserRoleService.getByUserId(dto.getId()); + if (!CollectionUtil.isEmpty(userRoles)) { + SysRoleService sysRoleService = ApplicationUtil.getBean(SysRoleService.class); + List roleNames = new ArrayList<>(userRoles.size()); + for (SysUserRole userRole : userRoles) { + SysRole role = sysRoleService.findById(userRole.getRoleId()); + roleNames.add(role.getName()); + } + + this.roleName = StringUtil.join(StringPool.STR_SPLIT_CN, roleNames); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/QueryUserRoleBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/QueryUserRoleBo.java new file mode 100644 index 0000000..49095d0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/QueryUserRoleBo.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.inner.bo.system.user; + +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QueryUserRoleBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 是否选中 + */ + @ApiModelProperty("是否选中") + private Boolean selected = Boolean.FALSE; + + public QueryUserRoleBo() { + + } + + public QueryUserRoleBo(SysRole dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/SysUserSelectorBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/SysUserSelectorBo.java new file mode 100644 index 0000000..4a05f61 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/system/user/SysUserSelectorBo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.inner.bo.system.user; + +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.starter.web.bo.BaseBo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysUserSelectorBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + public SysUserSelectorBo() { + + } + + public SysUserSelectorBo(SysUser dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/usercenter/UserInfoBo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/usercenter/UserInfoBo.java new file mode 100644 index 0000000..834854f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/bo/usercenter/UserInfoBo.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.template.inner.bo.usercenter; + +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.xingyun.template.inner.dto.UserInfoDto; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class UserInfoBo extends BaseBo { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 登录名 + */ + @ApiModelProperty("登录名") + private String username; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱") + private String email; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 性别 + */ + @ApiModelProperty("性别") + private Integer gender; + + public UserInfoBo() { + + } + + public UserInfoBo(UserInfoDto dto) { + + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/components/qrtz/DynamicQrtzJob.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/components/qrtz/DynamicQrtzJob.java new file mode 100644 index 0000000..401764a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/components/qrtz/DynamicQrtzJob.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.template.inner.components.qrtz; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ReflectUtil; +import com.lframework.xingyun.template.core.components.qrtz.QrtzJob; +import com.lframework.xingyun.template.inner.enums.QrtzJobType; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.GroovyUtil; +import java.lang.reflect.Method; +import java.util.List; +import org.quartz.JobDataMap; +import org.quartz.JobDetail; +import org.quartz.JobExecutionContext; + +/** + * @author zmj + * @since 2022/8/20 + */ +public class DynamicQrtzJob extends QrtzJob { + + @Override + protected void onExecute(JobExecutionContext context) throws Exception { + + JobDetail jobDetail = context.getJobDetail(); + JobDataMap jobDataMap = jobDetail.getJobDataMap(); + QrtzJobType jobType = EnumUtil.getByCode(QrtzJobType.class, jobDataMap.getInt("jobType")); + if (jobType == QrtzJobType.EXCUTE_CLASS) { + String targetClassName = jobDataMap.getString("targetClassName"); + String targetMethodName = jobDataMap.getString("targetMethodName"); + List targetParamTypes = (List) jobDataMap.get("targetParamTypes"); + List targetParams = (List) jobDataMap.get("targetParams"); + + Class clazz = Class.forName(targetClassName); + Object target = ReflectUtil.newInstance(clazz); + Class[] paramTypes = null; + if (!CollectionUtil.isEmpty(targetParamTypes)) { + paramTypes = new Class[targetParamTypes.size()]; + for (int i = 0; i < targetParamTypes.size(); i++) { + String targetParamType = targetParamTypes.get(i); + paramTypes[i] = Class.forName(targetParamType); + } + } + Object[] params = null; + if (!CollectionUtil.isEmpty(targetParams)) { + params = new Object[targetParams.size()]; + for (int i = 0; i < targetParams.size(); i++) { + String targetParamType = targetParams.get(i); + params[i] = targetParamType; + } + } + + Method method = ReflectUtil.getMethod(clazz, targetMethodName, paramTypes); + ReflectUtil.invoke(target, method, params); + } else { + String script = jobDataMap.getString("script"); + GroovyUtil.excuteScript(script); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/config/OpLogTimerConfiguration.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/config/OpLogTimerConfiguration.java new file mode 100644 index 0000000..8b09f6a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/config/OpLogTimerConfiguration.java @@ -0,0 +1,86 @@ +package com.lframework.xingyun.template.inner.config; + +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.xingyun.template.core.components.qrtz.QrtzJob; +import com.lframework.starter.web.utils.TenantUtil; +import com.lframework.xingyun.template.core.components.qrtz.QrtzHandler; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.xingyun.template.inner.service.TenantService; +import java.time.LocalDateTime; +import java.util.List; +import org.quartz.JobDetail; +import org.quartz.JobExecutionContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class OpLogTimerConfiguration implements ApplicationListener { + + private static final String JOB_NAME = "OP_LOG_TIMER"; + + private static final String JOB_GROUP_NAME = "OP_LOG_TIMER_GROUP"; + + private static final String TRIGGER_NAME = "OP_LOG_TIMER_TRIGGER"; + + private static final String TRIGGER_GROUP_NAME = "OP_LOG_TIMER_TRIGGER_GROUP"; + + @Value("${op-logs.enabled:'true'}") + private Boolean enabled; + + @Override + public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { + + // 没有使用@Bean的配置方式是因为当enabled==false时,需要移除定时任务 + JobDetail jobDetail = QrtzHandler.getJob(JOB_NAME, JOB_GROUP_NAME); + if (jobDetail == null) { + // 没有任务 + if (!this.enabled) { + return; + } + + QrtzHandler.addJob(JOB_NAME, JOB_GROUP_NAME, OpLogClearJob.class, TRIGGER_NAME, + TRIGGER_GROUP_NAME, + "0 0 * * * ? *"); + } else { + if (!this.enabled) { + QrtzHandler.deleteJob(JOB_NAME, JOB_GROUP_NAME, TRIGGER_NAME, TRIGGER_GROUP_NAME); + } + } + } + + public static class OpLogClearJob extends QrtzJob { + + @Autowired + private OpLogsService opLogsService; + + @Autowired + private TenantService tenantService; + + /** + * 操作日志保留天数 + */ + @Value("${op-logs.retain-days:7}") + private Integer retainDays; + + @Override + public void onExecute(JobExecutionContext context) { + + LocalDateTime now = LocalDateTime.now(); + LocalDateTime endTime = now.minusDays(retainDays); + + if (TenantUtil.enableTenant()) { + List tenants = tenantService.list(); + for (Tenant tenant : tenants) { + TenantContextHolder.setTenantId(tenant.getId()); + opLogsService.clearLogs(endTime); + } + } else { + opLogsService.clearLogs(endTime); + } + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/AuthController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/AuthController.java new file mode 100644 index 0000000..2f8bfdc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/AuthController.java @@ -0,0 +1,575 @@ +package com.lframework.xingyun.template.inner.controller; + +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.codec.Base64; +import com.google.code.kaptcha.Producer; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.UserLoginException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.annotations.OpenApi; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityConstants; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.CaptchaValidator; +import com.lframework.starter.web.components.redis.RedisHandler; +import com.lframework.starter.web.components.security.IUserTokenResolver; +import com.lframework.starter.web.components.security.PasswordEncoderWrapper; +import com.lframework.starter.web.components.security.UserDetailsService; +import com.lframework.starter.web.config.properties.KaptchaProperties; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.dto.GenerateCaptchaDto; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.JsonUtil; +import com.lframework.starter.web.utils.TenantUtil; +import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType; +import com.lframework.xingyun.template.core.entity.SysDataPermissionData; +import com.lframework.xingyun.template.core.enums.SysDataPermissionDataBizType; +import com.lframework.xingyun.template.core.service.SysDataPermissionModelDetailService; +import com.lframework.xingyun.template.core.vo.permission.SysDataPermissionModelDetailVo; +import com.lframework.xingyun.template.inner.bo.auth.CollectMenuBo; +import com.lframework.xingyun.template.inner.bo.auth.LoginBo; +import com.lframework.xingyun.template.inner.bo.auth.MenuBo; +import com.lframework.xingyun.template.inner.bo.auth.MenuBo.MetaBo; +import com.lframework.xingyun.template.inner.dto.LoginDto; +import com.lframework.xingyun.template.inner.dto.MenuDto; +import com.lframework.xingyun.template.inner.entity.SysUserDept; +import com.lframework.xingyun.template.inner.entity.SysUserRole; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.xingyun.template.inner.enums.system.SysMenuComponentType; +import com.lframework.xingyun.template.inner.enums.system.SysMenuDisplay; +import com.lframework.xingyun.template.inner.events.LoginEvent; +import com.lframework.xingyun.template.inner.events.LogoutEvent; +import com.lframework.xingyun.template.inner.service.SysModuleTenantService; +import com.lframework.xingyun.template.inner.service.TenantService; +import com.lframework.xingyun.template.inner.service.system.SysDataPermissionDataService; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import com.lframework.xingyun.template.inner.service.system.SysUserDeptService; +import com.lframework.xingyun.template.inner.service.system.SysUserRoleService; +import com.lframework.xingyun.template.inner.service.system.SysUserService; +import com.lframework.xingyun.template.inner.vo.system.user.LoginVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.imageio.ImageIO; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 默认用户认证Controller + * + * @author zmj + */ +@Api(tags = "用户认证") +@Slf4j +@Validated +@RestController +public class AuthController extends DefaultBaseController { + + @Autowired + private Producer producer; + + @Autowired + private KaptchaProperties kaptchaProperties; + + @Autowired + private RedisHandler redisHandler; + + @Autowired + private CaptchaValidator captchaValidator; + + @Autowired + private PasswordEncoderWrapper passwordEncoderWrapper; + + @Autowired + private SysMenuService sysMenuService; + + @Autowired + private UserDetailsService userDetailsService; + + @Autowired + private SysUserService sysUserService; + + @Autowired + private IUserTokenResolver userTokenResolver; + + @Autowired + private TenantService tenantService; + + @Autowired + private SysDataPermissionDataService sysDataPermissionDataService; + + @Autowired + private SysDataPermissionModelDetailService sysDataPermissionModelDetailService; + + @Autowired + private SysUserRoleService sysUserRoleService; + + @Autowired + private SysUserDeptService sysUserDeptService; + + @Autowired + private SysModuleTenantService sysModuleTenantService; + + /** + * 获取登录验证码 + */ + @ApiOperation(value = "获取登录验证码") + @OpenApi + @GetMapping("/auth/captcha") + public InvokeResult generateCaptcha() { + + String code = producer.createText(); + BufferedImage image = producer.createImage(code); + + // 转换流信息写出 + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try { + ImageIO.write(image, "jpg", os); + } catch (IOException e) { + throw new DefaultClientException("验证码生成失败,请稍后重试!"); + } + + String sn = IdUtil.getUUID(); + //将验证码存至redis + redisHandler.set(StringUtil.format(StringPool.LOGIN_CAPTCHA_KEY, sn), code, + kaptchaProperties.getExpireTime() * 60 * 1000L); + + GenerateCaptchaDto resp = new GenerateCaptchaDto(); + resp.setSn(sn); + resp.setImage("data:image/jpeg;base64," + Base64.encode(os.toByteArray())); + + log.debug("获取验证码成功, SN={}, code={}", sn, code); + + return InvokeResultBuilder.success(resp); + } + + @ApiOperation("登录") + @OpenApi + @PostMapping("/auth/login") + public InvokeResult login(@Valid LoginVo vo) { + + String username = vo.getUsername(); + String password = vo.getPassword(); + String tenantId = null; + if (TenantUtil.enableTenant()) { + String[] tmpArr = username.split("@"); + if (tmpArr.length <= 1) { + throw new DefaultClientException("用户名或密码错误!"); + } + + tenantId = tmpArr[0]; + username = tmpArr[1]; + + // 检查租户是否存在 + Tenant tenant = tenantService.getById(tenantId); + if (tenant == null) { + throw new DefaultClientException("用户名或密码错误!"); + } + + if (!tenant.getAvailable()) { + throw new DefaultClientException("用户已停用,无法登录!"); + } + + TenantContextHolder.setTenantId(tenant.getId()); + } + + log.info("用户 {} {} 开始登录", tenantId, username); + + String sn = vo.getSn(); + String captcha = vo.getCaptcha(); + captchaValidator.validate(sn, captcha); + + this.checkUserLogin(tenantId == null ? null : Integer.valueOf(tenantId), username, password); + + AbstractUserDetails user = userDetailsService.loadUserByUsername(username); + + LoginDto dto = this.doLogin(user); + + this.addAttributesToSession(user); + + return InvokeResultBuilder.success(new LoginBo(dto)); + } + + @ApiOperation("退出登录") + @OpenApi + @PostMapping("/auth/logout") + public InvokeResult logout() { + + AbstractUserDetails user = getCurrentUser(); + + String token = null; + if (user != null) { + token = userTokenResolver.getToken(); + } + + StpUtil.logout(); + + if (user != null) { + ApplicationUtil.publishEvent(new LogoutEvent(this, user, token)); + } + + return InvokeResultBuilder.success(); + } + + @ApiOperation(value = "获取用户信息") + @GetMapping("/auth/info") + public InvokeResult info() { + + AbstractUserDetails user = getCurrentUser(); + LoginDto info = new LoginDto(null, user.getName(), user.getPermissions()); + + return InvokeResultBuilder.success(new LoginBo(info)); + } + + @ApiOperation("获取用户菜单") + @GetMapping("/auth/menus") + public InvokeResult> menus() { + + AbstractUserDetails user = getCurrentUser(); + // 先查询当前租户使用的module + List moduleIds = null; + if (TenantUtil.enableTenant()) { + moduleIds = sysModuleTenantService.getAvailableModuleIdsByTenantId( + TenantContextHolder.getTenantId()); + } + List menus = sysMenuService.getMenuByUserId(user.getId(), user.isAdmin(), moduleIds); + + // 组装成树形菜单 + List topMenus = menus.stream().filter(t -> StringUtil.isBlank(t.getParentId())) + .collect(Collectors.toList()); + + List results = new ArrayList<>(); + for (MenuDto topMenu : topMenus) { + MenuBo menuBo = new MenuBo(); + menuBo.setName(topMenu.getName()); + menuBo.setComponent("LAYOUT"); + menuBo.setChildren(parseChildrenMenu(topMenu, menus)); + menuBo.setPath(topMenu.getPath()); + + MenuBo.MetaBo meta = new MetaBo(); + meta.setId(topMenu.getId()); + meta.setTitle(topMenu.getMeta().getTitle()); + meta.setIcon(topMenu.getMeta().getIcon()); + meta.setHideMenu(topMenu.getHidden()); + meta.setIgnoreKeepAlive(topMenu.getMeta().getNoCache()); + meta.setIsCollect(topMenu.getIsCollect()); + + menuBo.setMeta(meta); + + results.add(menuBo); + } + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("验证当前登录人的登录密码") + @PostMapping("/auth/check/password") + public InvokeResult checkPassword( + @NotBlank(message = "登录密码不能为空!") String password) { + return InvokeResultBuilder.success(passwordEncoderWrapper.getEncoder() + .matches(password, SecurityUtil.getCurrentUser().getPassword())); + } + + private List parseChildrenMenu(MenuDto topMenu, List menus) { + List children = menus.stream() + .filter(t -> StringUtil.equals(t.getParentId(), topMenu.getId())).map(t -> { + MenuBo menuBo = new MenuBo(); + menuBo.setName(t.getName()); + menuBo.setChildren(parseChildrenMenu(t, menus)); + + menuBo.setComponent(t.getComponent()); + menuBo.setPath( + StringUtil.startWith(t.getPath(), "/") ? t.getPath().substring(1) : t.getPath()); + MenuBo.MetaBo meta = new MetaBo(); + meta.setId(t.getId()); + meta.setTitle(t.getMeta().getTitle()); + meta.setIcon(t.getMeta().getIcon()); + meta.setHideMenu(t.getHidden()); + meta.setIgnoreKeepAlive(t.getMeta().getNoCache()); + meta.setIsCollect(t.getIsCollect()); + if (RegUtil.isMatch(PatternPool.PATTERN_HTTP_URL, menuBo.getPath())) { + meta.setIsLink(Boolean.TRUE); + } + + // 如果是功能 + if (SysMenuDisplay.FUNCTION.getCode().equals(t.getDisplay())) { + // 普通 + if (SysMenuComponentType.NORMAL.getCode().equals(t.getComponentType())) { + if ("/iframes/index".equalsIgnoreCase(t.getComponent())) { + menuBo.setComponent(null); + meta.setFrameSrc(menuBo.getPath().substring(menuBo.getPath().indexOf("?src=") + 5)); + menuBo.setPath(menuBo.getPath().substring(0, menuBo.getPath().indexOf("?src="))); + } + } else if (SysMenuComponentType.CUSTOM_LIST.getCode().equals(t.getComponentType())) { + // 自定义列表 + menuBo.setComponent("CUSTOMLIST"); + meta.setCustomListId(t.getComponent()); + } else if (SysMenuComponentType.CUSTOM_PAGE.getCode().equals(t.getComponentType())) { + // 自定义页面 + menuBo.setComponent("CUSTOMPAGE"); + meta.setCustomPageId(t.getComponent()); + } + } + + menuBo.setMeta(meta); + + return menuBo; + }).collect(Collectors.toList()); + + return children; + } + + @ApiOperation("收藏菜单") + @ApiImplicitParam(value = "菜单ID", name = "menuId", paramType = "query") + @PostMapping("/menu/collect") + public InvokeResult collectMenu(String menuId) { + + AbstractUserDetails user = getCurrentUser(); + sysMenuService.collect(user.getId(), menuId); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("获取已收藏的菜单") + @GetMapping("/menu/collect") + public InvokeResult> getCollectMenus() { + AbstractUserDetails user = getCurrentUser(); + // 先查询当前租户使用的module + List moduleIds = null; + if (TenantUtil.enableTenant()) { + moduleIds = sysModuleTenantService.getAvailableModuleIdsByTenantId( + TenantContextHolder.getTenantId()); + } + List menus = sysMenuService.getMenuByUserId(user.getId(), user.isAdmin(), moduleIds); + + List collectMenus = menus.stream().filter(t -> t.getIsCollect()).collect(Collectors.toList()); + List results = collectMenus.stream().map(t -> { + CollectMenuBo result = new CollectMenuBo(); + result.setId(t.getId()); + result.setTitle(t.getMeta().getTitle()); + result.setIcon(t.getMeta().getIcon()); + if (StringUtil.isBlank(result.getIcon())) { + // 如果没有图标 那么就往上级找 + String icon = null; + String parentId = t.getParentId(); + while (StringUtil.isNotEmpty(parentId)) { + MenuDto parentMenu = null; + for (MenuDto m : menus) { + if (m.getId().equals(parentId)) { + parentMenu = m; + } + } + + if (parentMenu == null) { + break; + } + + if (StringUtil.isNotBlank(parentMenu.getMeta().getIcon())) { + icon = parentMenu.getMeta().getIcon(); + break; + } + + parentId = parentMenu.getParentId(); + } + result.setIcon(icon); + } + + List pathList = new ArrayList<>(); + pathList.add(t.getPath()); + String parentId = t.getParentId(); + while (StringUtil.isNotEmpty(parentId)) { + MenuDto parentMenu = null; + for (MenuDto m : menus) { + if (m.getId().equals(parentId)) { + parentMenu = m; + } + } + + if (parentMenu == null) { + break; + } + + if (StringUtil.isNotBlank(parentMenu.getPath())) { + pathList.add(parentMenu.getPath()); + } + + parentId = parentMenu.getParentId(); + } + + pathList = CollectionUtil.reverse(pathList); + result.setPath(CollectionUtil.join(pathList, "")); + + return result; + }).collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("取消收藏菜单") + @ApiImplicitParam(value = "菜单ID", name = "menuId", paramType = "query") + @PostMapping("/menu/collect/cancel") + public InvokeResult cancelCollectMenu(String menuId) { + + AbstractUserDetails user = getCurrentUser(); + sysMenuService.cancelCollect(user.getId(), menuId); + + return InvokeResultBuilder.success(); + } + + public LoginDto doLogin(AbstractUserDetails user) { + + if (!user.isAccountNonExpired()) { + throw new UserLoginException("账户已过期,不允许登录!"); + } + + if (!user.isAccountNonLocked()) { + throw new UserLoginException("账户已过期,不允许登录!"); + } + + if (!user.isAccountNonLocked()) { + throw new UserLoginException("账户已锁定,不允许登录!"); + } + + if (!user.isEnabled()) { + throw new UserLoginException("账户已停用,不允许登录!"); + } + + if (user.isNoPermission()) { + throw new UserLoginException("账户未授权,不允许登录!"); + } + // 登录 + StpUtil.login( + (user.getTenantId() == null ? "" : user.getTenantId() + "@") + user.getUsername()); + + StpUtil.getSession().set(SecurityConstants.USER_INFO_KEY, user); + + String token = userTokenResolver.getToken(); + ApplicationUtil.publishEvent(new LoginEvent(this, SecurityUtil.getCurrentUser(), token)); + + LoginDto dto = new LoginDto(token, user.getName(), user.getPermissions()); + + return dto; + } + + private void checkUserLogin(Integer tenantId, String username, String password) { + AbstractUserDetails user = userDetailsService.loadUserByUsername(username); + String lockKey = + (tenantId == null ? "noTenant" : tenantId) + "_" + username + "_" + DateUtil.formatDate( + LocalDate.now()) + "_LOGIN_LOCK"; + if (!passwordEncoderWrapper.getEncoder().matches(password, user.getPassword())) { + long loginErrorNum = redisHandler.incr(lockKey, 1); + redisHandler.expire(lockKey, 86400000L); + int failNum = 5; + if (loginErrorNum < failNum) { + throw new UserLoginException( + "您已经登录失败" + loginErrorNum + "次,您还可以尝试" + (failNum - loginErrorNum) + + "次!"); + } else { + sysUserService.lockById(user.getId()); + + sysUserService.cleanCacheByKey(user.getId()); + + redisHandler.expire(lockKey, 1L); + // 锁定用户 + throw new UserLoginException("用户已锁定,无法登录!"); + } + } else { + redisHandler.expire(lockKey, 1L); + } + } + + public void addAttributesToSession(AbstractUserDetails user) { + Map dataPermissionMap = new HashMap<>(); + SysDataPermissionDataPermissionType[] permissionTypes = SysDataPermissionDataPermissionType.values(); + for (SysDataPermissionDataPermissionType permissionType : permissionTypes) { + List sqlTemplates = new ArrayList<>(); + + List userRoles = sysUserRoleService.getByUserId(user.getId()); + if (CollectionUtil.isNotEmpty(userRoles)) { + for (SysUserRole userRole : userRoles) { + SysDataPermissionData permissionData = sysDataPermissionDataService.getByBizId( + userRole.getRoleId(), + SysDataPermissionDataBizType.ROLE.getCode(), permissionType.getCode()); + if (permissionData != null) { + String sqlTemplate = sysDataPermissionModelDetailService.toSql( + JsonUtil.parseList(permissionData.getPermission(), + SysDataPermissionModelDetailVo.class)); + if (StringUtil.isNotBlank(sqlTemplate)) { + sqlTemplates.add(sqlTemplate); + } + } + } + } + + List userDepts = sysUserDeptService.getByUserId(user.getId()); + if (CollectionUtil.isNotEmpty(userDepts)) { + for (SysUserDept userDept : userDepts) { + SysDataPermissionData permissionData = sysDataPermissionDataService.getByBizId( + userDept.getDeptId(), + SysDataPermissionDataBizType.DEPT.getCode(), permissionType.getCode()); + if (permissionData != null) { + String sqlTemplate = sysDataPermissionModelDetailService.toSql( + JsonUtil.parseList(permissionData.getPermission(), + SysDataPermissionModelDetailVo.class)); + if (StringUtil.isNotBlank(sqlTemplate)) { + sqlTemplates.add(sqlTemplate); + } + } + } + } + + SysDataPermissionData permissionData = sysDataPermissionDataService.getByBizId( + user.getId(), + SysDataPermissionDataBizType.USER.getCode(), permissionType.getCode()); + if (permissionData != null) { + String sqlTemplate = sysDataPermissionModelDetailService.toSql( + JsonUtil.parseList(permissionData.getPermission(), + SysDataPermissionModelDetailVo.class)); + if (StringUtil.isNotBlank(sqlTemplate)) { + sqlTemplates.add(sqlTemplate); + } + } + + if (CollectionUtil.isNotEmpty(sqlTemplates)) { + dataPermissionMap.put(permissionType.getCode().toString(), + "(" + CollectionUtil.join(sqlTemplates, " AND ") + ")"); + } + } + + StpUtil.getSession().set(SecurityConstants.DATA_PERMISSION_SQL_MAP, dataPermissionMap); + + Map dataPermissionVar = new HashMap<>(); + List userDepts = sysUserDeptService.getByUserId(user.getId()); + List curDeptIds = userDepts.stream().map(SysUserDept::getDeptId) + .map(t -> "'" + t + "'").collect( + Collectors.toList()); + dataPermissionVar.put("curDeptIds", + CollectionUtil.isEmpty(curDeptIds) ? IdUtil.getId() : CollectionUtil.join(curDeptIds, ",")); + + StpUtil.getSession().set(SecurityConstants.DATA_PERMISSION_SQL_VAR, dataPermissionVar); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/QrtzController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/QrtzController.java new file mode 100644 index 0000000..9178670 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/QrtzController.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.template.inner.controller; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.bo.qrtz.GetQrtzBo; +import com.lframework.xingyun.template.inner.bo.qrtz.QueryQrtzBo; +import com.lframework.xingyun.template.inner.service.QrtzService; +import com.lframework.xingyun.template.inner.vo.qrtz.CreateQrtzVo; +import com.lframework.xingyun.template.inner.vo.qrtz.QueryQrtzVo; +import com.lframework.xingyun.template.inner.vo.qrtz.UpdateQrtzVo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.template.inner.dto.qrtz.QrtzDto; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "定时器管理") +@RestController +@RequestMapping("/qrtz") +public class QrtzController extends DefaultBaseController { + + @Autowired + private QrtzService qrtzService; + + /** + * 查询列表 + * + * @param vo + * @return + */ + @ApiOperation("查询列表") + @HasPermission({"development:qrtz:manage"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryQrtzVo vo) { + + PageResult pageResult = qrtzService.query(getPageIndex(vo), getPageSize(vo), vo); + List datas = pageResult.getDatas(); + + List results = null; + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryQrtzBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询 + * + * @return + */ + @ApiOperation("查询") + @HasPermission({"development:qrtz:manage"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "名称不能为空!") String name, + @NotBlank(message = "组不能为空!") String group) { + QrtzDto data = qrtzService.findById(name, group); + if (data == null) { + throw new DefaultClientException("任务不存在!"); + } + + return InvokeResultBuilder.success(new GetQrtzBo(data)); + } + + /** + * 创建 + * + * @param vo + * @return + */ + @ApiOperation("创建") + @HasPermission({"development:qrtz:manage"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateQrtzVo vo) { + qrtzService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + * + * @param vo + * @return + */ + @ApiOperation("修改") + @HasPermission({"development:qrtz:manage"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateQrtzVo vo) { + qrtzService.update(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 暂停 + * + * @return + */ + @ApiOperation("暂停") + @HasPermission({"development:qrtz:manage"}) + @PutMapping("/pause") + public InvokeResult pause(@NotBlank(message = "名称不能为空!") String name, + @NotBlank(message = "组不能为空!") String group) { + qrtzService.pause(name, group); + + return InvokeResultBuilder.success(); + } + + /** + * 恢复 + * + * @return + */ + @ApiOperation("恢复") + @HasPermission({"development:qrtz:manage"}) + @PutMapping("/resume") + public InvokeResult resume(@NotBlank(message = "名称不能为空!") String name, + @NotBlank(message = "组不能为空!") String group) { + qrtzService.resume(name, group); + + return InvokeResultBuilder.success(); + } + + /** + * 触发 + * + * @return + */ + @ApiOperation("触发") + @HasPermission({"development:qrtz:manage"}) + @PutMapping("/trigger") + public InvokeResult trigger(@NotBlank(message = "名称不能为空!") String name, + @NotBlank(message = "组不能为空!") String group) { + qrtzService.trigger(name, group); + + return InvokeResultBuilder.success(); + } + + /** + * 删除 + * + * @return + */ + @ApiOperation("删除") + @HasPermission({"development:qrtz:manage"}) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "名称不能为空!") String name, + @NotBlank(message = "组不能为空!") String group) { + qrtzService.delete(name, group); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/UserCenterController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/UserCenterController.java new file mode 100644 index 0000000..48bb6f9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/UserCenterController.java @@ -0,0 +1,192 @@ +package com.lframework.xingyun.template.inner.controller; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.bo.usercenter.UserInfoBo; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.vo.QueryOpLogsVo; +import com.lframework.xingyun.template.inner.events.UpdateUserEvent; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.bo.oplog.OpLogInUserCenterBo; +import com.lframework.xingyun.template.inner.dto.UserInfoDto; +import com.lframework.xingyun.template.inner.service.system.SysUserService; +import com.lframework.starter.web.components.security.PasswordEncoderWrapper; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 用户中心 + * + * @author zmj + */ +@Api(tags = "个人中心") +@Validated +@RestController +@RequestMapping("/center") +public class UserCenterController extends DefaultBaseController { + + @Autowired + private SysUserService sysUserService; + + @Autowired + private OpLogsService opLogsService; + + @Autowired + private PasswordEncoderWrapper encoderWrapper; + + /** + * 获取用户信息 + */ + @ApiOperation(value = "获取用户信息") + @GetMapping("/info") + public InvokeResult getInfo() { + + String userId = getCurrentUser().getId(); + UserInfoDto info = sysUserService.getInfo(userId); + + return InvokeResultBuilder.success(new UserInfoBo(info)); + } + + /** + * 修改密码 + */ + @ApiOperation("修改密码") + @ApiImplicitParams({ + @ApiImplicitParam(value = "旧密码", name = "oldPsw", paramType = "query", required = true), + @ApiImplicitParam(value = "新密码", name = "newPsw", paramType = "query", required = true), + @ApiImplicitParam(value = "确认密码", name = "confirmPsw", paramType = "query", required = true)}) + @OpLog(type = DefaultOpLogType.AUTH, name = "修改密码,原密码:{},新密码:{}", params = {"#oldPsw", "#newPsw"}) + @PatchMapping("/password") + public InvokeResult updatePassword(@NotBlank(message = "旧密码不能为空!") String oldPsw, + @NotBlank(message = "新密码不能为空!") String newPsw, + @NotBlank(message = "确认密码不能为空!") String confirmPsw) { + + AbstractUserDetails user = getCurrentUser(); + if (!encoderWrapper.getEncoder().matches(oldPsw, user.getPassword())) { + throw new InputErrorException("旧密码不正确,请重新输入!"); + } + + if (!StringUtil.equals(newPsw, confirmPsw)) { + throw new InputErrorException("两次密码输入不一致,请检查!"); + } + + if (!RegUtil.isMatch(PatternPool.PATTERN_PASSWORD, newPsw)) { + throw new InputErrorException("密码格式不正确,请检查!"); + } + + sysUserService.updatePassword(user.getId(), newPsw); + + //修改密码后,退出登录状态 + SecurityUtil.logout(); + + return InvokeResultBuilder.success(); + } + + /** + * 修改邮箱 + */ + @ApiOperation("修改邮箱") + @ApiImplicitParams({ + @ApiImplicitParam(value = "新邮箱地址", name = "newEmail", paramType = "query", required = true), + @ApiImplicitParam(value = "确认邮箱地址", name = "confirmEmail", paramType = "query", required = true)}) + @OpLog(type = DefaultOpLogType.AUTH, name = "修改邮箱,新邮箱:{}", params = "#newEmail") + @PatchMapping("/email") + public InvokeResult updateEmail(@NotBlank(message = "新邮箱地址不能为空!") String newEmail, + @NotBlank(message = "确认邮箱地址不能为空!") String confirmEmail) { + + AbstractUserDetails user = getCurrentUser(); + + if (!StringUtil.equals(newEmail, confirmEmail)) { + throw new InputErrorException("两次邮箱地址输入不一致,请检查!"); + } + + if (!RegUtil.isMatch(PatternPool.EMAIL, newEmail)) { + throw new InputErrorException("邮箱地址格式不正确,请检查!"); + } + + sysUserService.updateEmail(user.getId(), newEmail); + + sysUserService.cleanCacheByKey(user.getId()); + + ApplicationUtil.publishEvent(new UpdateUserEvent(this, user.getId())); + + return InvokeResultBuilder.success(); + } + + /** + * 修改联系电话 + */ + @ApiOperation("修改联系电话") + @ApiImplicitParams({ + @ApiImplicitParam(value = "新联系电话", name = "newTelephone", paramType = "query", required = true), + @ApiImplicitParam(value = "确认联系电话", name = "confirmTelephone", paramType = "query", required = true)}) + @OpLog(type = DefaultOpLogType.AUTH, name = "修改联系电话,新联系电话:{}", params = "#newTelephone") + @PatchMapping("/telephone") + public InvokeResult updateTelephone(@NotBlank(message = "新联系电话不能为空!") String newTelephone, + @NotBlank(message = "确认联系电话不能为空!") String confirmTelephone) { + + AbstractUserDetails user = getCurrentUser(); + + if (!StringUtil.equals(newTelephone, confirmTelephone)) { + throw new InputErrorException("两次联系电话输入不一致,请检查!"); + } + + if (!RegUtil.isMatch(PatternPool.PATTERN_CN_TEL, newTelephone)) { + throw new InputErrorException("联系电话格式不正确,请检查!"); + } + + sysUserService.updateTelephone(user.getId(), newTelephone); + + sysUserService.cleanCacheByKey(user.getId()); + + ApplicationUtil.publishEvent(new UpdateUserEvent(this, user.getId())); + + return InvokeResultBuilder.success(); + } + + /** + * 查询操作日志 + */ + @ApiOperation("查询操作日志") + @GetMapping("/oplog") + public InvokeResult> oplog(@Valid QueryOpLogsVo vo) { + + vo.setCreateBy(SecurityUtil.getCurrentUser().getId()); + + PageResult pageResult = opLogsService.query(getPageIndex(vo), getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(OpLogInUserCenterBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/DefaultSysSelectorController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/DefaultSysSelectorController.java new file mode 100644 index 0000000..b59898a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/DefaultSysSelectorController.java @@ -0,0 +1,414 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.bo.system.dept.SysDeptSelectorBo; +import com.lframework.xingyun.template.inner.bo.system.dic.SysDataDicSelectorBo; +import com.lframework.xingyun.template.inner.bo.system.menu.SysMenuSelectorBo; +import com.lframework.xingyun.template.inner.bo.system.open.SysOpenDomainSelectorBo; +import com.lframework.xingyun.template.inner.bo.system.position.SysPositionSelectorBo; +import com.lframework.xingyun.template.inner.bo.system.role.SysRoleSelectorBo; +import com.lframework.xingyun.template.inner.bo.system.tenant.TenantSelectorBo; +import com.lframework.xingyun.template.inner.bo.system.user.SysUserSelectorBo; +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.SysModuleTenantService; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import com.lframework.xingyun.template.inner.service.system.SysPositionService; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.xingyun.template.inner.vo.system.dic.SysDataDicSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.dic.category.SysDataDicCategorySelectorVo; +import com.lframework.xingyun.template.inner.vo.system.menu.SysMenuSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.position.SysPositionSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.TenantSelectorVo; +import com.lframework.xingyun.template.inner.service.TenantService; +import com.lframework.xingyun.template.inner.service.system.SysDataDicCategoryService; +import com.lframework.xingyun.template.inner.service.system.SysDeptService; +import com.lframework.xingyun.template.inner.service.system.SysOpenDomainService; +import com.lframework.xingyun.template.inner.service.system.SysUserService; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.vo.system.open.SysOpenDomainSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.role.SysRoleSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserSelectorVo; +import com.lframework.xingyun.template.inner.bo.system.dic.category.SysDataDicCategorySelectorBo; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.TenantUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据选择器 + * + * @author zmj + */ +@Api(tags = "数据选择器") +@Validated +@RestController +@RequestMapping("/selector") +public class DefaultSysSelectorController extends DefaultBaseController { + + @Autowired + private SysUserService sysUserService; + + @Autowired + private SysMenuService sysMenuService; + + @Autowired + private SysDeptService sysDeptService; + + @Autowired + private SysPositionService sysPositionService; + + @Autowired + private SysRoleService sysRoleService; + + @Autowired + private SysDataDicCategoryService sysDataDicCategoryService; + + @Autowired + private SysDataDicService sysDataDicService; + + @Autowired + private SysOpenDomainService sysOpenDomainService; + + @Autowired + private TenantService tenantService; + + @Autowired + private SysModuleTenantService sysModuleTenantService; + + /** + * 系统菜单 + */ + @ApiOperation("系统菜单") + @GetMapping("/menu") + public InvokeResult> menu(@Valid SysMenuSelectorVo vo) { + + // 先查询当前租户使用的module + List moduleIds = null; + if (TenantUtil.enableTenant()) { + moduleIds = sysModuleTenantService.getAvailableModuleIdsByTenantId(TenantContextHolder.getTenantId()); + } + + List results = CollectionUtil.emptyList(); + List datas = sysMenuService.selector(vo, moduleIds); + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(SysMenuSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("部门") + @GetMapping("/dept") + public InvokeResult> dept() { + + List results = CollectionUtil.emptyList(); + List datas = sysDeptService.selector(); + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(SysDeptSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("角色") + @GetMapping("/role") + public InvokeResult> role(@Valid SysRoleSelectorVo vo) { + + PageResult pageResult = sysRoleService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(SysRoleSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载角色 + */ + @ApiOperation("加载角色") + @PostMapping("/role/load") + public InvokeResult> loadRole( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> sysRoleService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(SysRoleSelectorBo::new) + .collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("租户") + @GetMapping("/tenant") + public InvokeResult> tenant(@Valid TenantSelectorVo vo) { + + PageResult pageResult = tenantService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(TenantSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载租户 + */ + @ApiOperation("加载租户") + @PostMapping("/tenant/load") + public InvokeResult> loadTenant( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(Objects::nonNull) + .map(t -> tenantService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(TenantSelectorBo::new) + .collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("用户") + @GetMapping("/user") + public InvokeResult> user(@Valid SysUserSelectorVo vo) { + + PageResult pageResult = sysUserService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SysUserSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载用户 + */ + @ApiOperation("加载用户") + @PostMapping("/user/load") + public InvokeResult> loadUser( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> sysUserService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(SysUserSelectorBo::new) + .collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("岗位") + @GetMapping("/position") + public InvokeResult> position(@Valid SysPositionSelectorVo vo) { + + PageResult pageResult = sysPositionService.selector(getPageIndex(vo), + getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SysPositionSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载岗位 + */ + @ApiOperation("加载岗位") + @PostMapping("/position/load") + public InvokeResult> loadPosition( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> sysPositionService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(SysPositionSelectorBo::new) + .collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("数据字典分类") + @GetMapping("/dic/category") + public InvokeResult> dataDicCategory( + @Valid SysDataDicCategorySelectorVo vo) { + + PageResult pageResult = sysDataDicCategoryService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SysDataDicCategorySelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载数据字典分类 + */ + @ApiOperation("加载数据字典分类") + @PostMapping("/dic/category/load") + public InvokeResult> loadDataDicCategory( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> sysDataDicCategoryService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(SysDataDicCategorySelectorBo::new) + .collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("数据字典") + @GetMapping("/dic") + public InvokeResult> dataDic( + @Valid SysDataDicSelectorVo vo) { + + PageResult pageResult = sysDataDicService.selector(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SysDataDicSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载数据字典 + */ + @ApiOperation("加载数据字典") + @PostMapping("/dic/load") + public InvokeResult> loadDataDic( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(StringUtil::isNotBlank) + .map(t -> sysDataDicService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream() + .map(SysDataDicSelectorBo::new) + .collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 开放域 + */ + @ApiOperation("开放域") + @GetMapping("/openDomain") + public InvokeResult> openDomain( + @Valid SysOpenDomainSelectorVo vo) { + + PageResult pageResult = sysOpenDomainService.selector(vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(SysOpenDomainSelectorBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 加载开放域 + */ + @ApiOperation("加载开放域") + @PostMapping("/openDomain/load") + public InvokeResult> openDomain( + @RequestBody(required = false) List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List datas = ids.stream().filter(Objects::nonNull) + .map(t -> sysOpenDomainService.findById(t)) + .filter(Objects::nonNull).collect(Collectors.toList()); + List results = datas.stream().map(SysOpenDomainSelectorBo::new) + .collect( + Collectors.toList()); + + return InvokeResultBuilder.success(results); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/OpLogController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/OpLogController.java new file mode 100644 index 0000000..f0a194d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/OpLogController.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.template.inner.bo.system.oplog.GetOpLogBo; +import com.lframework.xingyun.template.inner.bo.system.oplog.QueryOpLogBo; +import com.lframework.xingyun.template.core.entity.OpLogs; +import com.lframework.xingyun.template.core.service.OpLogsService; +import com.lframework.xingyun.template.core.vo.QueryOpLogsVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 操作日志 + * + * @author zmj + */ +@Api(tags = "操作日志") +@Validated +@RestController +@RequestMapping("/system/oplog") +public class OpLogController extends DefaultBaseController { + + @Autowired + private OpLogsService opLogsService; + + /** + * 操作日志列表 + */ + @ApiOperation("操作日志列表") + @HasPermission({"system:oplog:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryOpLogsVo vo) { + + PageResult pageResult = opLogsService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryOpLogBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 操作日志详情 + */ + @ApiOperation("操作日志详情") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:oplog:query"}) + @GetMapping + public InvokeResult findById(@NotBlank(message = "ID不能为空") String id) { + + OpLogs data = opLogsService.findById(id); + + if (data == null) { + throw new DefaultClientException("操作日志不存在!"); + } + + GetOpLogBo result = new GetOpLogBo(data); + + return InvokeResultBuilder.success(result); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicCategoryController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicCategoryController.java new file mode 100644 index 0000000..c8e97bf --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicCategoryController.java @@ -0,0 +1,122 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.bo.system.dic.category.QuerySysDataDicCategoryBo; +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.xingyun.template.inner.service.system.SysDataDicCategoryService; +import com.lframework.xingyun.template.inner.vo.system.dic.category.CreateSysDataDicCategoryVo; +import com.lframework.xingyun.template.inner.vo.system.dic.category.UpdateSysDataDicCategoryVo; +import com.lframework.xingyun.template.inner.bo.system.dic.category.GetSysDataDicCategoryBo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据字典分类 + * + * @author zmj + */ +@Api(tags = "数据字典分类") +@Validated +@RestController +@RequestMapping("/system/dic/category") +public class SysDataDicCategoryController extends DefaultBaseController { + + @Autowired + private SysDataDicCategoryService sysDataDicCategoryService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"system:dic-category:*"}) + @GetMapping("/query") + public InvokeResult> query() { + List datas = sysDataDicCategoryService.queryList(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysDataDicCategoryBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:dic-category:*"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysDataDicCategory data = sysDataDicCategoryService.findById(id); + if (data == null) { + throw new DefaultClientException("数据字典分类不存在!"); + } + + GetSysDataDicCategoryBo result = new GetSysDataDicCategoryBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增数据字典分类 + */ + @ApiOperation("新增数据字典分类") + @HasPermission({"system:dic-category:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysDataDicCategoryVo vo) { + + sysDataDicCategoryService.create(vo); + + sysDataDicCategoryService.cleanCacheByKey("all"); + + return InvokeResultBuilder.success(); + } + + /** + * 修改数据字典分类 + */ + @ApiOperation("修改数据字典分类") + @HasPermission({"system:dic-category:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysDataDicCategoryVo vo) { + + sysDataDicCategoryService.update(vo); + + sysDataDicCategoryService.cleanCacheByKeys(Arrays.asList("all", vo.getId())); + + return InvokeResultBuilder.success(); + } + + @ApiOperation("删除数据字典分类") + @HasPermission({"system:dic-category:delete"}) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + sysDataDicCategoryService.deleteById(id); + + sysDataDicCategoryService.cleanCacheByKeys(Arrays.asList("all", id)); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicController.java new file mode 100644 index 0000000..30b727e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicController.java @@ -0,0 +1,127 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.bo.system.dic.GetSysDataDicBo; +import com.lframework.xingyun.template.inner.bo.system.dic.QuerySysDataDicBo; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.xingyun.template.inner.vo.system.dic.CreateSysDataDicVo; +import com.lframework.xingyun.template.inner.vo.system.dic.QuerySysDataDicVo; +import com.lframework.xingyun.template.inner.vo.system.dic.UpdateSysDataDicVo; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据字典 + * + * @author zmj + */ +@Api(tags = "数据字典") +@Validated +@RestController +@RequestMapping("/system/dic") +public class SysDataDicController extends DefaultBaseController { + + @Autowired + private SysDataDicService sysDataDicService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"system:dic:*"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysDataDicVo vo) { + PageResult pageResult = sysDataDicService.query(getPageIndex(vo), getPageSize(vo), + vo); + List datas = pageResult.getDatas(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysDataDicBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:dic:*"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysDataDic data = sysDataDicService.findById(id); + if (data == null) { + throw new DefaultClientException("数据字典不存在!"); + } + + GetSysDataDicBo result = new GetSysDataDicBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增数据字典 + */ + @ApiOperation("新增数据字典") + @HasPermission({"system:dic:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysDataDicVo vo) { + + sysDataDicService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改数据字典 + */ + @ApiOperation("修改数据字典") + @HasPermission({"system:dic:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysDataDicVo vo) { + + sysDataDicService.update(vo); + + sysDataDicService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 删除数据字典 + */ + @ApiOperation("删除数据字典") + @HasPermission({"system:dic:delete"}) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + sysDataDicService.deleteById(id); + + sysDataDicService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicItemController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicItemController.java new file mode 100644 index 0000000..b567a50 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataDicItemController.java @@ -0,0 +1,162 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.system.SysDataDicItemService; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.xingyun.template.inner.vo.system.dic.item.CreateSysDataDicItemVo; +import com.lframework.xingyun.template.inner.vo.system.dic.item.QuerySysDataDicItemVo; +import com.lframework.xingyun.template.inner.vo.system.dic.item.UpdateSysDataDicItemVo; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.bo.system.dic.item.GetSysDataDicItemBo; +import com.lframework.xingyun.template.inner.bo.system.dic.item.QuerySysDataDicItemBo; +import com.lframework.xingyun.template.inner.bo.system.dic.item.SysDataDicItemBo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据字典值 + * + * @author zmj + */ +@Api(tags = "数据字典值") +@Validated +@RestController +@RequestMapping("/system/dic/item") +public class SysDataDicItemController extends DefaultBaseController { + + @Autowired + private SysDataDicItemService sysDataDicItemService; + + @Autowired + private SysDataDicService sysDataDicService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"system:dic-item:*"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysDataDicItemVo vo) { + PageResult pageResult = sysDataDicItemService.query(getPageIndex(vo), + getPageSize(vo), vo); + List datas = pageResult.getDatas(); + List results = CollectionUtil.emptyList(); + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysDataDicItemBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:dic-item:*"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysDataDicItem data = sysDataDicItemService.findById(id); + if (data == null) { + throw new DefaultClientException("数据字典值不存在!"); + } + + GetSysDataDicItemBo result = new GetSysDataDicItemBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 根据字典编号查询 + */ + @ApiOperation("根据字典编号查询") + @ApiImplicitParam(value = "字典编号", name = "code", paramType = "query", required = true) + @GetMapping("/bydic") + public InvokeResult> getByDicCode( + @NotBlank(message = "字典编号不能为空!") String code) { + List datas = sysDataDicItemService.findByDicCode(code); + + List results = datas.stream().map(SysDataDicItemBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 新增数据字典值 + */ + @ApiOperation("新增数据字典值") + @HasPermission({"system:dic-item:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysDataDicItemVo vo) { + + sysDataDicItemService.create(vo); + + SysDataDic dic = sysDataDicService.findById(vo.getDicId()); + sysDataDicItemService.cleanCacheByKey(dic.getCode()); + + return InvokeResultBuilder.success(); + } + + /** + * 修改数据字典值 + */ + @ApiOperation("修改数据字典值") + @HasPermission({"system:dic-item:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysDataDicItemVo vo) { + + SysDataDicItem item = sysDataDicItemService.findById(vo.getId()); + + sysDataDicItemService.update(vo); + + SysDataDic dic = sysDataDicService.findById(item.getDicId()); + sysDataDicItemService.cleanCacheByKey(dic.getCode()); + + sysDataDicItemService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 删除数据字典值 + */ + @ApiOperation("删除数据字典值") + @HasPermission({"system:dic-item:delete"}) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + SysDataDicItem item = sysDataDicItemService.findById(id); + + sysDataDicItemService.deleteById(id); + + SysDataDic dic = sysDataDicService.findById(item.getDicId()); + sysDataDicItemService.cleanCacheByKey(dic.getCode()); + + sysDataDicItemService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataPermissionDataController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataPermissionDataController.java new file mode 100644 index 0000000..69ffc0d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataPermissionDataController.java @@ -0,0 +1,94 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.core.vo.permission.CreateSysDataPermissionDataVo; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.core.entity.SysDataPermissionData; +import com.lframework.xingyun.template.core.enums.SysDataPermissionDataBizType; +import com.lframework.xingyun.template.inner.service.system.SysDataPermissionDataService; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.starter.web.common.security.SecurityConstants; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据权限数据 + * + * @author zmj + */ +@Api(tags = "数据权限数据") +@Validated +@RestController +@RequestMapping("/system/data/permission/data") +public class SysDataPermissionDataController extends DefaultBaseController { + + @Autowired + private SysDataPermissionDataService sysDataPermissionDataService; + + @Autowired + private SysRoleService sysRoleService; + + @ApiOperation("保存") + @PostMapping + public InvokeResult save(@Valid @RequestBody List data) { + if (CollectionUtil.isEmpty(data)) { + return InvokeResultBuilder.success(); + } + + for (CreateSysDataPermissionDataVo vo : data) { + if (EnumUtil.getByCode(SysDataPermissionDataBizType.class, vo.getBizType()) + == SysDataPermissionDataBizType.ROLE) { + List roles = vo.getBizIds().stream().map(t -> sysRoleService.findById(t)) + .filter( + Objects::nonNull) + .filter(t -> SecurityConstants.PERMISSION_ADMIN_NAME.equals(t.getPermission())) + .collect(Collectors.toList()); + + if (CollectionUtil.isNotEmpty(roles)) { + throw new DefaultClientException( + "权限【" + SecurityConstants.PERMISSION_ADMIN_NAME + + "】为内置权限,不允许设置数据权限!"); + } + } + } + + List records = data.stream() + .flatMap(t -> t.getBizIds().stream() + .map(bizId -> { + SysDataPermissionData record = sysDataPermissionDataService.getByBizId(bizId, + t.getBizType(), + t.getPermissionType()); + if (record == null) { + record = new SysDataPermissionData(); + record.setId(IdUtil.getId()); + record.setBizId(bizId); + record.setBizType( + EnumUtil.getByCode(SysDataPermissionDataBizType.class, t.getBizType())); + record.setPermissionType(t.getPermissionType()); + } + record.setPermission(t.getPermission()); + return record; + })) + .collect(Collectors.toList()); + + sysDataPermissionDataService.saveOrUpdateAllColumnBatch(records); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataPermissionModelDetailController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataPermissionModelDetailController.java new file mode 100644 index 0000000..471d68b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDataPermissionModelDetailController.java @@ -0,0 +1,153 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.JsonUtil; +import com.lframework.xingyun.template.inner.bo.system.permission.QuerySysDataPermissionModelDetailBo; +import com.lframework.xingyun.template.inner.bo.system.permission.SysDataPermissionModelDetailBo; +import com.lframework.xingyun.template.core.entity.SysDataPermissionData; +import com.lframework.xingyun.template.core.entity.SysDataPermissionModelDetail; +import com.lframework.xingyun.template.core.enums.SysDataPermissionDataBizType; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailCalcType; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailConditionType; +import com.lframework.xingyun.template.core.enums.SysDataPermissionModelDetailNodeType; +import com.lframework.xingyun.template.core.service.SysDataPermissionModelDetailService; +import com.lframework.xingyun.template.core.vo.permission.SysDataPermissionModelDetailVo; +import com.lframework.xingyun.template.inner.service.system.SysDataPermissionDataService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 数据权限Model明细 + * + * @author zmj + */ +@Api(tags = "数据权限Model明细") +@Validated +@RestController +@RequestMapping("/system/data/permission/model/detail") +public class SysDataPermissionModelDetailController extends DefaultBaseController { + + @Autowired + private SysDataPermissionModelDetailService sysDataPermissionModelDetailService; + + @Autowired + private SysDataPermissionDataService sysDataPermissionDataService; + + @ApiOperation("根据模型ID查询") + @ApiImplicitParam(value = "模型ID", name = "modelId", paramType = "query", required = true) + @GetMapping + public InvokeResult> getByModelId( + @NotNull(message = "模型ID不能为空!") Integer modelId) { + + Wrapper queryWrapper = Wrappers.lambdaQuery( + SysDataPermissionModelDetail.class).eq(SysDataPermissionModelDetail::getModelId, modelId); + List datas = sysDataPermissionModelDetailService.list( + queryWrapper); + List results = datas.stream() + .map(SysDataPermissionModelDetailBo::new).collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + @ApiOperation("预览SQL") + @PostMapping("/preview") + public InvokeResult preview( + @Valid @RequestBody List models) { + + String sql = sysDataPermissionModelDetailService.toSql(models); + + return InvokeResultBuilder.success(sql); + } + + @ApiOperation("根据业务ID查询") + @ApiImplicitParam(value = "模型ID", name = "modelId", paramType = "query", required = true) + @GetMapping("/query") + public InvokeResult> queryByBizId( + @NotBlank(message = "业务ID不能为空!") String bizId, + @NotNull(message = "业务类型不能为空!") @IsEnum(message = "业务类型格式错误!", enumClass = SysDataPermissionDataBizType.class) Integer bizType, + @NotNull(message = " 权限类型不能为空!") Integer permissionType) { + + SysDataPermissionData data = sysDataPermissionDataService.getByBizId(bizId, bizType, + permissionType); + if (data == null) { + return InvokeResultBuilder.success(Collections.emptyList()); + } + + List voList = JsonUtil.parseList(data.getPermission(), + SysDataPermissionModelDetailVo.class); + if (CollectionUtil.isEmpty(voList)) { + return InvokeResultBuilder.success(Collections.emptyList()); + } + + List results = this.buildChildren(voList); + + return InvokeResultBuilder.success(results); + } + + private List buildChildren( + List children) { + if (CollectionUtil.isEmpty(children)) { + return Collections.emptyList(); + } + + List results = new ArrayList<>(children.size()); + for (SysDataPermissionModelDetailVo vo : children) { + SysDataPermissionModelDetail modelDetail = sysDataPermissionModelDetailService.getById( + vo.getDetailId()); + QuerySysDataPermissionModelDetailBo result = new QuerySysDataPermissionModelDetailBo(); + result.setId(vo.getId()); + result.setDetailId(vo.getDetailId()); + result.setCalcType(vo.getCalcType()); + result.setNodeType(vo.getNodeType()); + result.setValue(vo.getValue()); + result.setValues(vo.getValues()); + result.setConditionType(vo.getConditionType()); + SysDataPermissionModelDetailNodeType nodeType = EnumUtil.getByCode( + SysDataPermissionModelDetailNodeType.class, vo.getNodeType()); + if (nodeType == SysDataPermissionModelDetailNodeType.CALC) { + SysDataPermissionModelDetailCalcType calcType = EnumUtil.getByCode( + SysDataPermissionModelDetailCalcType.class, vo.getCalcType()); + result.setName(calcType.getDesc()); + result.setChildren(this.buildChildren(vo.getChildren())); + } else { + result.setName(modelDetail.getName()); + result.setModelId(modelDetail.getModelId()); + result.setConditionTypes( + Arrays.stream(modelDetail.getConditionType().split(StringPool.STR_SPLIT)) + .map(t -> EnumUtil.getByCode( + SysDataPermissionModelDetailConditionType.class, t).getCode()) + .toArray(Integer[]::new)); + result.setInputType(modelDetail.getInputType().getCode()); + result.setEnumName(modelDetail.getEnumName()); + } + + results.add(result); + } + + return results; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDeptController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDeptController.java new file mode 100644 index 0000000..153cc32 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysDeptController.java @@ -0,0 +1,179 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.xingyun.template.inner.enums.system.SysDeptNodeType; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.xingyun.template.inner.service.system.SysDeptService; +import com.lframework.xingyun.template.inner.vo.system.dept.CreateSysDeptVo; +import com.lframework.xingyun.template.inner.vo.system.dept.UpdateSysDeptVo; +import com.lframework.xingyun.template.inner.bo.system.dept.GetSysDeptBo; +import com.lframework.xingyun.template.inner.bo.system.dept.SysDeptTreeBo; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 部门管理 + * + * @author zmj + */ +@Api(tags = "部门管理") +@Validated +@RestController +@RequestMapping("/system/dept") +public class SysDeptController extends DefaultBaseController { + + @Autowired + private SysDeptService sysDeptService; + + @Autowired + private RecursionMappingService recursionMappingService; + + /** + * 部门树形菜单数据 + */ + @ApiOperation("部门树形菜单数据") + @HasPermission({"system:dept:query", "system:dept:add", "system:dept:modify"}) + @GetMapping("/trees") + public InvokeResult> trees() { + + List datas = sysDeptService.selector(); + if (CollectionUtil.isEmpty(datas)) { + return InvokeResultBuilder.success(CollectionUtil.emptyList()); + } + + List results = datas.stream().map(SysDeptTreeBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(results); + } + + /** + * 查询部门 + */ + @ApiOperation("部门详情") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:dept:query", "system:dept:add", "system:dept:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysDept data = sysDeptService.findById(id); + if (data == null) { + throw new DefaultClientException("部门不存在!"); + } + + GetSysDeptBo result = new GetSysDeptBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用部门 + */ + @ApiOperation("批量停用部门") + @HasPermission({"system:dept:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "部门ID", required = true) @NotEmpty(message = "请选择需要停用的部门!") @RequestBody List ids) { + + sysDeptService.batchUnable(ids); + + List batchIds = new ArrayList<>(ids); + + for (String id : ids) { + List tmp = recursionMappingService.getNodeChildIds(id, + ApplicationUtil.getBean(SysDeptNodeType.class)); + batchIds.addAll(tmp); + } + sysDeptService.cleanCacheByKeys(batchIds); + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用部门 + */ + @ApiOperation("批量启用部门") + @HasPermission({"system:dept:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "部门ID", required = true) @NotEmpty(message = "请选择需要启用的部门!") @RequestBody List ids) { + + sysDeptService.batchEnable(ids); + + List batchIds = new ArrayList<>(ids); + + for (String id : ids) { + List tmp = recursionMappingService.getNodeParentIds(id, + ApplicationUtil.getBean(SysDeptNodeType.class)); + batchIds.addAll(tmp); + } + sysDeptService.cleanCacheByKeys(batchIds); + + return InvokeResultBuilder.success(); + } + + /** + * 新增部门 + */ + @ApiOperation("新增部门") + @HasPermission({"system:dept:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysDeptVo vo) { + + sysDeptService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改部门 + */ + @ApiOperation("修改部门") + @HasPermission({"system:dept:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysDeptVo vo) { + + sysDeptService.update(vo); + + List batchIds = new ArrayList<>(); + batchIds.add(vo.getId()); + + if (vo.getAvailable()) { + List ids = recursionMappingService.getNodeParentIds(vo.getId(), + ApplicationUtil.getBean(SysDeptNodeType.class)); + batchIds.addAll(ids); + } else { + List ids = recursionMappingService.getNodeChildIds(vo.getId(), + ApplicationUtil.getBean(SysDeptNodeType.class)); + batchIds.addAll(ids); + } + + sysDeptService.cleanCacheByKeys(batchIds); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysMenuController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysMenuController.java new file mode 100644 index 0000000..488be59 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysMenuController.java @@ -0,0 +1,245 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.InputErrorException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.xingyun.template.inner.enums.system.SysMenuDisplay; +import com.lframework.xingyun.template.inner.bo.system.menu.GetSysMenuBo; +import com.lframework.xingyun.template.inner.bo.system.menu.QuerySysMenuBo; +import com.lframework.xingyun.template.inner.service.SysModuleTenantService; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import com.lframework.xingyun.template.inner.vo.system.menu.CreateSysMenuVo; +import com.lframework.xingyun.template.inner.vo.system.menu.UpdateSysMenuVo; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.utils.TenantUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 系统菜单管理 + * + * @author zmj + */ +@Api(tags = "系统菜单管理") +@Validated +@RestController +@RequestMapping("/system/menu") +public class SysMenuController extends DefaultBaseController { + + @Autowired + private SysMenuService sysMenuService; + + @Autowired + private SysModuleTenantService sysModuleTenantService; + + /** + * 系统菜单列表 + */ + @ApiOperation("系统菜单列表") + @HasPermission({"system:menu:query", "system:menu:add"}) + @GetMapping("/query") + public InvokeResult> query() { + + // 先查询当前租户使用的module + List moduleIds = null; + if (TenantUtil.enableTenant()) { + moduleIds = sysModuleTenantService.getAvailableModuleIdsByTenantId(TenantContextHolder.getTenantId()); + } + + List results = CollectionUtil.emptyList(); + List datas = sysMenuService.queryList(moduleIds); + if (CollectionUtil.isNotEmpty(datas)) { + results = datas.stream().map(QuerySysMenuBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 新增系统菜单 + */ + @ApiOperation("新增系统菜单") + @HasPermission({"system:menu:add"}) + @PostMapping + public InvokeResult add(@Valid CreateSysMenuVo vo) { + + this.validVo(vo); + + sysMenuService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 查看系统菜单 + */ + @ApiOperation("查看系统菜单") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:menu:query", "system:menu:add", "system:menu:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysMenu data = sysMenuService.findById(id); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("菜单不存在!"); + } + + return InvokeResultBuilder.success(new GetSysMenuBo(data)); + } + + /** + * 修改系统菜单 + */ + @ApiOperation("修改系统菜单") + @HasPermission({"system:menu:modify"}) + @PutMapping + public InvokeResult modify(@Valid UpdateSysMenuVo vo) { + + this.validVo(vo); + + sysMenuService.update(vo); + + sysMenuService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:menu:delete"}) + @DeleteMapping + public InvokeResult delete(@NotBlank(message = "ID不能为空!") String id) { + + sysMenuService.deleteById(id); + + sysMenuService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用 + */ + @ApiOperation("批量启用") + @HasPermission({"system:menu:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "菜单ID", required = true) @NotEmpty(message = "请选择需要启用的菜单!") @RequestBody List ids) { + + sysMenuService.batchEnable(ids, SecurityUtil.getCurrentUser().getId()); + + for (String id : ids) { + sysMenuService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量停用 + */ + @ApiOperation("批量停用") + @HasPermission({"system:menu:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "菜单ID", required = true) @NotEmpty(message = "请选择需要停用的菜单!") @RequestBody List ids) { + + sysMenuService.batchUnable(ids, SecurityUtil.getCurrentUser().getId()); + + for (String id : ids) { + sysMenuService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + private void validVo(CreateSysMenuVo vo) { + + SysMenuDisplay sysMenuDisplay = EnumUtil.getByCode(SysMenuDisplay.class, vo.getDisplay()); + + if (sysMenuDisplay == SysMenuDisplay.CATALOG || sysMenuDisplay == SysMenuDisplay.FUNCTION) { + if (StringUtil.isBlank(vo.getName())) { + throw new InputErrorException("请输入路由名称!"); + } + + if (StringUtil.isBlank(vo.getPath())) { + throw new InputErrorException("请输入路由路径!"); + } + + if (ObjectUtil.isNull(vo.getHidden())) { + throw new InputErrorException("请选择是否隐藏!"); + } + + if (sysMenuDisplay == SysMenuDisplay.FUNCTION) { + if (vo.getComponentType() == null) { + throw new InputErrorException("请选择组件类型!"); + } + if (StringUtil.isBlank(vo.getComponent())) { + throw new InputErrorException("请输入组件!"); + } + if (ObjectUtil.isNull(vo.getNoCache())) { + throw new InputErrorException("请选择是否不缓存!"); + } + + if (!StringUtil.isBlank(vo.getParentId())) { + SysMenu parentMenu = sysMenuService.findById(vo.getParentId()); + + if (parentMenu.getDisplay() != SysMenuDisplay.CATALOG) { + throw new InputErrorException( + "当菜单类型是“" + SysMenuDisplay.FUNCTION.getDesc() + "”时,父级菜单类型必须是“" + + SysMenuDisplay.CATALOG.getDesc() + "”!"); + } + } + } + } else if (sysMenuDisplay == SysMenuDisplay.PERMISSION) { + if (StringUtil.isBlank(vo.getParentId())) { + throw new InputErrorException( + "当菜单类型是“" + SysMenuDisplay.PERMISSION.getDesc() + "”时,父级菜单不能为空!"); + } + + SysMenu parentMenu = sysMenuService.findById(vo.getParentId()); + if (ObjectUtil.isNull(parentMenu)) { + throw new InputErrorException( + "当菜单类型是“" + SysMenuDisplay.PERMISSION.getDesc() + "”时,父级菜单不能为空!"); + } + + if (parentMenu.getDisplay() != SysMenuDisplay.FUNCTION) { + throw new InputErrorException( + "当菜单类型是“" + SysMenuDisplay.PERMISSION.getDesc() + "”时,父级菜单类型必须是“" + + SysMenuDisplay.FUNCTION.getDesc() + "”!"); + } + if (StringUtil.isBlank(vo.getPermission())) { + throw new InputErrorException("请输入权限!"); + } + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysModuleController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysModuleController.java new file mode 100644 index 0000000..9ebd5a5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysModuleController.java @@ -0,0 +1,101 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.xingyun.template.inner.bo.system.module.QuerySysModuleBo; +import com.lframework.xingyun.template.inner.entity.SysModule; +import com.lframework.xingyun.template.inner.entity.SysModuleTenant; +import com.lframework.xingyun.template.inner.service.SysModuleService; +import com.lframework.xingyun.template.inner.service.SysModuleTenantService; +import com.lframework.xingyun.template.inner.vo.system.module.SysModuleTenantVo; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.TenantUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 系统模块管理 + * + * @author zmj + */ +@Api(tags = "系统模块管理") +@Validated +@RestController +@RequestMapping("/system/module") +public class SysModuleController extends DefaultBaseController { + + @Autowired + private SysModuleService sysModuleService; + + @Autowired + private SysModuleTenantService sysModuleTenantService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission(value = {"system:tenant:module"}) + @GetMapping("/query") + public InvokeResult> query(@NotNull(message = "租户ID不能为空!") Integer tenantId) { + + if (!TenantUtil.enableTenant()) { + return InvokeResultBuilder.success(Collections.emptyList()); + } + + // 先查询所有模块 + List sysModules = sysModuleService.list(); + List results = sysModules.stream().map(QuerySysModuleBo::new) + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(results)) { + return InvokeResultBuilder.success(results); + } + + List sysModuleTenants = sysModuleTenantService.getByTenantId(tenantId); + + for (QuerySysModuleBo result : results) { + SysModuleTenant sysModuleTenant = sysModuleTenants.stream() + .filter(t -> ObjectUtil.equal(t.getModuleId(), result.getId())).findFirst().orElse(null); + result.setEnabled(sysModuleTenant != null); + if (sysModuleTenant == null) { + continue; + } + result.setExpireTime(sysModuleTenant.getExpireTime()); + } + + return InvokeResultBuilder.success(results); + } + + /** + * 模块授权 + */ + @ApiOperation("模块授权") + @HasPermission(value = {"system:tenant:module"}) + @PostMapping("/setting") + public InvokeResult setting( + @RequestBody(required = false) @Valid SysModuleTenantVo vo) { + + if (!TenantUtil.enableTenant()) { + return InvokeResultBuilder.success(); + } + sysModuleTenantService.setting(vo); + + sysModuleTenantService.cleanCacheByKey(vo.getTenantId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysNoticeController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysNoticeController.java new file mode 100644 index 0000000..56c1f9c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysNoticeController.java @@ -0,0 +1,175 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.starter.web.common.threads.DefaultRunnable; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.template.inner.bo.system.notice.GetSysNoticeBo; +import com.lframework.xingyun.template.inner.bo.system.notice.QueryMySysNoticeBo; +import com.lframework.xingyun.template.inner.bo.system.notice.QuerySysNoticeBo; +import com.lframework.xingyun.template.inner.dto.system.notice.QuerySysNoticeByUserDto; +import com.lframework.xingyun.template.inner.dto.system.notice.SysNoticeDto; +import com.lframework.xingyun.template.inner.entity.SysNotice; +import com.lframework.xingyun.template.inner.vo.system.notice.CreateSysNoticeVo; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeByUserVo; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeVo; +import com.lframework.xingyun.template.inner.vo.system.notice.UpdateSysNoticeVo; +import com.lframework.xingyun.template.inner.service.system.SysNoticeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 系统通知 Controller + * + * @author zmj + */ +@Api(tags = "系统通知") +@Validated +@RestController +@RequestMapping("/system/notice") +public class SysNoticeController extends DefaultBaseController { + + @Autowired + private SysNoticeService sysNoticeService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"system:notice:publish"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysNoticeVo vo) { + + PageResult pageResult = sysNoticeService.query(getPageIndex(vo), getPageSize(vo), + vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysNoticeBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询我的通知 + */ + @ApiOperation("查询我的通知") + @GetMapping("/query/my") + public InvokeResult> queryMyNotice( + @Valid QuerySysNoticeByUserVo vo) { + + vo.setUserId(SecurityUtil.getCurrentUser().getId()); + + PageResult pageResult = sysNoticeService.queryByUser(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QueryMySysNoticeBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询内容 + */ + @ApiOperation("根据ID查询内容") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @GetMapping("/content") + public InvokeResult getContent(@NotBlank(message = "id不能为空!") String id) { + + SysNoticeDto data = sysNoticeService.getContent(id); + if (data == null) { + throw new DefaultClientException("系统通知不存在!"); + } + + String currentUserId = SecurityUtil.getCurrentUser().getId(); + ThreadUtil.execAsync(new DefaultRunnable(() -> { + sysNoticeService.setReaded(id, currentUserId); + + sysNoticeService.noticeForWs(currentUserId); + })); + + return InvokeResultBuilder.success(data); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @HasPermission({"system:notice:query"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "id不能为空!") String id) { + + SysNotice data = sysNoticeService.findById(id); + if (data == null) { + throw new DefaultClientException("系统通知不存在!"); + } + + GetSysNoticeBo result = new GetSysNoticeBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"system:notice:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysNoticeVo vo) { + + sysNoticeService.create(vo); + + if (vo.getPublished()) { + sysNoticeService.noticeForWs(); + } + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"system:notice:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysNoticeVo vo) { + + sysNoticeService.update(vo); + + sysNoticeService.cleanCacheByKey(vo.getId()); + + if (vo.getPublished()) { + sysNoticeService.noticeForWs(); + } + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysOpenDomainController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysOpenDomainController.java new file mode 100644 index 0000000..ebda9e4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysOpenDomainController.java @@ -0,0 +1,129 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.bo.system.open.GetSysOpenDomainBo; +import com.lframework.xingyun.template.inner.bo.system.open.QuerySysOpenDomainBo; +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.system.SysOpenDomainService; +import com.lframework.xingyun.template.inner.vo.system.open.QuerySysOpenDomainVo; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.vo.system.open.CreateSysOpenDomainVo; +import com.lframework.xingyun.template.inner.vo.system.open.UpdateSysOpenDomainSecretVo; +import com.lframework.xingyun.template.inner.vo.system.open.UpdateSysOpenDomainVo; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 开放域 + * + * @author zmj + */ +@Api(tags = "开放域") +@Validated +@RestController +@RequestMapping("/system/open/domain") +public class SysOpenDomainController extends DefaultBaseController { + + @Autowired + private SysOpenDomainService sysOpenDomainService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"system:open-domain:config"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysOpenDomainVo vo) { + + PageResult pageResult = sysOpenDomainService.query(vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysOpenDomainBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 详情 + */ + @ApiOperation("详情") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:open-domain:config"}) + @GetMapping + public InvokeResult get(@NotNull(message = "ID不能为空!") Integer id) { + + SysOpenDomain data = sysOpenDomainService.findById(id); + if (data == null) { + throw new DefaultClientException("开放域不存在!"); + } + + GetSysOpenDomainBo result = new GetSysOpenDomainBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"system:open-domain:config"}) + @PostMapping + public InvokeResult create(@Valid CreateSysOpenDomainVo vo) { + + sysOpenDomainService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"system:open-domain:config"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysOpenDomainVo vo) { + + sysOpenDomainService.update(vo); + + sysOpenDomainService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 修改Api密钥 + */ + @ApiOperation("修改Api密钥") + @HasPermission({"system:open-domain:config"}) + @PutMapping("/secret") + public InvokeResult updateSecret(@Valid UpdateSysOpenDomainSecretVo vo) { + + sysOpenDomainService.updateApiSecret(vo); + + sysOpenDomainService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysParameterController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysParameterController.java new file mode 100644 index 0000000..cb03f96 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysParameterController.java @@ -0,0 +1,138 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.entity.SysParameter; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.system.SysParameterService; +import com.lframework.xingyun.template.inner.vo.system.parameter.CreateSysParameterVo; +import com.lframework.xingyun.template.inner.vo.system.parameter.QuerySysParameterVo; +import com.lframework.xingyun.template.inner.vo.system.parameter.UpdateSysParameterVo; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.bo.system.parameter.GetSysParameterBo; +import com.lframework.xingyun.template.inner.bo.system.parameter.QuerySysParameterBo; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 系统参数 Controller + * + * @author zmj + */ +@Api(tags = "系统参数") +@Validated +@RestController +@RequestMapping("/system/parameter") +public class SysParameterController extends DefaultBaseController { + + @Autowired + private SysParameterService sysParameterService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"system:parameter:query"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysParameterVo vo) { + + PageResult pageResult = sysParameterService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysParameterBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @HasPermission({"system:parameter:query"}) + @GetMapping + public InvokeResult get(@NotNull(message = "id不能为空!") Long id) { + + SysParameter data = sysParameterService.getById(id); + if (data == null) { + throw new DefaultClientException("系统参数不存在!"); + } + + GetSysParameterBo result = new GetSysParameterBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"system:parameter:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysParameterVo vo) { + + sysParameterService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"system:parameter:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysParameterVo vo) { + + sysParameterService.update(vo); + + sysParameterService.cleanCacheByKey(vo.getId()); + + SysParameter data = sysParameterService.findById(vo.getId()); + sysParameterService.cleanCacheByKey(data.getPmKey()); + + return InvokeResultBuilder.success(); + } + + /** + * 根据ID删除 + */ + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) + @HasPermission({"system:parameter:delete"}) + @DeleteMapping + public InvokeResult deleteById(@NotNull(message = "id不能为空!") Long id) { + + SysParameter data = sysParameterService.findById(id); + + sysParameterService.deleteById(id); + + sysParameterService.cleanCacheByKey(id); + + sysParameterService.cleanCacheByKey(data.getPmKey()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysPositionController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysPositionController.java new file mode 100644 index 0000000..f0a97c2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysPositionController.java @@ -0,0 +1,154 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.system.SysPositionService; +import com.lframework.xingyun.template.inner.vo.system.position.CreateSysPositionVo; +import com.lframework.xingyun.template.inner.vo.system.position.QuerySysPositionVo; +import com.lframework.xingyun.template.inner.vo.system.position.UpdateSysPositionVo; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.bo.system.position.GetSysPositionBo; +import com.lframework.xingyun.template.inner.bo.system.position.QuerySysPositionBo; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 岗位管理 + * + * @author zmj + */ +@Api(tags = "岗位管理") +@Validated +@RestController +@RequestMapping("/system/position") +public class SysPositionController extends DefaultBaseController { + + @Autowired + private SysPositionService sysPositionService; + + /** + * 岗位列表 + */ + @ApiOperation("岗位列表") + @HasPermission({"system:position:query","system:position:add","system:position:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysPositionVo vo) { + + PageResult pageResult = sysPositionService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysPositionBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询岗位 + */ + @ApiOperation("查询岗位") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:position:query","system:position:add","system:position:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysPosition data = sysPositionService.findById(id); + if (data == null) { + throw new DefaultClientException("岗位不存在!"); + } + + GetSysPositionBo result = new GetSysPositionBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用岗位 + */ + @ApiOperation("批量停用岗位") + @HasPermission({"system:position:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "岗位ID", required = true) @NotEmpty(message = "请选择需要停用的岗位!") @RequestBody List ids) { + + sysPositionService.batchUnable(ids); + + for (String id : ids) { + sysPositionService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用岗位 + */ + @ApiOperation("批量启用岗位") + @HasPermission({"system:position:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "岗位ID", required = true) @NotEmpty(message = "请选择需要启用的岗位!") @RequestBody List ids) { + + sysPositionService.batchEnable(ids); + + for (String id : ids) { + sysPositionService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增岗位 + */ + @ApiOperation("新增岗位") + @HasPermission({"system:position:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysPositionVo vo) { + + sysPositionService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改岗位 + */ + @ApiOperation("修改岗位") + @HasPermission({"system:position:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysPositionVo vo) { + + sysPositionService.update(vo); + + sysPositionService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysRoleController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysRoleController.java new file mode 100644 index 0000000..a98384e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysRoleController.java @@ -0,0 +1,154 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.bo.system.role.GetSysRoleBo; +import com.lframework.xingyun.template.inner.bo.system.role.QuerySysRoleBo; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.vo.system.role.CreateSysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.role.QuerySysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.role.UpdateSysRoleVo; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 角色管理 + * + * @author zmj + */ +@Api(tags = "角色管理") +@Validated +@RestController +@RequestMapping("/system/role") +public class SysRoleController extends DefaultBaseController { + + @Autowired + private SysRoleService sysRoleService; + + /** + * 角色列表 + */ + @ApiOperation("角色列表") + @HasPermission({"system:role:query","system:role:add","system:role:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysRoleVo vo) { + + PageResult pageResult = sysRoleService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysRoleBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询角色 + */ + @ApiOperation("查询角色") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:role:query","system:role:add","system:role:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysRole data = sysRoleService.findById(id); + if (data == null) { + throw new DefaultClientException("角色不存在!"); + } + + GetSysRoleBo result = new GetSysRoleBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用角色 + */ + @ApiOperation("批量停用角色") + @HasPermission({"system:role:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "角色ID", required = true) @NotEmpty(message = "请选择需要停用的角色!") @RequestBody List ids) { + + sysRoleService.batchUnable(ids); + + for (String id : ids) { + sysRoleService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用角色 + */ + @ApiOperation("批量启用角色") + @HasPermission({"system:role:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "角色ID", required = true) @NotEmpty(message = "请选择需要启用的角色!") @RequestBody List ids) { + + sysRoleService.batchEnable(ids); + + for (String id : ids) { + sysRoleService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增角色 + */ + @ApiOperation("新增角色") + @HasPermission({"system:role:add"}) + @PostMapping + public InvokeResult create(@Valid CreateSysRoleVo vo) { + + sysRoleService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改角色 + */ + @ApiOperation("修改角色") + @HasPermission({"system:role:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateSysRoleVo vo) { + + sysRoleService.update(vo); + + sysRoleService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysRoleMenuController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysRoleMenuController.java new file mode 100644 index 0000000..7babd7a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysRoleMenuController.java @@ -0,0 +1,98 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.bo.system.role.QueryRoleMenuBo; +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.xingyun.template.inner.service.SysModuleTenantService; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import com.lframework.xingyun.template.inner.service.system.SysRoleMenuService; +import com.lframework.xingyun.template.inner.vo.system.role.SysRoleMenuSettingVo; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.starter.web.utils.TenantUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 角色授权 + * + * @author zmj + */ +@Api(tags = "角色授权") +@Validated +@RestController +@RequestMapping("/system/role/menu") +public class SysRoleMenuController extends DefaultBaseController { + + @Autowired + private SysMenuService sysMenuService; + + @Autowired + private SysRoleMenuService sysRoleMenuService; + + @Autowired + private SysModuleTenantService sysModuleTenantService; + + /** + * 查询角色菜单列表 + */ + @ApiOperation("查询角色菜单列表") + @ApiImplicitParam(value = "角色ID", name = "roleId", paramType = "query") + @HasPermission({"system:role:permission"}) + @GetMapping("/menus") + public InvokeResult> menus(String roleId) { + + // 先查询当前租户使用的module + List moduleIds = null; + if (TenantUtil.enableTenant()) { + moduleIds = sysModuleTenantService.getAvailableModuleIdsByTenantId(TenantContextHolder.getTenantId()); + } + + List results = CollectionUtil.emptyList(); + //查询所有菜单 + List allMenu = sysMenuService.queryList(moduleIds); + if (!CollectionUtil.isEmpty(allMenu)) { + results = allMenu.stream().map(QueryRoleMenuBo::new).collect(Collectors.toList()); + + if (!StringUtil.isBlank(roleId)) { + List menus = sysMenuService.getByRoleId(roleId, moduleIds); + if (!CollectionUtil.isEmpty(menus)) { + //当角色的菜单存在时,设置已选择属性 + for (QueryRoleMenuBo result : results) { + result.setSelected( + menus.stream().anyMatch(t -> StringUtil.equals(t.getId(), result.getId()))); + } + } + } + } + + return InvokeResultBuilder.success(results); + } + + /** + * 授权角色菜单 + */ + @ApiOperation("授权角色菜单") + @HasPermission({"system:role:permission"}) + @PostMapping("/setting") + public InvokeResult setting(@Valid @RequestBody SysRoleMenuSettingVo vo) { + + sysRoleMenuService.setting(vo); + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysUserController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysUserController.java new file mode 100644 index 0000000..792112c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysUserController.java @@ -0,0 +1,170 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import com.lframework.xingyun.template.inner.bo.system.user.GetSysUserBo; +import com.lframework.xingyun.template.inner.bo.system.user.QuerySysUserBo; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.xingyun.template.inner.service.system.SysUserService; +import com.lframework.xingyun.template.inner.vo.system.user.CreateSysUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.QuerySysUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.UpdateSysUserVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 用户管理 + * + * @author zmj + */ +@Api(tags = "用户管理") +@Validated +@RestController +@RequestMapping("/system/user") +public class SysUserController extends DefaultBaseController { + + @Autowired + private SysUserService sysUserService; + + /** + * 用户列表 + */ + @ApiOperation("用户列表") + @HasPermission({"system:user:query", "system:user:add", "system:user:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QuerySysUserVo vo) { + + PageResult pageResult = sysUserService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(QuerySysUserBo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询用户 + */ + @ApiOperation("查询用户") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:user:query", "system:user:add", "system:user:modify"}) + @GetMapping + public InvokeResult get(@NotBlank(message = "ID不能为空!") String id) { + + SysUser data = sysUserService.findById(id); + if (data == null) { + throw new DefaultClientException("用户不存在!"); + } + + GetSysUserBo result = new GetSysUserBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 批量停用用户 + */ + @ApiOperation("批量停用用户") + @HasPermission({"system:user:modify"}) + @PatchMapping("/unable/batch") + public InvokeResult batchUnable( + @ApiParam(value = "用户ID", required = true) @NotEmpty(message = "请选择需要停用的用户!") @RequestBody List ids) { + + sysUserService.batchUnable(ids); + + for (String id : ids) { + sysUserService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 批量启用用户 + */ + @ApiOperation("批量启用用户") + @HasPermission({"system:user:modify"}) + @PatchMapping("/enable/batch") + public InvokeResult batchEnable( + @ApiParam(value = "用户ID", required = true) @NotEmpty(message = "请选择需要启用的用户!") @RequestBody List ids) { + + sysUserService.batchEnable(ids); + + for (String id : ids) { + sysUserService.cleanCacheByKey(id); + } + + return InvokeResultBuilder.success(); + } + + /** + * 新增用户 + */ + @ApiOperation("新增用户") + @HasPermission({"system:user:add"}) + @PostMapping + public InvokeResult create(@Valid @RequestBody CreateSysUserVo vo) { + + sysUserService.create(vo); + + return InvokeResultBuilder.success(); + } + + /** + * 修改用户 + */ + @ApiOperation("修改用户") + @HasPermission({"system:user:modify"}) + @PutMapping + public InvokeResult update(@Valid @RequestBody UpdateSysUserVo vo) { + + sysUserService.update(vo); + + sysUserService.cleanCacheByKey(vo.getId()); + + return InvokeResultBuilder.success(); + } + + /** + * 解锁用户 + */ + @ApiOperation("解锁用户") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission({"system:user:modify"}) + @PatchMapping("/unlock") + public InvokeResult unlock(@NotBlank(message = "ID不能为空!") String id) { + + sysUserService.unlockById(id); + + sysUserService.cleanCacheByKey(id); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysUserRoleController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysUserRoleController.java new file mode 100644 index 0000000..329696d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/SysUserRoleController.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.bo.system.user.QueryUserRoleBo; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.xingyun.template.inner.service.system.SysUserRoleService; +import com.lframework.xingyun.template.inner.vo.system.role.QuerySysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserRoleSettingVo; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 用户授权 + * + * @author zmj + */ +@Api(tags = "用户授权") +@Validated +@RestController +@RequestMapping("/system/user/role") +public class SysUserRoleController extends DefaultBaseController { + + @Autowired + private SysRoleService sysRoleService; + + @Autowired + private SysUserRoleService sysUserRoleService; + + /** + * 查询角色列表 + */ + @ApiOperation("查询角色列表") + @ApiImplicitParams({@ApiImplicitParam(value = "用户ID", name = "userId", paramType = "query")}) + @HasPermission({"system:user:permission"}) + @GetMapping("/roles") + public InvokeResult> roles(String userId) { + + List results = CollectionUtil.emptyList(); + //查询所有角色 + QuerySysRoleVo sysRoleVo = new QuerySysRoleVo(); + sysRoleVo.setAvailable(Boolean.TRUE); + List allRole = sysRoleService.query(sysRoleVo); + if (!CollectionUtil.isEmpty(allRole)) { + results = allRole.stream().map(QueryUserRoleBo::new).collect(Collectors.toList()); + + if (!StringUtil.isBlank(userId)) { + List menus = sysRoleService.getByUserId(userId); + if (!CollectionUtil.isEmpty(menus)) { + //当用户角色存在时,设置已选择属性 + for (QueryUserRoleBo result : results) { + result.setSelected( + menus.stream().anyMatch(t -> StringUtil.equals(t.getId(), result.getId()))); + } + } + } + } + + return InvokeResultBuilder.success(results); + } + + /** + * 用户授权 + */ + @ApiOperation("用户授权") + @HasPermission({"system:user:permission"}) + @PostMapping("/setting") + public InvokeResult setting(@Valid @RequestBody SysUserRoleSettingVo vo) { + + sysUserRoleService.setting(vo); + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/TenantController.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/TenantController.java new file mode 100644 index 0000000..fc3659b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/controller/system/TenantController.java @@ -0,0 +1,143 @@ +package com.lframework.xingyun.template.inner.controller.system; + +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.utils.EncryptUtil; +import com.lframework.xingyun.template.inner.bo.system.tenant.GetTenantBo; +import com.lframework.xingyun.template.inner.bo.system.tenant.QueryTenantBo; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.TenantService; +import com.lframework.xingyun.template.inner.vo.system.tenant.CreateTenantVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.QueryTenantVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.UpdateTenantVo; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.annotations.security.HasPermission; +import com.lframework.starter.web.common.event.ReloadTenantEvent; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.controller.DefaultBaseController; +import com.lframework.starter.web.resp.InvokeResult; +import com.lframework.starter.web.resp.InvokeResultBuilder; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 租户管理 + * + * @author zmj + */ +@Slf4j +@Api(tags = "租户管理") +@Validated +@RestController +@RequestMapping("/system/tenant") +public class TenantController extends DefaultBaseController { + + @Autowired + private TenantService tenantService; + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission(value = {"system:tenant:query", "system:tenant:add", + "system:tenant:modify"}) + @GetMapping("/query") + public InvokeResult> query(@Valid QueryTenantVo vo) { + + PageResult pageResult = tenantService.query(getPageIndex(vo), + getPageSize(vo), vo); + + List datas = pageResult.getDatas(); + List results = datas.stream().map(QueryTenantBo::new) + .collect(Collectors.toList()); + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + /** + * 查询详情 + */ + @ApiOperation("查询详情") + @ApiImplicitParam(value = "ID", name = "id", paramType = "query", required = true) + @HasPermission(value = {"system:tenant:query", "system:tenant:add", + "system:tenant:modify"}) + @GetMapping + public InvokeResult get(@NotNull(message = "ID不能为空!") Integer id) { + + Tenant data = tenantService.findById(id); + if (data == null) { + throw new DefaultClientException("租户不存在!"); + } + + GetTenantBo result = new GetTenantBo(data); + + return InvokeResultBuilder.success(result); + } + + /** + * 新增租户 + */ + @ApiOperation("新增租户") + @HasPermission(value = {"system:tenant:add"}) + @PostMapping + public InvokeResult create(@Valid CreateTenantVo vo) { + + Integer tenantId = tenantService.create(vo); + + try { + ReloadTenantEvent event = new ReloadTenantEvent(this, tenantId, vo.getJdbcUrl(), + vo.getJdbcUsername(), vo.getJdbcPassword()); + ApplicationUtil.publishEvent(event); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultClientException( + "动态加载租户数据源失败,请检查配置项!注意:虽然加载数据源失败,但是租户已经新增,请勿重复新增!"); + } + + return InvokeResultBuilder.success(); + } + + /** + * 修改租户 + */ + @ApiOperation("修改租户") + @HasPermission(value = {"system:tenant:modify"}) + @PutMapping + public InvokeResult update(@Valid UpdateTenantVo vo) { + + tenantService.update(vo); + + tenantService.cleanCacheByKey(vo.getId()); + + if (StringUtil.isNotBlank(vo.getJdbcUrl()) || StringUtil.isNotBlank(vo.getJdbcUsername()) + || StringUtil.isNotBlank(vo.getJdbcPassword())) { + // 这里不走缓存 + Tenant tenant = tenantService.getById(vo.getId()); + try { + ReloadTenantEvent event = new ReloadTenantEvent(this, tenant.getId(), tenant.getJdbcUrl(), + tenant.getJdbcUsername(), EncryptUtil.decrypt(tenant.getJdbcPassword())); + ApplicationUtil.publishEvent(event); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new DefaultClientException( + "动态加载租户数据源失败,请检查配置项!"); + } + } + + return InvokeResultBuilder.success(); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/LoginDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/LoginDto.java new file mode 100644 index 0000000..09a1a28 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/LoginDto.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.template.inner.dto; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.util.Set; +import lombok.Data; + +/** + * 用户登录Dto + * + * @author zmj + */ +@Data +public class LoginDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Token + */ + private String token; + + /** + * 用户信息 + */ + private UserInfoDto user; + + /** + * 角色 + */ + private Set roles; + + public LoginDto(String token, String name, Set roles) { + + this.token = token; + this.setRoles(roles); + + UserInfoDto userInfo = new UserInfoDto(); + userInfo.setName(name); + this.setUser(userInfo); + } + + @Data + public static class UserInfoDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + private String name; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/MenuDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/MenuDto.java new file mode 100644 index 0000000..a21b06f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/MenuDto.java @@ -0,0 +1,82 @@ +package com.lframework.xingyun.template.inner.dto; + +import com.lframework.starter.web.dto.BaseDto; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +/** + * 菜单Dto + * + * @author zmj + */ +@Data +public class MenuDto implements BaseDto, Serializable { + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 菜单名称 + */ + @ApiModelProperty("菜单名称") + private String name; + + /** + * 路径 + */ + @ApiModelProperty("路径") + private String path; + + /** + * 是否隐藏 + */ + @ApiModelProperty("是否隐藏") + private Boolean hidden; + + /** + * 类型 0-目录 1-功能菜单 2-权限 + */ + @ApiModelProperty("类型 0-目录 1-功能菜单 2-权限") + private Integer display; + + /** + * 组件类型 + */ + @ApiModelProperty("组件类型") + private Integer componentType; + + /** + * 组件 + */ + @ApiModelProperty("组件") + private String component; + + /** + * 自定义请求参数 + */ + @ApiModelProperty("自定义请求参数") + private String requestParam; + + + /** + * meta + */ + @ApiModelProperty("meta") + private MenuMetaDto meta; + + /** + * 父节点ID + */ + @ApiModelProperty("父节点ID") + private String parentId; + + /** + * 是否收藏 + */ + @ApiModelProperty("是否收藏") + private Boolean isCollect = Boolean.FALSE; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/MenuMetaDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/MenuMetaDto.java new file mode 100644 index 0000000..94cf8d8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/MenuMetaDto.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.inner.dto; + +import com.lframework.starter.web.dto.BaseDto; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +/** + * 菜单Meta Dto + * + * @author zmj + */ +@Data +public class MenuMetaDto implements BaseDto, Serializable { + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 是否不缓存 + */ + @ApiModelProperty("是否不缓存") + private Boolean noCache; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/UserInfoDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/UserInfoDto.java new file mode 100644 index 0000000..1e0533e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/UserInfoDto.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.template.inner.dto; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import lombok.Data; + +/** + * 用户信息 Dto + * + * @author zmj + */ +@Data +public class UserInfoDto implements BaseDto, Serializable { + + public static final String CACHE_NAME = "UserInfoDto"; + + /** + * ID + */ + private String id; + + /** + * 登录名 + */ + private String username; + + /** + * 编号 + */ + private String code; + + /** + * 姓名 + */ + private String name; + + /** + * 邮箱 + */ + private String email; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 性别 + */ + private Integer gender; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/message/SysNoticeTaskDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/message/SysNoticeTaskDto.java new file mode 100644 index 0000000..15d14e0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/message/SysNoticeTaskDto.java @@ -0,0 +1,49 @@ +package com.lframework.xingyun.template.inner.dto.message; + +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.BaseDto; +import com.lframework.xingyun.template.inner.dto.system.notice.QuerySysNoticeByUserDto; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SysNoticeTaskDto extends BaseBo implements BaseDto, + Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 是否已读 + */ + @ApiModelProperty("是否已读") + private Boolean readed; + + /** + * 发布时间 + */ + @ApiModelProperty("发布时间") + private String publishTime; + + public SysNoticeTaskDto(QuerySysNoticeByUserDto dto) { + super(dto); + } + + @Override + protected void afterInit(QuerySysNoticeByUserDto dto) { + this.publishTime = DateUtil.formatDateTime(dto.getPublishTime()); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/qrtz/QrtzDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/qrtz/QrtzDto.java new file mode 100644 index 0000000..bf02889 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/qrtz/QrtzDto.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.template.inner.dto.qrtz; + +import com.lframework.xingyun.template.inner.enums.QrtzJobType; +import com.lframework.xingyun.template.inner.enums.TriggerState; +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +/** + * @author zmj + * @since 2022/8/20 + */ +@Data +public class QrtzDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + private String name; + + /** + * 分组 + */ + private String group; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 备注 + */ + private String description; + + /** + * 执行类名 + */ + private String targetClassName; + + /** + * 执行方法名 + */ + private String targetMethodName; + + /** + * 执行参数类型 + */ + private List targetParamTypes; + + /** + * 执行参数 + */ + private List targetParams; + + /** + * 脚本 + */ + private String script; + + /** + * 任务类型 + */ + private QrtzJobType jobType; + + /** + * Cron表达式 + */ + private String cron; + + /** + * 状态 + */ + private TriggerState state; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/system/notice/QuerySysNoticeByUserDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/system/notice/QuerySysNoticeByUserDto.java new file mode 100644 index 0000000..debd7c9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/system/notice/QuerySysNoticeByUserDto.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.inner.dto.system.notice; + +import com.lframework.starter.web.dto.BaseDto; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +/** + * @author zmj + * @since 2022/8/19 + */ +@Data +public class QuerySysNoticeByUserDto implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 标题 + */ + private String title; + + /** + * 是否已读 + */ + private Boolean readed; + + /** + * 发布时间 + */ + private LocalDateTime publishTime; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/system/notice/SysNoticeDto.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/system/notice/SysNoticeDto.java new file mode 100644 index 0000000..4697977 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/dto/system/notice/SysNoticeDto.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.inner.dto.system.notice; + +import com.lframework.xingyun.template.inner.entity.SysNotice; +import com.lframework.starter.web.bo.BaseBo; +import com.lframework.starter.web.dto.BaseDto; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +/** + * @author zmj + * @since 2022/8/18 + */ +@Data +public class SysNoticeDto extends BaseBo implements BaseDto, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 内容 + */ + @ApiModelProperty("内容") + private String content; + + public SysNoticeDto(SysNotice dto) { + super(dto); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDic.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDic.java new file mode 100644 index 0000000..fa5cd1c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDic.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 数据字典 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_data_dic") +public class SysDataDic extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysDataDic"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 分类ID + */ + private String categoryId; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDicCategory.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDicCategory.java new file mode 100644 index 0000000..bd47a83 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDicCategory.java @@ -0,0 +1,76 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 数据字典分类 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_data_dic_category") +public class SysDataDicCategory extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysDataDicCategory"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDicItem.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDicItem.java new file mode 100644 index 0000000..8d9f2cb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDataDicItem.java @@ -0,0 +1,86 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 数据字典值 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_data_dic_item") +public class SysDataDicItem extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysDataDicItem"; + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 字典ID + */ + private String dicId; + + /** + * 排序编号 + */ + private Integer orderNo; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDept.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDept.java new file mode 100644 index 0000000..f1f4fdd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysDept.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 部门 + *

+ * + * @author zmj + * @since 2021-06-26 + */ +@Data +@TableName("sys_dept") +public class SysDept extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SysDept"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 简称 + */ + private String shortName; + + /** + * 父级ID + */ + @TableField + private String parentId; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysMenu.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysMenu.java new file mode 100644 index 0000000..5b6419f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysMenu.java @@ -0,0 +1,149 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.xingyun.template.inner.enums.system.SysMenuComponentType; +import com.lframework.xingyun.template.inner.enums.system.SysMenuDisplay; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统菜单 + *

+ * + * @author zmj + * @since 2021-05-10 + */ +@Data +@TableName("sys_menu") +public class SysMenu extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SysMenu"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称(前端使用) + */ + private String name; + + /** + * 标题 + */ + private String title; + + /** + * 图标 + */ + private String icon; + + /** + * 组件类型 + */ + private SysMenuComponentType componentType; + + /** + * 组件(前端使用) + */ + private String component; + + /** + * 自定义请求参数 + */ + private String requestParam; + + /** + * 父级ID + */ + private String parentId; + + /** + * 路由路径(前端使用) + */ + private String path; + + /** + * 是否缓存(前端使用) + */ + private Boolean noCache; + + /** + * 类型 0-目录 1-菜单 2-功能 + */ + private SysMenuDisplay display; + + /** + * 是否隐藏(前端使用) + */ + private Boolean hidden; + + /** + * 权限 + */ + private String permission; + + /** + * 是否特殊菜单 + */ + private Boolean isSpecial; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysModule.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysModule.java new file mode 100644 index 0000000..1ad1cad --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysModule.java @@ -0,0 +1,78 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +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.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统模块 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_module") +public class SysModule extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysModule"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 名称 + */ + private String name; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysModuleTenant.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysModuleTenant.java new file mode 100644 index 0000000..a5048e2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysModuleTenant.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 租户和系统模块关系表 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_module_tenant") +public class SysModuleTenant extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysModuleTenant"; + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 模块ID + */ + private Integer moduleId; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 过期时间 + */ + private LocalDateTime expireTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysNotice.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysNotice.java new file mode 100644 index 0000000..e7d90c5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysNotice.java @@ -0,0 +1,100 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统通知 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_notice") +public class SysNotice extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysNotice"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 标题 + */ + private String title; + + /** + * 内容 + */ + private String content; + + /** + * 状态 + */ + private Boolean available; + + /** + * 是否发布 + */ + private Boolean published; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 已读人数 + */ + private Integer readedNum; + + /** + * 未读人数 + */ + private Integer unReadNum; + + /** + * 发布时间 + */ + private LocalDateTime publishTime; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysNoticeLog.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysNoticeLog.java new file mode 100644 index 0000000..7b0821f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysNoticeLog.java @@ -0,0 +1,47 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统通知记录 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_notice_log") +public class SysNoticeLog extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysNoticeLog"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 标题 + */ + private String noticeId; + + /** + * 用户ID + */ + private String userId; + + /** + * 是否已读 + */ + private Boolean readed; + + /** + * 已读时间 + */ + private LocalDateTime readTime; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysOpenDomain.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysOpenDomain.java new file mode 100644 index 0000000..a102dc6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysOpenDomain.java @@ -0,0 +1,95 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +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.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 开放域 + *

+ * + * @author zmj + * @since 2021-07-02 + */ +@Data +@TableName("sys_open_domain") +public class SysOpenDomain extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SysOpenDomain"; + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private String id; + + /** + * 名称 + */ + private String name; + + /** + * API密钥 + */ + private String apiSecret; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysParameter.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysParameter.java new file mode 100644 index 0000000..be23f72 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysParameter.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +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.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统参数 + *

+ * + * @author zmj + */ +@Data +@TableName("sys_parameter") +public class SysParameter extends BaseEntity implements BaseDto { + + public static final String CACHE_NAME = "SysParameter"; + private static final long serialVersionUID = 1L; + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 键 + */ + private String pmKey; + + /** + * 值 + */ + private String pmValue; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysPosition.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysPosition.java new file mode 100644 index 0000000..4345805 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysPosition.java @@ -0,0 +1,87 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 系统岗位 + *

+ * + * @author zmj + * @since 2021-07-01 + */ +@Data +@TableName("sys_position") +public class SysPosition extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SysPosition"; + + /** + * ID + */ + private String id; + + /** + * 岗位编号 + */ + private String code; + + /** + * 岗位名称 + */ + private String name; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysRole.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysRole.java new file mode 100644 index 0000000..7559505 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysRole.java @@ -0,0 +1,92 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-02 + */ +@Data +@TableName("sys_role") +public class SysRole extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SysRole"; + + /** + * ID + */ + private String id; + + /** + * 编号 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 权限 + */ + private String permission; + + /** + * 状态 + */ + private Boolean available; + + /** + * 备注 + */ + private String description; + + /** + * 创建人ID 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createById; + + /** + * 创建人 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改人 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 修改人ID 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateById; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysRoleMenu.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysRoleMenu.java new file mode 100644 index 0000000..c78adf9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysRoleMenu.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-04 + */ +@Data +@TableName("sys_role_menu") +public class SysRoleMenu extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 菜单ID + */ + private String menuId; + + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserDept.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserDept.java new file mode 100644 index 0000000..9a9579b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserDept.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-04 + */ +@Data +@TableName("sys_user_dept") +public class SysUserDept extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "SysUserDept"; + + /** + * ID + */ + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 部门ID + */ + private String deptId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserPosition.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserPosition.java new file mode 100644 index 0000000..a433770 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserPosition.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-04 + */ +@Data +@TableName("sys_user_position") +public class SysUserPosition extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 岗位ID + */ + private String positionId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserRole.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserRole.java new file mode 100644 index 0000000..29a6b26 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserRole.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author zmj + * @since 2021-07-04 + */ +@Data +@TableName("sys_user_role") +public class SysUserRole extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 角色ID + */ + private String roleId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserTelephone.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserTelephone.java new file mode 100644 index 0000000..2d9be92 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/SysUserTelephone.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import lombok.Data; + +@Data +@TableName("sys_user_telephone") +public class SysUserTelephone extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 手机号 + */ + private String telephone; + + /** + * 用户ID + */ + private String userId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/Tenant.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/Tenant.java new file mode 100644 index 0000000..b421235 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/entity/Tenant.java @@ -0,0 +1,71 @@ +package com.lframework.xingyun.template.inner.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +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.lframework.starter.web.entity.BaseEntity; +import com.lframework.starter.web.dto.BaseDto; +import java.time.LocalDateTime; +import lombok.Data; + +/** + *

+ * 租户 + *

+ * + * @author zmj + * @since 2023-03-05 + */ +@Data +@TableName("tenant") +public class Tenant extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "Tenant"; + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 名称 + */ + private String name; + + /** + * JdbcUrl + */ + private String jdbcUrl; + + /** + * Jdbc用户名 + */ + private String jdbcUsername; + + /** + * Jdbc密码 + */ + private String jdbcPassword; + + /** + * 状态 + */ + private Boolean available; + + /** + * 创建时间 新增时赋值 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 新增和修改时赋值 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/QrtzJobType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/QrtzJobType.java new file mode 100644 index 0000000..30469f0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/QrtzJobType.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.inner.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +/** + * @author zmj + * @since 2022/8/20 + */ +public enum QrtzJobType implements BaseEnum { + EXCUTE_CLASS(1, "指定类"), + GROOVY(2, "Groovy脚本"); + + @EnumValue + private final Integer code; + + private final String desc; + + QrtzJobType(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getDesc() { + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/TriggerState.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/TriggerState.java new file mode 100644 index 0000000..f0b2066 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/TriggerState.java @@ -0,0 +1,34 @@ +package com.lframework.xingyun.template.inner.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum TriggerState implements BaseEnum { + WAITING("WAITING", "等待执行"), + PAUSED("PAUSED", "暂停执行"), + ACQUIRED("ACQUIRED", "正常执行"), + BLOCKED("BLOCKED", "阻塞"), + ERROR("ERROR", "执行错误"), + COMPLETE("COMPLETE", "执行完毕"), + PAUSED_BLOCKED("PAUSED_BLOCKED", "阻塞暂停"); + + @EnumValue + private final String code; + + private final String desc; + + TriggerState(String code, String desc) { + this.code = code; + this.desc = desc; + } + + @Override + public String getCode() { + return this.code; + } + + @Override + public String getDesc() { + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysDeptNodeType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysDeptNodeType.java new file mode 100644 index 0000000..179f7e8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysDeptNodeType.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.inner.enums.system; + +import com.lframework.xingyun.template.core.enums.NodeType; +import java.io.Serializable; +import org.springframework.stereotype.Component; + +@Component +public final class SysDeptNodeType implements NodeType, Serializable { + + private static final long serialVersionUID = 1L; + + @Override + public Integer getCode() { + + return 1; + } + + @Override + public String getDesc() { + + return "部门"; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysMenuComponentType.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysMenuComponentType.java new file mode 100644 index 0000000..961bce1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysMenuComponentType.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.inner.enums.system; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SysMenuComponentType implements BaseEnum { + + NORMAL(0, "普通"), CUSTOM_LIST(1, "自定义列表"), CUSTOM_PAGE(3, "自定义页面"); + + @EnumValue + private final Integer code; + + private final String desc; + + SysMenuComponentType(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysMenuDisplay.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysMenuDisplay.java new file mode 100644 index 0000000..10bdfde --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/enums/system/SysMenuDisplay.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.inner.enums.system; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.lframework.starter.web.enums.BaseEnum; + +public enum SysMenuDisplay implements BaseEnum { + + CATALOG(0, "目录"), FUNCTION(1, "菜单"), PERMISSION(2, "权限"); + + @EnumValue + private final Integer code; + + private final String desc; + + SysMenuDisplay(Integer code, String desc) { + + this.code = code; + this.desc = desc; + } + + @Override + public Integer getCode() { + + return this.code; + } + + @Override + public String getDesc() { + + return this.desc; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/LoginEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/LoginEvent.java new file mode 100644 index 0000000..bf2a184 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/LoginEvent.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.inner.events; + +import com.lframework.starter.web.common.security.AbstractUserDetails; +import org.springframework.context.ApplicationEvent; + +/** + * 用户登录事件 + * + * @author zmj + */ +public class LoginEvent extends ApplicationEvent { + + private final AbstractUserDetails user; + + private final String token; + + /** + * Create a new {@code ApplicationEvent}. + * + * @param source the object on which the event initially occurred or with which the event is + * associated (never {@code null}) + */ + public LoginEvent(Object source, AbstractUserDetails user, String token) { + + super(source); + + this.user = user; + this.token = token; + } + + public AbstractUserDetails getUser() { + + return user; + } + + public String getToken() { + + return token; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/LogoutEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/LogoutEvent.java new file mode 100644 index 0000000..5024d49 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/LogoutEvent.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.inner.events; + +import com.lframework.starter.web.common.security.AbstractUserDetails; +import org.springframework.context.ApplicationEvent; + +/** + * 用户退出登录事件 + * + * @author zmj + */ +public class LogoutEvent extends ApplicationEvent { + + private final AbstractUserDetails user; + + private final String token; + + public LogoutEvent(Object source, AbstractUserDetails user, String token) { + + super(source); + this.user = user; + this.token = token; + } + + public AbstractUserDetails getUser() { + + return user; + } + + public String getToken() { + + return token; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/UpdateUserEvent.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/UpdateUserEvent.java new file mode 100644 index 0000000..646a1a9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/events/UpdateUserEvent.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.inner.events; + +import org.springframework.context.ApplicationEvent; + +/** + * 修改用户事件 + * + * @author zmj + */ +public class UpdateUserEvent extends ApplicationEvent { + + /** + * 用户ID + */ + private String id; + + public UpdateUserEvent(Object source, String id) { + + super(source); + this.id = id; + } + + public String getId() { + + return id; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/AbstractUserDetailsService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/AbstractUserDetailsService.java new file mode 100644 index 0000000..d930659 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/AbstractUserDetailsService.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.template.inner.impl; + +import com.lframework.starter.common.exceptions.impl.UserLoginException; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityConstants; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.starter.web.components.security.UserDetailsService; +import com.lframework.starter.web.utils.RequestUtil; +import com.lframework.starter.web.utils.TenantUtil; +import com.lframework.xingyun.template.inner.service.SysModuleTenantService; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import java.util.List; +import java.util.Set; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +/** + * 所有UserDetailsService都需要继承此类 如果需要更改用户表,那么继承此类注册Bean即可 + * + * @author zmj + */ +@Slf4j +public abstract class AbstractUserDetailsService implements UserDetailsService { + + @Autowired + private SysMenuService sysMenuService; + + @Autowired + private SysModuleTenantService sysModuleTenantService; + + @Value("${remove-fixed-permissions:false}") + private Boolean removeFixedPermission; + + @Override + public AbstractUserDetails loadUserByUsername(String username) throws UserLoginException { + + //根据登录名查询 + AbstractUserDetails userDetails = this.findByUsername(username); + + if (ObjectUtil.isEmpty(userDetails)) { + log.debug("用户名 {} 不存在", username); + throw new UserLoginException("用户名或密码错误!"); + } + + userDetails.setTenantId(TenantContextHolder.getTenantId()); + + //获取登录IP + userDetails.setIp(RequestUtil.getRequestIp()); + + // 先查询当前租户使用的module + List moduleIds = null; + if (TenantUtil.enableTenant()) { + moduleIds = sysModuleTenantService.getAvailableModuleIdsByTenantId( + TenantContextHolder.getTenantId()); + } + + // 先取角色的权限 + userDetails.setPermissions(sysMenuService.getRolePermissionByUserId(userDetails.getId())); + userDetails.setIsAdmin( + userDetails.getPermissions().contains(SecurityConstants.PERMISSION_ADMIN_NAME)); + // 再取菜单的权限 + Set permissions = sysMenuService.getPermissionsByUserId(userDetails.getId(), + userDetails.isAdmin(), moduleIds); + // 合并权限 + permissions.addAll(userDetails.getPermissions()); + if (this.removeFixedPermission) { + permissions.remove(SecurityConstants.PERMISSION_ADMIN_NAME); + } + userDetails.setPermissions(permissions); + + return userDetails; + } + + /** + * 根据登录名查询 + * + * @param username + * @return + */ + public abstract AbstractUserDetails findByUsername(String username); + + /** + * 根据用户ID查询编码 + * + * @param userId + * @return + */ + public abstract String codeByUserId(String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/QrtzServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/QrtzServiceImpl.java new file mode 100644 index 0000000..50079be --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/QrtzServiceImpl.java @@ -0,0 +1,201 @@ +package com.lframework.xingyun.template.inner.impl; + +import cn.hutool.core.exceptions.UtilException; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ReflectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.core.components.qrtz.QrtzHandler; +import com.lframework.xingyun.template.inner.components.qrtz.DynamicQrtzJob; +import com.lframework.xingyun.template.inner.dto.qrtz.QrtzDto; +import com.lframework.xingyun.template.inner.enums.QrtzJobType; +import com.lframework.xingyun.template.inner.mappers.QrtzMapper; +import com.lframework.xingyun.template.inner.service.QrtzService; +import com.lframework.xingyun.template.inner.vo.qrtz.CreateQrtzVo; +import com.lframework.xingyun.template.inner.vo.qrtz.QueryQrtzVo; +import com.lframework.xingyun.template.inner.vo.qrtz.UpdateQrtzVo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.extern.slf4j.Slf4j; +import org.quartz.JobDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * @author zmj + * @since 2022/8/20 + */ +@Slf4j +@DS("master") +@Service +public class QrtzServiceImpl implements QrtzService { + + @Autowired + private QrtzMapper qrtzMapper; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryQrtzVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + vo.setJobClasses(new ArrayList<>()); + vo.getJobClasses().add(DynamicQrtzJob.class.getName()); + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = qrtzMapper.query(vo); + PageResult pageResult = PageResultUtil.convert(new PageInfo<>(datas)); + datas.stream().forEach(this::renderDto); + + return pageResult; + } + + @Override + public QrtzDto findById(String name, String group) { + QrtzDto data = qrtzMapper.findById(name, group); + if (data == null) { + return null; + } + + return renderDto(data); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void create(CreateQrtzVo vo) { + JobDetail jobDetail = QrtzHandler.getJob(vo.getName(), vo.getGroup()); + if (jobDetail != null) { + throw new DefaultClientException("名称、组不允许重复,请重新输入!"); + } + QrtzJobType jobType = EnumUtil.getByCode(QrtzJobType.class, vo.getJobType()); + if (jobType == QrtzJobType.EXCUTE_CLASS) { + if (StringUtil.isBlank(vo.getTargetClassName())) { + throw new DefaultClientException("类名不能为空!"); + } + if (StringUtil.isBlank(vo.getTargetMethodName())) { + throw new DefaultClientException("方法名不能为空!"); + } + + if (!CollectionUtil.isEmpty(vo.getTargetParamTypes()) || !CollectionUtil.isEmpty( + vo.getTargetParams())) { + int typeSize = vo.getTargetParamTypes() == null ? 0 : vo.getTargetParamTypes().size(); + int paramSize = vo.getTargetParams() == null ? 0 : vo.getTargetParams().size(); + if (typeSize != paramSize) { + throw new DefaultClientException("参数类型与参数数量不匹配!"); + } + } + try { + Class clazz = Class.forName(vo.getTargetClassName()); + ReflectUtil.newInstance(clazz); + Class[] paramTypes = null; + if (!CollectionUtil.isEmpty(vo.getTargetParamTypes())) { + paramTypes = new Class[vo.getTargetParamTypes().size()]; + for (int i = 0; i < vo.getTargetParamTypes().size(); i++) { + String targetParamType = vo.getTargetParamTypes().get(i); + try { + paramTypes[i] = Class.forName(targetParamType); + } catch (ClassNotFoundException e) { + throw new DefaultClientException( + "参数类型:" + targetParamType + "不存在,需要输入类型全名称,如:java.lang.String,请检查!"); + } + } + } + // 验证一下参数 + ReflectUtil.getMethod(clazz, vo.getTargetMethodName(), paramTypes); + + Map jobDataMap = new HashMap<>(); + jobDataMap.put("targetClassName", vo.getTargetClassName()); + jobDataMap.put("targetMethodName", vo.getTargetMethodName()); + jobDataMap.put("targetParamTypes", vo.getTargetParamTypes()); + jobDataMap.put("targetParams", vo.getTargetParams()); + jobDataMap.put("jobType", vo.getJobType()); + if (vo.getTenantId() != null) { + jobDataMap.put(StringPool.TENANT_ID_QRTZ, vo.getTenantId()); + } + + QrtzHandler.addJob(vo.getName(), vo.getGroup(), DynamicQrtzJob.class, + "custom_trigger_" + vo.getName(), vo.getGroup(), vo.getCron(), jobDataMap, + vo.getDescription()); + } catch (ClassNotFoundException e) { + throw new DefaultClientException("类:" + vo.getTargetClassName() + "不存在,请检查!"); + } catch (UtilException e) { + throw new DefaultClientException("类:" + vo.getTargetClassName() + "无法加载,请检查!"); + } + } else { + Map jobDataMap = new HashMap<>(); + jobDataMap.put("script", vo.getScript()); + jobDataMap.put("jobType", vo.getJobType()); + if (vo.getTenantId() != null) { + jobDataMap.put(StringPool.TENANT_ID_QRTZ, vo.getTenantId()); + } + + QrtzHandler.addJob(vo.getName(), vo.getGroup(), DynamicQrtzJob.class, + "custom_trigger_" + vo.getName(), vo.getGroup(), vo.getCron(), jobDataMap, + vo.getDescription()); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateQrtzVo vo) { + JobDetail jobDetail = QrtzHandler.getJob(vo.getOriName(), vo.getOriGroup()); + if (jobDetail == null) { + throw new DefaultClientException("任务不存在!"); + } + + this.delete(vo.getOriName(), vo.getOriGroup()); + + this.create(vo); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void resume(String name, String group) { + QrtzHandler.resume(name, group); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void pause(String name, String group) { + QrtzHandler.pause(name, group); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void trigger(String name, String group) { + QrtzHandler.trigger(name, group); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(String name, String group) { + + QrtzHandler.deleteJob(name, group, "custom_trigger_" + name, group); + } + + private QrtzDto renderDto(QrtzDto data) { + JobDetail jobDetail = QrtzHandler.getJob(data.getName(), data.getGroup()); + Integer jobType = jobDetail.getJobDataMap().getIntValue("jobType"); + data.setJobType(EnumUtil.getByCode(QrtzJobType.class, jobType)); + data.setTargetClassName(jobDetail.getJobDataMap().getString("targetClassName")); + data.setTargetMethodName(jobDetail.getJobDataMap().getString("targetMethodName")); + data.setTargetParamTypes((List) jobDetail.getJobDataMap().get("targetParamTypes")); + data.setTargetParams((List) jobDetail.getJobDataMap().get("targetParams")); + data.setScript(jobDetail.getJobDataMap().getString("script")); + Object tenantStr = jobDetail.getJobDataMap().get(StringPool.TENANT_ID_QRTZ); + data.setTenantId(tenantStr == null ? null : Integer.valueOf(String.valueOf(tenantStr))); + + return data; + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/SysModuleServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/SysModuleServiceImpl.java new file mode 100644 index 0000000..a782082 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/SysModuleServiceImpl.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.template.inner.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.inner.entity.SysModule; +import com.lframework.xingyun.template.inner.mappers.SysModuleMapper; +import com.lframework.xingyun.template.inner.service.SysModuleService; +import org.springframework.stereotype.Service; + +@DS("master") +@Service +public class SysModuleServiceImpl extends BaseMpServiceImpl implements + SysModuleService { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/SysModuleTenantServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/SysModuleTenantServiceImpl.java new file mode 100644 index 0000000..9e3fd2e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/SysModuleTenantServiceImpl.java @@ -0,0 +1,70 @@ +package com.lframework.xingyun.template.inner.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.DateUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.inner.entity.SysModuleTenant; +import com.lframework.xingyun.template.inner.mappers.SysModuleTenantMapper; +import com.lframework.xingyun.template.inner.service.SysModuleTenantService; +import com.lframework.xingyun.template.inner.vo.system.module.SysModuleTenantVo; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@DS("master") +@Service +public class SysModuleTenantServiceImpl extends + BaseMpServiceImpl implements SysModuleTenantService { + + @Override + public List getAvailableModuleIdsByTenantId(Integer tenantId) { + SysModuleTenantService thisService = getThis(getClass()); + return thisService.getByTenantId(tenantId).stream() + .filter(t -> DateUtil.now().isBefore(t.getExpireTime())).map(SysModuleTenant::getModuleId) + .collect(Collectors.toList()); + } + + @Cacheable(value = SysModuleTenant.CACHE_NAME, key = "#tenantId", unless = "#result == null or #result.isEmpty()") + @Override + public List getByTenantId(Integer tenantId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(SysModuleTenant.class) + .eq(SysModuleTenant::getTenantId, tenantId); + return this.list(queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setting(SysModuleTenantVo vo) { + Wrapper queryWrapper = Wrappers.lambdaQuery(SysModuleTenant.class) + .eq(SysModuleTenant::getTenantId, vo.getTenantId()); + this.remove(queryWrapper); + + if (CollectionUtil.isNotEmpty(vo.getModules())) { + List records = vo.getModules().stream().map(t -> { + SysModuleTenant record = new SysModuleTenant(); + record.setId(IdUtil.getId()); + record.setModuleId(t.getModuleId()); + record.setTenantId(vo.getTenantId()); + record.setExpireTime(t.getExpireTime()); + + return record; + }).collect(Collectors.toList()); + + this.saveBatch(records); + } + } + + @CacheEvict(value = SysModuleTenant.CACHE_NAME, key = "#key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/TenantServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/TenantServiceImpl.java new file mode 100644 index 0000000..4b7ee03 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/TenantServiceImpl.java @@ -0,0 +1,108 @@ +package com.lframework.xingyun.template.inner.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.EncryptUtil; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.xingyun.template.inner.service.TenantService; +import com.lframework.xingyun.template.inner.vo.system.tenant.CreateTenantVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.QueryTenantVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.TenantSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.UpdateTenantVo; +import com.lframework.xingyun.template.inner.mappers.TenantMapper; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@DS("master") +@Service +public class TenantServiceImpl extends BaseMpServiceImpl implements + TenantService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QueryTenantVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, TenantSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = Tenant.CACHE_NAME, key = "#id", unless = "#result == null") + @Override + public Tenant findById(Integer id) { + return getById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public Integer create(CreateTenantVo data) { + + Tenant record = new Tenant(); + record.setName(data.getName()); + record.setJdbcUrl(data.getJdbcUrl()); + record.setJdbcUsername(data.getJdbcUsername()); + record.setJdbcPassword(EncryptUtil.encrypt(data.getJdbcPassword())); + record.setAvailable(Boolean.TRUE); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateTenantVo data) { + + Tenant record = this.getById(data.getId()); + if (record == null) { + throw new DefaultClientException("租户不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Tenant.class) + .eq(Tenant::getId, data.getId()).set(Tenant::getName, data.getName()) + .set(Tenant::getAvailable, data.getAvailable()); + if (StringUtil.isNotBlank(data.getJdbcUrl())) { + updateWrapper.set(Tenant::getJdbcUrl, data.getJdbcUrl()); + } + if (StringUtil.isNotBlank(data.getJdbcUsername())) { + updateWrapper.set(Tenant::getJdbcUsername, data.getJdbcUsername()); + } + if (StringUtil.isNotBlank(data.getJdbcPassword())) { + updateWrapper.set(Tenant::getJdbcPassword, EncryptUtil.encrypt(data.getJdbcPassword())); + } + + this.update(updateWrapper); + } + + @CacheEvict(value = Tenant.CACHE_NAME, key = "#key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/UserDetailsService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/UserDetailsService.java new file mode 100644 index 0000000..2e0f1e6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/UserDetailsService.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.impl; + +import com.lframework.xingyun.template.inner.mappers.UserDetailsMapper; +import com.lframework.starter.web.common.security.AbstractUserDetails; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * UserDetaisService默认实现 + * + * @author zmj + */ +@Service +public class UserDetailsService extends AbstractUserDetailsService { + + @Autowired + private UserDetailsMapper userDetailsMapper; + + @Override + public AbstractUserDetails findByUsername(String username) { + + AbstractUserDetails user = userDetailsMapper.findByUsername(username); + + return user; + } + + @Override + public String codeByUserId(String userId) { + return userDetailsMapper.codeByUserId(userId); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicCategoryServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicCategoryServiceImpl.java new file mode 100644 index 0000000..eda24c5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicCategoryServiceImpl.java @@ -0,0 +1,130 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.service.system.SysDataDicCategoryService; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.xingyun.template.inner.vo.system.dic.category.CreateSysDataDicCategoryVo; +import com.lframework.xingyun.template.inner.vo.system.dic.category.SysDataDicCategorySelectorVo; +import com.lframework.xingyun.template.inner.vo.system.dic.category.UpdateSysDataDicCategoryVo; +import com.lframework.xingyun.template.inner.mappers.system.SysDataDicCategoryMapper; +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysDataDicCategoryServiceImpl extends + BaseMpServiceImpl implements + SysDataDicCategoryService { + + @Autowired + private SysDataDicService sysDataDicService; + + @Cacheable(value = SysDataDicCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + 'all'") + @Override + public List queryList() { + return getBaseMapper().query(); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SysDataDicCategorySelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SysDataDicCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysDataDicCategory findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysDataDicCategoryVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDataDicCategory.class) + .eq(SysDataDicCategory::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysDataDicCategory.class) + .eq(SysDataDicCategory::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysDataDicCategory record = new SysDataDicCategory(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysDataDicCategoryVo vo) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDataDicCategory.class) + .eq(SysDataDicCategory::getCode, vo.getCode()).ne(SysDataDicCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysDataDicCategory.class) + .eq(SysDataDicCategory::getName, vo.getName()).ne(SysDataDicCategory::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysDataDicCategory record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("数据字典分类不存在!"); + } + + record.setCode(vo.getCode()); + record.setName(vo.getName()); + + this.updateById(record); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + Wrapper queryDicWrapper = Wrappers.lambdaQuery(SysDataDic.class) + .eq(SysDataDic::getCategoryId, id); + if (sysDataDicService.count(queryDicWrapper) > 0) { + throw new DefaultClientException("此分类下存在数据字典,无法删除!"); + } + + this.removeById(id); + } + + @CacheEvict(value = SysDataDicCategory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicItemServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicItemServiceImpl.java new file mode 100644 index 0000000..55a01bb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicItemServiceImpl.java @@ -0,0 +1,156 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.xingyun.template.inner.vo.system.dic.item.CreateSysDataDicItemVo; +import com.lframework.xingyun.template.inner.vo.system.dic.item.QuerySysDataDicItemVo; +import com.lframework.xingyun.template.inner.vo.system.dic.item.UpdateSysDataDicItemVo; +import com.lframework.xingyun.template.inner.mappers.system.SysDataDicItemMapper; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.service.system.SysDataDicItemService; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysDataDicItemServiceImpl extends + BaseMpServiceImpl implements SysDataDicItemService { + + @Autowired + private SysDataDicService sysDataDicService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySysDataDicItemVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySysDataDicItemVo vo) { + return getBaseMapper().query(vo); + } + + @Cacheable(value = SysDataDicItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysDataDicItem findById(String id) { + return getBaseMapper().selectById(id); + } + + @Override + public SysDataDicItem findByCode(String dicCode, String code) { + SysDataDicItemService thisService = getThis(getClass()); + List items = thisService.findByDicCode(dicCode); + if (CollectionUtil.isEmpty(items)) { + return null; + } + + return items.stream().filter(t -> t.getCode().equals(code)).findFirst().orElse(null); + } + + @Cacheable(value = SysDataDicItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #dicCode") + @Override + public List findByDicCode(String dicCode) { + Wrapper queryDicWrapper = Wrappers.lambdaQuery(SysDataDic.class) + .eq(SysDataDic::getCode, dicCode); + SysDataDic dic = sysDataDicService.getOne(queryDicWrapper); + if (dic == null) { + throw new DefaultClientException("数据字典不存在!"); + } + + Wrapper queryWrapper = Wrappers.lambdaQuery(SysDataDicItem.class) + .eq(SysDataDicItem::getDicId, dic.getId()).orderByAsc(SysDataDicItem::getOrderNo); + List datas = this.list(queryWrapper); + + return datas; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysDataDicItemVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDataDicItem.class) + .eq(SysDataDicItem::getDicId, vo.getDicId()) + .eq(SysDataDicItem::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysDataDicItem.class) + .eq(SysDataDicItem::getDicId, vo.getDicId()) + .eq(SysDataDicItem::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysDataDicItem record = new SysDataDicItem(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + record.setDicId(vo.getDicId()); + record.setOrderNo(vo.getOrderNo()); + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysDataDicItemVo vo) { + + SysDataDicItem record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("数据字典值不存在!"); + } + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDataDicItem.class) + .eq(SysDataDicItem::getDicId, record.getDicId()) + .eq(SysDataDicItem::getCode, vo.getCode()).ne(SysDataDicItem::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysDataDicItem.class) + .eq(SysDataDicItem::getDicId, record.getDicId()) + .eq(SysDataDicItem::getName, vo.getName()).ne(SysDataDicItem::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysDataDicItem.class) + .set(SysDataDicItem::getCode, vo.getCode()).set(SysDataDicItem::getName, vo.getName()) + .set(SysDataDicItem::getOrderNo, vo.getOrderNo()).eq(SysDataDicItem::getId, vo.getId()); + this.update(updateWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + this.removeById(id); + } + + @CacheEvict(value = SysDataDicItem.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicServiceImpl.java new file mode 100644 index 0000000..1cb6066 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataDicServiceImpl.java @@ -0,0 +1,145 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.xingyun.template.inner.service.system.SysDataDicItemService; +import com.lframework.xingyun.template.inner.service.system.SysDataDicService; +import com.lframework.xingyun.template.inner.vo.system.dic.CreateSysDataDicVo; +import com.lframework.xingyun.template.inner.vo.system.dic.QuerySysDataDicVo; +import com.lframework.xingyun.template.inner.vo.system.dic.SysDataDicSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.dic.UpdateSysDataDicVo; +import com.lframework.xingyun.template.inner.mappers.system.SysDataDicMapper; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysDataDicServiceImpl extends + BaseMpServiceImpl implements + SysDataDicService { + + @Autowired + private SysDataDicItemService sysDataDicItemService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySysDataDicVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySysDataDicVo vo) { + return getBaseMapper().query(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SysDataDicSelectorVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().selector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SysDataDic.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysDataDic findById(String id) { + return getBaseMapper().selectById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysDataDicVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDataDic.class) + .eq(SysDataDic::getCode, vo.getCode()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysDataDic.class) + .eq(SysDataDic::getName, vo.getName()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysDataDic record = new SysDataDic(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + if (!StringUtil.isBlank(vo.getCategoryId())) { + record.setCategoryId(vo.getCategoryId()); + } + + this.save(record); + + return record.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysDataDicVo vo) { + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDataDic.class) + .eq(SysDataDic::getCode, vo.getCode()).ne(SysDataDic::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysDataDic.class) + .eq(SysDataDic::getName, vo.getName()).ne(SysDataDic::getId, vo.getId()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysDataDic record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("数据字典不存在!"); + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysDataDic.class) + .set(SysDataDic::getCode, vo.getCode()).set(SysDataDic::getName, vo.getName()) + .set(SysDataDic::getCategoryId, + StringUtil.isBlank(vo.getCategoryId()) ? null : vo.getCategoryId()) + .eq(SysDataDic::getId, vo.getId()); + this.update(updateWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(String id) { + + this.removeById(id); + + Wrapper deleteItemWrapper = Wrappers.lambdaQuery(SysDataDicItem.class) + .eq(SysDataDicItem::getDicId, id); + sysDataDicItemService.remove(deleteItemWrapper); + } + + @CacheEvict(value = SysDataDic.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataPermissionDataServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataPermissionDataServiceImpl.java new file mode 100644 index 0000000..58e7703 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDataPermissionDataServiceImpl.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.core.entity.SysDataPermissionData; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.inner.mappers.system.SysDataPermissionDataMapper; +import com.lframework.xingyun.template.inner.service.system.SysDataPermissionDataService; +import java.util.List; +import org.springframework.stereotype.Service; + +@Service +public class SysDataPermissionDataServiceImpl extends + BaseMpServiceImpl implements + SysDataPermissionDataService { + + @Override + public List getByBizId(String bizId) { + Wrapper queryWrapper = Wrappers.lambdaQuery(SysDataPermissionData.class) + .eq(SysDataPermissionData::getBizId, bizId); + + return this.list(queryWrapper); + } + + @Override + public SysDataPermissionData getByBizId(String bizId, Integer bizType, Integer permissionType) { + Wrapper queryWrapper = Wrappers.lambdaQuery(SysDataPermissionData.class) + .eq(SysDataPermissionData::getBizId, bizId).eq(SysDataPermissionData::getBizType, bizType) + .eq(SysDataPermissionData::getPermissionType, permissionType); + + return this.getOne(queryWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDeptServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDeptServiceImpl.java new file mode 100644 index 0000000..20565b3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysDeptServiceImpl.java @@ -0,0 +1,284 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.service.DeptService; +import com.lframework.xingyun.template.core.service.RecursionMappingService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.xingyun.template.inner.enums.system.SysDeptNodeType; +import com.lframework.xingyun.template.inner.vo.system.dept.CreateSysDeptVo; +import com.lframework.xingyun.template.inner.vo.system.dept.UpdateSysDeptVo; +import com.lframework.xingyun.template.inner.mappers.system.SysDeptMapper; +import com.lframework.xingyun.template.inner.service.system.SysDeptService; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysDeptServiceImpl extends BaseMpServiceImpl implements + SysDeptService { + + @Autowired + private RecursionMappingService recursionMappingService; + + @Autowired + private DeptService deptService; + + @Override + public List selector() { + + return this.doSelector(); + } + + @Cacheable(value = SysDept.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysDept findById(String id) { + + return this.doGetById(id); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "停用部门,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + List batchIds = new ArrayList<>(); + for (String id : ids) { + List nodeChildIds = recursionMappingService.getNodeChildIds(id, + ApplicationUtil.getBean(SysDeptNodeType.class)); + if (CollectionUtil.isEmpty(nodeChildIds)) { + continue; + } + + batchIds.addAll(nodeChildIds); + } + + batchIds.addAll(ids); + + this.doBatchUnable(batchIds); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "启用部门,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + List batchIds = new ArrayList<>(); + for (String id : ids) { + List nodeChildIds = recursionMappingService.getNodeParentIds(id, + ApplicationUtil.getBean(SysDeptNodeType.class)); + if (CollectionUtil.isEmpty(nodeChildIds)) { + continue; + } + + batchIds.addAll(nodeChildIds); + } + + batchIds.addAll(ids); + + this.doBatchEnable(batchIds); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "新增部门,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysDeptVo vo) { + + SysDept data = this.doCreate(vo); + + this.saveRecursion(data.getId(), data.getParentId()); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "修改部门,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysDeptVo vo) { + + this.doUpdate(vo); + + this.saveRecursion(vo.getId(), vo.getParentId()); + + OpLogUtil.setVariable("id", vo.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + protected List doSelector() { + + return getBaseMapper().selector(); + } + + protected SysDept doGetById(String id) { + + return getBaseMapper().findById(id); + } + + protected void doBatchUnable(Collection ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysDept.class) + .set(SysDept::getAvailable, Boolean.FALSE).in(SysDept::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected void doBatchEnable(Collection ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysDept.class) + .set(SysDept::getAvailable, Boolean.TRUE).in(SysDept::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected SysDept doCreate(CreateSysDeptVo vo) { + + //查询Code是否重复 + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDept.class) + .eq(SysDept::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + //查询Name是否重复 + checkWrapper = Wrappers.lambdaQuery(SysDept.class) + .eq(SysDept::getName, vo.getName()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysDept parentDept = null; + //如果parentId不为空,查询上级部门是否存在 + if (!StringUtil.isBlank(vo.getParentId())) { + parentDept = this.getById(vo.getParentId()); + if (parentDept == null) { + throw new DefaultClientException("上级部门不存在,请检查!"); + } + } + + SysDept data = new SysDept(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + data.setShortName(vo.getShortName()); + if (!StringUtil.isBlank(vo.getParentId())) { + data.setParentId(vo.getParentId()); + } + data.setAvailable(parentDept == null ? Boolean.TRUE : parentDept.getAvailable()); + data.setDescription(vo.getDescription()); + + getBaseMapper().insert(data); + + return data; + } + + protected void doUpdate(UpdateSysDeptVo vo) { + + SysDept data = this.findById(vo.getId()); + if (data == null) { + throw new DefaultClientException("部门不存在!"); + } + + //查询Code是否重复 + Wrapper checkWrapper = Wrappers.lambdaQuery(SysDept.class) + .eq(SysDept::getCode, vo.getCode()).ne(SysDept::getId, data.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + //查询Name是否重复 + checkWrapper = Wrappers.lambdaQuery(SysDept.class) + .eq(SysDept::getName, vo.getName()) + .ne(SysDept::getId, data.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + //如果parentId不为空,查询上级部门是否存在 + if (!StringUtil.isBlank(vo.getParentId())) { + if (ObjectUtil.equals(vo.getParentId(), data.getId())) { + throw new DefaultClientException("上级部门不能是当前部门!"); + } + Wrapper checkParentWrapper = Wrappers.lambdaQuery(SysDept.class) + .eq(SysDept::getId, vo.getParentId()); + if (getBaseMapper().selectCount(checkParentWrapper) == 0) { + throw new DefaultClientException("上级部门不存在,请检查!"); + } + } + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysDept.class) + .set(SysDept::getCode, vo.getCode()).set(SysDept::getName, vo.getName()) + .set(SysDept::getShortName, vo.getShortName()) + .set(SysDept::getParentId, + StringUtil.isBlank(vo.getParentId()) ? null : vo.getParentId()) + .set(SysDept::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(SysDept::getAvailable, vo.getAvailable()).eq(SysDept::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + if (vo.getAvailable()) { + this.batchEnable(Collections.singletonList(vo.getId())); + } else { + this.batchUnable(Collections.singletonList(vo.getId())); + } + } + + /** + * 保存递归信息 + * + * @param deptId + * @param parentId + */ + protected void saveRecursion(String deptId, String parentId) { + + if (!StringUtil.isBlank(parentId)) { + List parentIds = recursionMappingService.getNodeParentIds(parentId, + ApplicationUtil.getBean(SysDeptNodeType.class)); + if (CollectionUtil.isEmpty(parentIds)) { + parentIds = new ArrayList<>(); + } + parentIds.add(parentId); + + recursionMappingService.saveNode(deptId, ApplicationUtil.getBean(SysDeptNodeType.class), + parentIds); + } else { + recursionMappingService.saveNode(deptId, ApplicationUtil.getBean(SysDeptNodeType.class)); + } + } + + @CacheEvict(value = {SysDept.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + deptService.cleanCacheByKey(key); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysMenuServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysMenuServiceImpl.java new file mode 100644 index 0000000..299d8f7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysMenuServiceImpl.java @@ -0,0 +1,443 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.common.security.SecurityConstants; +import com.lframework.starter.web.common.utils.ApplicationUtil; +import com.lframework.starter.web.components.security.IUserTokenResolver; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.web.utils.SpelUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.inner.dto.MenuDto; +import com.lframework.xingyun.template.inner.enums.system.SysMenuComponentType; +import com.lframework.xingyun.template.inner.enums.system.SysMenuDisplay; +import com.lframework.xingyun.template.inner.vo.system.menu.CreateSysMenuVo; +import com.lframework.xingyun.template.inner.vo.system.menu.SysMenuSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.menu.UpdateSysMenuVo; +import com.lframework.xingyun.template.inner.mappers.system.SysMenuMapper; +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; +import lombok.NonNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + *

+ * 系统菜单 服务实现类 + *

+ * + * @author zmj + * @since 2021-05-10 + */ +@Service +public class SysMenuServiceImpl extends BaseMpServiceImpl implements + SysMenuService { + + private String tokenKey = "X-Auth-Token"; + + @Autowired + private IUserTokenResolver userTokenResolver; + + @Override + public List queryList(List moduleIds) { + + return this.doQuery(moduleIds); + } + + @Override + public List getByRoleId(String roleId, List moduleIds) { + + return this.doGetByRoleId(roleId, moduleIds); + } + + @Cacheable(value = SysMenu.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysMenu findById(@NonNull String id) { + + return this.doGetById(id); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "新增菜单,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(@NonNull CreateSysMenuVo vo) { + + SysMenu data = this.doCreate(vo); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "修改菜单,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(@NonNull UpdateSysMenuVo vo) { + + SysMenu oriMenu = this.findById(vo.getId()); + + if (!ObjectUtil.equals(vo.getDisplay(), oriMenu.getDisplay().getCode())) { + throw new DefaultClientException("菜单【" + oriMenu.getTitle() + "】" + "不允许更改类型!"); + } + + SysMenu data = this.doUpdate(vo); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "删除菜单,ID:{}", params = "#id") + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(@NonNull String id) { + + SysMenu oriMenu = this.findById(id); + + List children = this.doGetChildrenById(id); + if (CollectionUtil.isNotEmpty(children)) { + //如果子节点不为空 + throw new DefaultClientException("菜单【" + oriMenu.getTitle() + "】存在子菜单,无法删除!"); + } + + this.doDeleteById(id); + } + + @Override + public List selector(SysMenuSelectorVo vo, List moduleIds) { + + return this.doSelector(vo, moduleIds); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "启用菜单,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(@NonNull List ids, @NonNull String userId) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + this.doBatchEnable(ids, userId); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "停用菜单,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(@NonNull List ids, @NonNull String userId) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + this.doBatchUnable(ids, userId); + } + + @Override + public Boolean existPermission(String permission) { + Wrapper queryWrapper = Wrappers.lambdaQuery(SysMenu.class) + .eq(SysMenu::getPermission, permission); + return this.count(queryWrapper) > 0; + } + + protected List doQuery(List moduleIds) { + + return getBaseMapper().query(moduleIds); + } + + protected List doGetByRoleId(String roleId, List moduleIds) { + + return getBaseMapper().getByRoleId(roleId, moduleIds); + } + + protected SysMenu doGetById(@NonNull String id) { + + return getBaseMapper().findById(id); + } + + protected SysMenu doCreate(@NonNull CreateSysMenuVo vo) { + + SysMenu data = new SysMenu(); + + data.setId(IdUtil.getId()); + this.setDataForCreate(vo, data); + + getBaseMapper().insert(data); + + return data; + } + + protected SysMenu doUpdate(@NonNull UpdateSysMenuVo vo) { + + SysMenu data = new SysMenu(); + + data.setId(vo.getId()); + + this.setDataForCreate(vo, data); + + data.setAvailable(vo.getAvailable()); + + SysMenuService thisService = getThis(this.getClass()); + + SysMenu record = thisService.findById(vo.getId()); + + data.setIsSpecial(record.getIsSpecial()); + + getBaseMapper().deleteById(vo.getId()); + + getBaseMapper().insert(data); + + return data; + } + + protected void doDeleteById(@NonNull String id) { + + getBaseMapper().deleteById(id); + } + + protected List doSelector(SysMenuSelectorVo vo, List moduleIds) { + + return getBaseMapper().selector(vo, moduleIds); + } + + protected void doBatchEnable(@NonNull List ids, @NonNull String userId) { + + Wrapper wrapper = Wrappers.lambdaUpdate(SysMenu.class) + .set(SysMenu::getAvailable, Boolean.TRUE).in(SysMenu::getId, ids); + getBaseMapper().update(new SysMenu(), wrapper); + } + + protected void doBatchUnable(@NonNull List ids, @NonNull String userId) { + + Wrapper wrapper = Wrappers.lambdaUpdate(SysMenu.class) + .set(SysMenu::getAvailable, Boolean.FALSE).in(SysMenu::getId, ids); + getBaseMapper().update(new SysMenu(), wrapper); + } + + protected void setDataForCreate(@NonNull CreateSysMenuVo vo, @NonNull SysMenu data) { + + SysMenuDisplay sysMenuDisplay = EnumUtil.getByCode(SysMenuDisplay.class, vo.getDisplay()); + + SysMenu parentMenu = null; + if (!StringUtil.isBlank(vo.getParentId())) { + parentMenu = this.findById(vo.getParentId()); + if (parentMenu == null) { + throw new DefaultClientException("父级菜单不存在!"); + } + if (parentMenu.getId().equals(data.getId())) { + throw new DefaultClientException("父级菜单不能是当前菜单!"); + } + } + data.setCode(vo.getCode()); + data.setTitle(vo.getTitle()); + // fix 这里需要用null代替空字符串 + data.setParentId(parentMenu == null ? null: parentMenu.getId()); + data.setDisplay(sysMenuDisplay); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + if (sysMenuDisplay == SysMenuDisplay.CATALOG || sysMenuDisplay == SysMenuDisplay.FUNCTION) { + if (parentMenu != null) { + //父级菜单必须是目录 + if (parentMenu.getDisplay() != SysMenuDisplay.CATALOG) { + throw new DefaultClientException( + "父级菜单类型必须是【" + SysMenuDisplay.CATALOG.getDesc() + "】!"); + } + } + + data.setName(vo.getName()); + data.setIcon(vo.getIcon()); + data.setPath(vo.getPath()); + data.setHidden(vo.getHidden()); + + if (sysMenuDisplay == SysMenuDisplay.FUNCTION) { + // 功能必须有parentId + if (parentMenu == null) { + throw new DefaultClientException( + "此菜单类型是【" + SysMenuDisplay.FUNCTION.getDesc() + "】,父级菜单不能为空!"); + } + data.setComponent(vo.getComponent()); + data.setComponentType( + EnumUtil.getByCode(SysMenuComponentType.class, vo.getComponentType())); + data.setNoCache(vo.getNoCache()); + + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(vo.getPermission())) { + throw new DefaultClientException( + "权限【" + SecurityConstants.PERMISSION_ADMIN_NAME + "】为内置权限,请修改!"); + } + + data.setPermission(vo.getPermission()); + } + } else if (sysMenuDisplay == SysMenuDisplay.PERMISSION) { + + if (parentMenu != null) { + //父级菜单必须是目录 + if (parentMenu.getDisplay() != SysMenuDisplay.FUNCTION) { + throw new DefaultClientException( + "父级菜单类型必须是【" + SysMenuDisplay.FUNCTION.getDesc() + "】!"); + } + } else { + throw new DefaultClientException( + "此菜单类型是【" + SysMenuDisplay.PERMISSION.getDesc() + "】,父级菜单不能为空!"); + } + + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(vo.getPermission())) { + throw new DefaultClientException( + "权限【" + SecurityConstants.PERMISSION_ADMIN_NAME + "】为内置权限,请修改!"); + } + + data.setPermission(vo.getPermission()); + } + } + + protected List doGetChildrenById(String id) { + + return getBaseMapper().getChildrenById(id); + } + + @Override + public List getMenuByUserId(String userId, boolean isAdmin, List moduleIds) { + + List menus = this.doGetMenus(userId, isAdmin, moduleIds); + + List collectionMenuIds = this.doGetCollectMenuIds(userId); + + if (!CollectionUtil.isEmpty(menus)) { + // 用env渲染${xxx}属性 + menus.forEach(menu -> { + menu.setPath(ApplicationUtil.resolvePlaceholders(menu.getPath())); + }); + + // 渲染spel表达式 + Map vars = getDefaultVars(); + menus.stream().filter(menu -> this.hasSpecExpression(menu.getPath())).forEach(menu -> { + List expressions = this.getAllExpressions(menu.getPath()); + if (!CollectionUtil.isEmpty(expressions)) { + String oriPath = menu.getPath(); + for (String expression : expressions) { + Object parsed = SpelUtil.parse(expression.replaceAll("\\{", "").replaceAll("}", ""), + vars); + oriPath = oriPath.replace(expression, parsed == null ? "" : String.valueOf(parsed)); + } + + menu.setPath(oriPath); + } + }); + + if (!CollectionUtil.isEmpty(collectionMenuIds)) { + menus.forEach(menu -> { + menu.setIsCollect(collectionMenuIds.contains(menu.getId())); + }); + } + } + + return menus; + } + + @Override + public Set getPermissionsByUserId(String userId, boolean isAdmin, List moduleIds) { + + return getBaseMapper().getPermissionsByUserId(userId, isAdmin, moduleIds); + } + + @Override + public Set getRolePermissionByUserId(String userId) { + return getBaseMapper().getRolePermissionByUserId(userId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void collect(String userId, String menuId) { + + if (StringUtil.isBlank(userId) || StringUtil.isBlank(menuId)) { + return; + } + + this.cancelCollect(userId, menuId); + + getBaseMapper().collectMenu(IdUtil.getId(), userId, menuId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void cancelCollect(String userId, String menuId) { + + if (StringUtil.isBlank(userId) || StringUtil.isBlank(menuId)) { + return; + } + + getBaseMapper().cancelCollectMenu(userId, menuId); + } + + private List getAllExpressions(String s) { + + if (!this.hasSpecExpression(s)) { + return null; + } + + List results = new ArrayList<>(); + String[] arr = s.split("#\\{"); + for (int i = 1; i < arr.length; i++) { + if (!arr[i].contains("}")) { + continue; + } + results.add("#{" + arr[i].substring(0, arr[i].indexOf("}")) + "}"); + } + + return results; + } + + private boolean hasSpecExpression(String s) { + + return RegUtil.isMatch(Pattern.compile("^.*#\\{.*}.*$"), s); + } + + protected Map getDefaultVars() { + + Map vars = new HashMap<>(); + + vars.put("_token", userTokenResolver.getToken()); + vars.put("_fullToken", userTokenResolver.getFullToken()); + vars.put("_tokenKey", tokenKey); + + return vars; + } + + protected List doGetMenus(String userId, boolean isAdmin, List moduleIds) { + + return getBaseMapper().getMenuByUserId(userId, isAdmin, moduleIds); + } + + protected List doGetCollectMenuIds(String userId) { + + return getBaseMapper().getCollectMenuIds(userId); + } + + @CacheEvict(value = SysMenu.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysNoticeLogServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysNoticeLogServiceImpl.java new file mode 100644 index 0000000..1d66064 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysNoticeLogServiceImpl.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.xingyun.template.inner.mappers.system.SysNoticeLogMapper; +import com.lframework.xingyun.template.inner.entity.SysNoticeLog; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.inner.service.system.SysNoticeLogService; +import java.time.LocalDateTime; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysNoticeLogServiceImpl extends + BaseMpServiceImpl implements SysNoticeLogService { + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean setReaded(String noticeId, String userId) { + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysNoticeLog.class) + .eq(SysNoticeLog::getNoticeId, noticeId).eq(SysNoticeLog::getUserId, userId) + .eq(SysNoticeLog::getReaded, Boolean.FALSE).set(SysNoticeLog::getReaded, Boolean.TRUE) + .set(SysNoticeLog::getReadTime, + LocalDateTime.now()); + + return this.update(updateWrapper); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysNoticeServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysNoticeServiceImpl.java new file mode 100644 index 0000000..6c1f966 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysNoticeServiceImpl.java @@ -0,0 +1,259 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.ThreadUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.common.threads.DefaultRunnable; +import com.lframework.starter.web.dto.WsPushData; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.starter.websocket.components.WsDataPusher; +import com.lframework.starter.websocket.events.UserConnectEvent; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.inner.dto.system.notice.QuerySysNoticeByUserDto; +import com.lframework.xingyun.template.inner.dto.system.notice.SysNoticeDto; +import com.lframework.xingyun.template.inner.entity.SysNotice; +import com.lframework.xingyun.template.inner.entity.SysNoticeLog; +import com.lframework.xingyun.template.inner.vo.system.notice.CreateSysNoticeVo; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeByUserVo; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeVo; +import com.lframework.xingyun.template.inner.vo.system.notice.UpdateSysNoticeVo; +import com.lframework.xingyun.template.inner.mappers.system.SysNoticeMapper; +import com.lframework.xingyun.template.inner.service.system.SysNoticeLogService; +import com.lframework.xingyun.template.inner.service.system.SysNoticeService; +import com.lframework.xingyun.template.inner.service.system.SysUserService; +import com.lframework.xingyun.template.inner.vo.system.user.QuerySysUserVo; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysNoticeServiceImpl extends BaseMpServiceImpl implements + SysNoticeService { + + @Autowired + private SysUserService sysUserService; + + @Autowired + private SysNoticeLogService sysNoticeLogService; + + @Autowired + private WsDataPusher wsDataPusher; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, QuerySysNoticeVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySysNoticeVo vo) { + + return getBaseMapper().query(vo); + } + + @Override + public PageResult queryByUser(Integer pageIndex, Integer pageSize, + QuerySysNoticeByUserVo vo) { + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = getBaseMapper().queryByUser(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SysNotice.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysNoticeDto getContent(String id) { + SysNotice record = getBaseMapper().selectById(id); + if (record == null) { + return null; + } + + return new SysNoticeDto(record); + } + + @Override + public SysNotice findById(String id) { + + return getBaseMapper().selectById(id); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "新增系统通知,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysNoticeVo vo) { + + SysNotice data = new SysNotice(); + data.setId(IdUtil.getId()); + data.setTitle(vo.getTitle()); + data.setContent(vo.getContent()); + data.setPublished(vo.getPublished()); + + getBaseMapper().insert(data); + + if (vo.getPublished()) { + ThreadUtil.execAsync(new DefaultRunnable(() -> { + SysNoticeService thisService = getThis(getClass()); + thisService.publish(data.getId()); + })); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "修改系统通知,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysNoticeVo vo) { + + SysNotice data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("系统通知不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SysNotice.class) + .set(SysNotice::getTitle, vo.getTitle()).set(SysNotice::getContent, vo.getContent()) + .set(SysNotice::getAvailable, vo.getAvailable()) + .set(SysNotice::getPublished, vo.getPublished()).set(SysNotice::getPublishTime, null) + .set(SysNotice::getReadedNum, 0).set(SysNotice::getUnReadNum, 0) + .eq(SysNotice::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + // 无论发布还是不发布 都要删除 + Wrapper deleteLogWrapper = Wrappers.lambdaQuery(SysNoticeLog.class) + .eq(SysNoticeLog::getNoticeId, data.getId()); + sysNoticeLogService.remove(deleteLogWrapper); + + if (vo.getPublished()) { + ThreadUtil.execAsync(new DefaultRunnable(() -> { + SysNoticeService thisService = getThis(getClass()); + thisService.publish(data.getId()); + })); + } + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "发布系统通知,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void publish(String id) { + + // 查询所有用户 + QuerySysUserVo querySysUserVo = new QuerySysUserVo(); + querySysUserVo.setAvailable(true); + List users = sysUserService.query(querySysUserVo); + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysNotice.class) + .eq(SysNotice::getId, id).set(SysNotice::getReadedNum, 0) + .set(SysNotice::getUnReadNum, users.size()).set(SysNotice::getPublished, Boolean.TRUE) + .set(SysNotice::getPublishTime, LocalDateTime.now()); + this.update(updateWrapper); + + Wrapper deleteLogWrapper = Wrappers.lambdaQuery(SysNoticeLog.class) + .eq(SysNoticeLog::getNoticeId, id); + sysNoticeLogService.remove(deleteLogWrapper); + + if (!CollectionUtil.isEmpty(users)) { + List logs = users.stream().map(t -> { + SysNoticeLog log = new SysNoticeLog(); + log.setId(IdUtil.getId()); + log.setNoticeId(id); + log.setUserId(t.getId()); + log.setReaded(Boolean.FALSE); + + return log; + }).collect(Collectors.toList()); + + sysNoticeLogService.saveBatch(logs); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void setReaded(String id, String userId) { + if (sysNoticeLogService.setReaded(id, userId)) { + getBaseMapper().setReaded(id); + } + } + + @Override + public void noticeForWs() { + WsPushData pushData = new WsPushData(); + pushData.setBizType("sysNotice"); + pushData.setAll(Boolean.TRUE); + + wsDataPusher.push(pushData); + } + + @Override + public void noticeForWs(String userId) { + WsPushData pushData = new WsPushData(); + pushData.setBizType("sysNotice"); + pushData.setIncludeUserId(userId); + + wsDataPusher.push(pushData); + } + + @Override + public void noticeForWsWithSessionId(String sessionId) { + WsPushData pushData = new WsPushData(); + pushData.setBizType("sysNotice"); + pushData.setIncludeSessionIds(Collections.singletonList(sessionId)); + + wsDataPusher.push(pushData); + } + + @CacheEvict(value = SysNotice.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } + + @Component + public static class ReloadNoticeListener implements ApplicationListener { + + @Autowired + private SysNoticeService sysNoticeService; + + @Override + public void onApplicationEvent(UserConnectEvent event) { + sysNoticeService.noticeForWsWithSessionId(event.getSessionId()); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysOpenDomainServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysOpenDomainServiceImpl.java new file mode 100644 index 0000000..0dd1c27 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysOpenDomainServiceImpl.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.xingyun.template.inner.mappers.system.SysOpenDomainMapper; +import com.lframework.xingyun.template.inner.service.system.SysOpenDomainService; +import com.lframework.xingyun.template.inner.vo.system.open.CreateSysOpenDomainVo; +import com.lframework.xingyun.template.inner.vo.system.open.QuerySysOpenDomainVo; +import com.lframework.xingyun.template.inner.vo.system.open.SysOpenDomainSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.open.UpdateSysOpenDomainSecretVo; +import com.lframework.xingyun.template.inner.vo.system.open.UpdateSysOpenDomainVo; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@DS("master") +@Service +public class SysOpenDomainServiceImpl extends + BaseMpServiceImpl + implements SysOpenDomainService { + + @Override + public PageResult query(QuerySysOpenDomainVo vo) { + PageHelperUtil.startPage(vo); + List datas = getBaseMapper().query(vo); + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public PageResult selector(SysOpenDomainSelectorVo vo) { + PageHelperUtil.startPage(vo); + List datas = getBaseMapper().selector(vo); + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SysOpenDomain.CACHE_NAME, key = "#id", unless = "#result == null") + @Override + public SysOpenDomain findById(Integer id) { + return this.getById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysOpenDomainVo vo) { + SysOpenDomain data = new SysOpenDomain(); + data.setName(vo.getName()); + data.setApiSecret(vo.getApiSecret()); + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + if (vo.getTenantId() != null) { + data.setTenantId(vo.getTenantId()); + } + + this.save(data); + + return data.getId(); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysOpenDomainVo vo) { + + SysOpenDomain record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("开放域不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SysOpenDomain.class) + .set(SysOpenDomain::getName, vo.getName()) + .set(SysOpenDomain::getAvailable, vo.getAvailable()) + .set(SysOpenDomain::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .set(SysOpenDomain::getTenantId, vo.getTenantId() == null ? null : vo.getTenantId()) + .eq(SysOpenDomain::getId, vo.getId()); + + this.update(updateWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateApiSecret(UpdateSysOpenDomainSecretVo vo) { + SysOpenDomain record = this.getById(vo.getId()); + if (record == null) { + throw new DefaultClientException("开放域不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SysOpenDomain.class) + .set(SysOpenDomain::getApiSecret, vo.getApiSecret()) + .eq(SysOpenDomain::getId, vo.getId()); + + this.update(updateWrapper); + } + + @CacheEvict(value = SysOpenDomain.CACHE_NAME, key = "#key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysParameterServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysParameterServiceImpl.java new file mode 100644 index 0000000..e279c06 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysParameterServiceImpl.java @@ -0,0 +1,197 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.exceptions.impl.ParameterNotFoundException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.inner.entity.SysParameter; +import com.lframework.xingyun.template.inner.vo.system.parameter.CreateSysParameterVo; +import com.lframework.xingyun.template.inner.vo.system.parameter.QuerySysParameterVo; +import com.lframework.xingyun.template.inner.vo.system.parameter.UpdateSysParameterVo; +import com.lframework.xingyun.template.inner.mappers.system.SysParameterMapper; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.inner.service.system.SysParameterService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysParameterServiceImpl extends + BaseMpServiceImpl implements SysParameterService, + com.lframework.starter.web.service.SysParameterService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySysParameterVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySysParameterVo vo) { + + return getBaseMapper().query(vo); + } + + @Cacheable(value = SysParameter.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysParameter findById(Long id) { + + return getBaseMapper().selectById(id); + } + + @Cacheable(value = SysParameter.CACHE_NAME, key = "@cacheVariables.tenantId() + #key", unless = "#result == null") + @Override + public String findByKey(String key) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(SysParameter.class) + .eq(SysParameter::getPmKey, key); + SysParameter data = getBaseMapper().selectOne(queryWrapper); + + return data == null ? null : data.getPmValue(); + } + + @Override + public String findRequiredByKey(String key) throws ParameterNotFoundException { + com.lframework.starter.web.service.SysParameterService thisService = getThis(this.getClass()); + String data = thisService.findByKey(key); + if (data == null) { + throw new ParameterNotFoundException(); + } + + return data; + } + + @Override + public String findByKey(String key, String defaultValue) { + com.lframework.starter.web.service.SysParameterService thisService = getThis(this.getClass()); + String data = thisService.findByKey(key); + if (data == null) { + return defaultValue; + } + + return data; + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "新增系统参数,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public Long create(CreateSysParameterVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysParameter.class) + .eq(SysParameter::getPmKey, vo.getPmKey()); + if (this.count(checkWrapper) > 0) { + throw new DefaultClientException("键重复,请重新输入!"); + } + SysParameter data = new SysParameter(); + data.setPmKey(vo.getPmKey()); + if (!StringUtil.isEmpty(vo.getPmValue())) { + data.setPmValue(vo.getPmValue()); + } + if (!StringUtil.isBlank(vo.getDescription())) { + data.setDescription(vo.getDescription()); + } + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("id", String.valueOf(data.getId())); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "修改系统参数,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysParameterVo vo) { + + SysParameter data = getBaseMapper().selectById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("系统参数不存在!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SysParameter.class) + .set(SysParameter::getPmValue, StringUtil.isBlank(vo.getPmValue()) ? null : vo.getPmValue()) + .set(SysParameter::getDescription, + StringUtil.isBlank(vo.getDescription()) ? null : vo.getDescription()) + .eq(SysParameter::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("id", String.valueOf(data.getId())); + OpLogUtil.setExtra(vo); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "删除系统参数,ID:{}", params = {"#id"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(Long id) { + + getBaseMapper().deleteById(id); + } + + @Override + public Boolean getBoolean(String key) { + com.lframework.starter.web.service.SysParameterService thisService = getThis(getClass()); + String value = thisService.findByKey(key); + return value == null ? null : "true".equalsIgnoreCase(value); + } + + @Override + public Boolean getBoolean(String key, Boolean defaultValue) { + Boolean value = getBoolean(key); + if (value == null) { + return defaultValue; + } + + return value; + } + + @Override + public Integer getInteger(String key) { + com.lframework.starter.web.service.SysParameterService thisService = getThis(getClass()); + String value = thisService.findByKey(key); + try { + return value == null ? null : Integer.valueOf(value); + } catch (NumberFormatException e) { + // 转换失败 + return null; + } + } + + @Override + public Integer getInteger(String key, Integer defaultValue) { + Integer value = getInteger(key); + if (value == null) { + return defaultValue; + } + + return value; + } + + @CacheEvict(value = SysParameter.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysPositionServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysPositionServiceImpl.java new file mode 100644 index 0000000..5927619 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysPositionServiceImpl.java @@ -0,0 +1,219 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.xingyun.template.inner.vo.system.position.CreateSysPositionVo; +import com.lframework.xingyun.template.inner.vo.system.position.QuerySysPositionVo; +import com.lframework.xingyun.template.inner.vo.system.position.SysPositionSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.position.UpdateSysPositionVo; +import com.lframework.xingyun.template.inner.mappers.system.SysPositionMapper; +import com.lframework.xingyun.template.inner.service.system.SysPositionService; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysPositionServiceImpl extends + BaseMpServiceImpl implements SysPositionService { + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySysPositionVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.doQuery(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Cacheable(value = SysPosition.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysPosition findById(String id) { + + return this.doGetById(id); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SysPositionSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.doSelector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "停用岗位,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + this.doBatchUnable(ids); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "启用岗位,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + this.doBatchEnable(ids); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "新增岗位,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysPositionVo vo) { + + SysPosition data = this.doCreate(vo); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "修改岗位,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysPositionVo vo) { + + this.doUpdate(vo); + + OpLogUtil.setVariable("id", vo.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + protected List doQuery(QuerySysPositionVo vo) { + + return getBaseMapper().query(vo); + } + + protected SysPosition doGetById(String id) { + + return getBaseMapper().findById(id); + } + + protected List doSelector(SysPositionSelectorVo vo) { + + return getBaseMapper().selector(vo); + } + + protected void doBatchUnable(Collection ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysPosition.class) + .set(SysPosition::getAvailable, Boolean.FALSE).in(SysPosition::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected void doBatchEnable(Collection ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysPosition.class) + .set(SysPosition::getAvailable, Boolean.TRUE).in(SysPosition::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected SysPosition doCreate(CreateSysPositionVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysPosition.class) + .eq(SysPosition::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysPosition.class) + .eq(SysPosition::getName, vo.getName()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysPosition data = new SysPosition(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + return data; + } + + protected void doUpdate(UpdateSysPositionVo vo) { + + SysPosition data = this.findById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("岗位不存在!"); + } + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysPosition.class) + .eq(SysPosition::getCode, vo.getCode()).ne(SysPosition::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysPosition.class) + .eq(SysPosition::getName, vo.getName()) + .ne(SysPosition::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate( + SysPosition.class) + .set(SysPosition::getCode, vo.getCode()) + .set(SysPosition::getName, vo.getName()) + .set(SysPosition::getAvailable, vo.getAvailable()) + .set(SysPosition::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(SysPosition::getId, vo.getId()); + + getBaseMapper().update(updateWrapper); + } + + @CacheEvict(value = SysPosition.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysRoleMenuServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysRoleMenuServiceImpl.java new file mode 100644 index 0000000..610e0c5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysRoleMenuServiceImpl.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.common.security.SecurityConstants; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.inner.entity.SysRoleMenu; +import com.lframework.xingyun.template.inner.mappers.system.SysRoleMenuMapper; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.inner.service.system.SysRoleMenuService; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.xingyun.template.inner.vo.system.role.SysRoleMenuSettingVo; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysRoleMenuServiceImpl extends + BaseMpServiceImpl implements SysRoleMenuService { + + @Autowired + private SysRoleService sysRoleService; + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "角色授权菜单,角色ID:{},菜单ID:{}", params = {"#vo.roleIds", + "#vo.menuIds"}, loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void setting(SysRoleMenuSettingVo vo) { + + for (String roleId : vo.getRoleIds()) { + SysRole role = sysRoleService.findById(roleId); + if (ObjectUtil.isNull(role)) { + throw new DefaultClientException("角色不存在!"); + } + + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(role.getPermission())) { + throw new DefaultClientException( + "角色【" + role.getName() + "】的权限为【" + SecurityConstants.PERMISSION_ADMIN_NAME + + "】,不允许授权!"); + } + + this.doSetting(roleId, vo.getMenuIds()); + } + } + + protected void doSetting(String roleId, List menuIds) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(SysRoleMenu.class) + .eq(SysRoleMenu::getRoleId, roleId); + getBaseMapper().delete(deleteWrapper); + + List records = new ArrayList<>(); + if (!CollectionUtil.isEmpty(menuIds)) { + Set menuIdSet = new HashSet<>(menuIds); + + for (String menuId : menuIdSet) { + SysRoleMenu record = new SysRoleMenu(); + record.setId(IdUtil.getId()); + record.setRoleId(roleId); + record.setMenuId(menuId); + + records.add(record); + } + } + + if (CollectionUtil.isNotEmpty(records)) { + this.saveBatch(records); + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysRoleServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysRoleServiceImpl.java new file mode 100644 index 0000000..c0241ee --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysRoleServiceImpl.java @@ -0,0 +1,299 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.common.security.SecurityConstants; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.inner.service.system.SysMenuService; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.xingyun.template.inner.mappers.system.SysRoleMapper; +import com.lframework.xingyun.template.inner.vo.system.role.CreateSysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.role.QuerySysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.role.SysRoleSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.role.UpdateSysRoleVo; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysRoleServiceImpl extends BaseMpServiceImpl implements + SysRoleService { + + @Autowired + private SysMenuService sysMenuService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySysRoleVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySysRoleVo vo) { + + return this.doQuery(vo); + } + + @Cacheable(value = SysRole.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysRole findById(String id) { + + return this.doGetById(id); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SysRoleSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List datas = this.doSelector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "停用角色,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + for (String id : ids) { + SysRole role = this.findById(id); + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(role.getPermission())) { + throw new DefaultClientException( + "角色【" + role.getName() + "】的权限为【" + SecurityConstants.PERMISSION_ADMIN_NAME + + "】,不允许停用!"); + } + } + + this.doBatchUnable(ids); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "启用角色,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(Collection ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + for (String id : ids) { + SysRole role = this.findById(id); + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(role.getPermission())) { + throw new DefaultClientException( + "角色【" + role.getName() + "】的权限为【" + SecurityConstants.PERMISSION_ADMIN_NAME + + "】,不允许启用!"); + } + } + + this.doBatchEnable(ids); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "新增角色,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysRoleVo vo) { + + if (!StringUtil.isBlank(vo.getPermission())) { + + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(vo.getPermission())) { + throw new DefaultClientException( + "权限【" + SecurityConstants.PERMISSION_ADMIN_NAME + "】为内置权限,请修改!"); + } + + // 这里的权限不能与菜单权限重复 + if (sysMenuService.existPermission(vo.getPermission())) { + throw new DefaultClientException( + "权限【" + vo.getPermission() + "】为菜单权限,请修改!"); + } + } + + SysRole data = this.doCreate(vo); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return data.getId(); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "修改角色,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysRoleVo vo) { + + SysRole data = this.findById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("角色不存在!"); + } + + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(data.getPermission())) { + throw new DefaultClientException("角色【" + data.getName() + "】为内置角色,不允许修改!"); + } + + if (!StringUtil.isBlank(vo.getPermission())) { + + if (SecurityConstants.PERMISSION_ADMIN_NAME.equals(vo.getPermission())) { + throw new DefaultClientException( + "权限【" + SecurityConstants.PERMISSION_ADMIN_NAME + "】为内置权限,请修改!"); + } + + // 这里的权限不能与菜单权限重复 + if (sysMenuService.existPermission(vo.getPermission())) { + throw new DefaultClientException( + "权限【" + vo.getPermission() + "】为菜单权限,请修改!"); + } + } + + this.doUpdate(vo); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public List getByUserId(String userId) { + + return this.doGetByUserId(userId); + } + + protected List doQuery(QuerySysRoleVo vo) { + + return getBaseMapper().query(vo); + } + + protected SysRole doGetById(String id) { + + return getBaseMapper().findById(id); + } + + protected List doSelector(SysRoleSelectorVo vo) { + + return getBaseMapper().selector(vo); + } + + protected void doBatchUnable(Collection ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysRole.class) + .set(SysRole::getAvailable, Boolean.FALSE).in(SysRole::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected void doBatchEnable(Collection ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysRole.class) + .set(SysRole::getAvailable, Boolean.TRUE).in(SysRole::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected SysRole doCreate(CreateSysRoleVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysRole.class) + .eq(SysRole::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysRole.class) + .eq(SysRole::getName, vo.getName()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + SysRole data = new SysRole(); + data.setId(IdUtil.getId()); + data.setCode(vo.getCode()); + data.setName(vo.getName()); + + if (!StringUtil.isBlank(vo.getPermission())) { + + data.setPermission(vo.getPermission()); + } + + data.setAvailable(Boolean.TRUE); + data.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(data); + + return data; + } + + protected void doUpdate(UpdateSysRoleVo vo) { + + Wrapper checkWrapper = Wrappers.lambdaQuery(SysRole.class) + .eq(SysRole::getCode, vo.getCode()).ne(SysRole::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + checkWrapper = Wrappers.lambdaQuery(SysRole.class) + .eq(SysRole::getName, vo.getName()) + .ne(SysRole::getId, vo.getId()); + if (getBaseMapper().selectCount(checkWrapper) > 0) { + throw new DefaultClientException("名称重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SysRole.class) + .set(SysRole::getCode, vo.getCode()).set(SysRole::getName, vo.getName()) + .set(SysRole::getPermission, null) + .set(SysRole::getAvailable, vo.getAvailable()) + .set(SysRole::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()) + .eq(SysRole::getId, vo.getId()); + + if (!StringUtil.isBlank(vo.getPermission())) { + + updateWrapper.set(SysRole::getPermission, vo.getPermission()); + } + + getBaseMapper().update(updateWrapper); + } + + protected List doGetByUserId(String userId) { + + return getBaseMapper().getByUserId(userId); + } + + @CacheEvict(value = SysRole.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserDeptServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserDeptServiceImpl.java new file mode 100644 index 0000000..ba2589d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserDeptServiceImpl.java @@ -0,0 +1,83 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.inner.vo.system.dept.SysUserDeptSettingVo; +import com.lframework.xingyun.template.inner.mappers.system.SysUserDeptMapper; +import com.lframework.xingyun.template.inner.entity.SysUserDept; +import com.lframework.xingyun.template.inner.service.system.SysUserDeptService; +import java.io.Serializable; +import java.util.List; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysUserDeptServiceImpl extends + BaseMpServiceImpl implements SysUserDeptService { + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "用户设置部门,用户ID:{},部门ID:{}", params = {"#vo.userId", + "#vo.positionId"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void setting(SysUserDeptSettingVo vo) { + + this.doSetting(vo); + + SysUserDeptService thisService = getThis(this.getClass()); + thisService.cleanCacheByKey(vo.getUserId()); + } + + @Cacheable(value = SysUserDept.CACHE_NAME, key = "@cacheVariables.tenantId() + #userId") + @Override + public List getByUserId(String userId) { + + return doGetByUserId(userId); + } + + @Override + public Boolean hasByDeptId(String deptId) { + + return doHasByDeptId(deptId); + } + + protected void doSetting(SysUserDeptSettingVo vo) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(SysUserDept.class) + .eq(SysUserDept::getUserId, vo.getUserId()); + getBaseMapper().delete(deleteWrapper); + + if (!CollectionUtil.isEmpty(vo.getDeptIds())) { + for (String deptId : vo.getDeptIds()) { + SysUserDept record = new SysUserDept(); + record.setId(IdUtil.getId()); + record.setUserId(vo.getUserId()); + record.setDeptId(deptId); + + getBaseMapper().insert(record); + } + } + } + + protected List doGetByUserId(String userId) { + + return getBaseMapper().getByUserId(userId); + } + + protected Boolean doHasByDeptId(String deptId) { + + return getBaseMapper().hasByDeptId(deptId) != null; + } + + @CacheEvict(value = SysUserDept.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserPositionServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserPositionServiceImpl.java new file mode 100644 index 0000000..5e22c4c --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserPositionServiceImpl.java @@ -0,0 +1,61 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.inner.vo.system.position.SysUserPositionSettingVo; +import com.lframework.xingyun.template.inner.mappers.system.SysUserPositionMapper; +import com.lframework.xingyun.template.inner.entity.SysUserPosition; +import com.lframework.xingyun.template.inner.service.system.SysUserPositionService; +import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysUserPositionServiceImpl + extends BaseMpServiceImpl + implements SysUserPositionService { + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "用户设置岗位,用户ID:{},岗位ID:{}", params = {"#vo.userId", + "#vo.positionIds"}, loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void setting(SysUserPositionSettingVo vo) { + + this.doSetting(vo); + } + + @Override + public List getByUserId(String userId) { + + return doGetByUserId(userId); + } + + protected void doSetting(SysUserPositionSettingVo vo) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery( + SysUserPosition.class) + .eq(SysUserPosition::getUserId, vo.getUserId()); + getBaseMapper().delete(deleteWrapper); + + if (!CollectionUtil.isEmpty(vo.getPositionIds())) { + for (String positionId : vo.getPositionIds()) { + SysUserPosition record = new SysUserPosition(); + record.setId(IdUtil.getId()); + record.setUserId(vo.getUserId()); + record.setPositionId(positionId); + + getBaseMapper().insert(record); + } + } + } + + protected List doGetByUserId(String userId) { + + return getBaseMapper().getByUserId(userId); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserRoleServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserRoleServiceImpl.java new file mode 100644 index 0000000..370b4c2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserRoleServiceImpl.java @@ -0,0 +1,79 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.inner.entity.SysUserRole; +import com.lframework.xingyun.template.inner.mappers.system.SysUserRoleMapper; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.inner.service.system.SysRoleService; +import com.lframework.xingyun.template.inner.service.system.SysUserRoleService; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserRoleSettingVo; +import com.lframework.starter.web.utils.IdUtil; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysUserRoleServiceImpl extends + BaseMpServiceImpl + implements SysUserRoleService { + + @Autowired + private SysRoleService sysRoleService; + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "用户授权角色,用户ID:{},角色ID:{}", params = {"#vo.userIds", + "#vo.roleIds"}, loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void setting(SysUserRoleSettingVo vo) { + + for (String userId : vo.getUserIds()) { + this.doSetting(userId, vo.getRoleIds()); + } + } + + @Override + public List getByUserId(String userId) { + + return doGetByUserId(userId); + } + + protected void doSetting(String userId, List roleIds) { + + Wrapper deleteWrapper = Wrappers.lambdaQuery(SysUserRole.class) + .eq(SysUserRole::getUserId, userId); + getBaseMapper().delete(deleteWrapper); + + if (!CollectionUtil.isEmpty(roleIds)) { + Set roleIdSet = new HashSet<>(roleIds); + + for (String roleId : roleIdSet) { + SysRole role = sysRoleService.findById(roleId); + if (ObjectUtil.isNull(role)) { + throw new DefaultClientException("角色不存在,请检查!"); + } + + SysUserRole record = new SysUserRole(); + record.setId(IdUtil.getId()); + record.setUserId(userId); + record.setRoleId(role.getId()); + + getBaseMapper().insert(record); + } + } + } + + protected List doGetByUserId(String userId) { + + return getBaseMapper().getByUserId(userId); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserServiceImpl.java new file mode 100644 index 0000000..30a537d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserServiceImpl.java @@ -0,0 +1,468 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.exceptions.impl.DefaultClientException; +import com.lframework.starter.common.utils.Assert; +import com.lframework.starter.common.utils.CollectionUtil; +import com.lframework.starter.common.utils.ObjectUtil; +import com.lframework.starter.common.utils.RegUtil; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.utils.PageHelperUtil; +import com.lframework.starter.web.utils.PageResultUtil; +import com.lframework.starter.web.components.code.GenerateCodeType; +import com.lframework.starter.web.components.generator.impl.AbstractFlowGenerator; +import com.lframework.starter.web.components.security.PasswordEncoderWrapper; +import com.lframework.xingyun.template.core.enums.Gender; +import com.lframework.xingyun.template.inner.dto.UserInfoDto; +import com.lframework.starter.web.service.GenerateCodeService; +import com.lframework.starter.web.utils.EnumUtil; +import com.lframework.starter.web.utils.IdUtil; +import com.lframework.xingyun.template.core.annotations.OpLog; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.service.UserService; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.inner.events.UpdateUserEvent; +import com.lframework.xingyun.template.inner.vo.system.dept.SysUserDeptSettingVo; +import com.lframework.xingyun.template.inner.vo.system.position.SysUserPositionSettingVo; +import com.lframework.xingyun.template.inner.mappers.system.SysUserMapper; +import com.lframework.xingyun.template.inner.service.system.SysUserDeptService; +import com.lframework.xingyun.template.inner.service.system.SysUserPositionService; +import com.lframework.xingyun.template.inner.service.system.SysUserRoleService; +import com.lframework.xingyun.template.inner.service.system.SysUserService; +import com.lframework.xingyun.template.inner.vo.system.user.CreateSysUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.QuerySysUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.RegistUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserRoleSettingVo; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.user.UpdateSysUserVo; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import lombok.NonNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SysUserServiceImpl extends BaseMpServiceImpl implements + SysUserService, ApplicationListener { + + @Autowired + private PasswordEncoderWrapper encoderWrapper; + + @Autowired + private SysUserPositionService sysUserPositionService; + + @Autowired + private SysUserDeptService sysUserDeptService; + + @Autowired + private SysUserRoleService sysUserRoleService; + + @Autowired + private GenerateCodeService generateCodeService; + + @Autowired + private UserService userService; + + @Override + public PageResult query(Integer pageIndex, Integer pageSize, + QuerySysUserVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.doQuery(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Override + public List query(QuerySysUserVo vo) { + + return this.doQuery(vo); + } + + @Cacheable(value = SysUser.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null") + @Override + public SysUser findById(String id) { + + return this.doGetById(id); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "启用用户,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchEnable(List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + this.doBatchEnable(ids); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "停用用户,ID:{}", params = "#ids", loopFormat = true) + @Transactional(rollbackFor = Exception.class) + @Override + public void batchUnable(List ids) { + + if (CollectionUtil.isEmpty(ids)) { + return; + } + + this.doBatchUnable(ids); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "新增用户,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public String create(CreateSysUserVo vo) { + + SysUser record = this.doCreate(vo); + + SysUserPositionSettingVo positionSettingVo = new SysUserPositionSettingVo(); + positionSettingVo.setUserId(record.getId()); + positionSettingVo.setPositionIds(vo.getPositionIds()); + sysUserPositionService.setting(positionSettingVo); + + SysUserDeptSettingVo deptSettingVo = new SysUserDeptSettingVo(); + deptSettingVo.setUserId(record.getId()); + deptSettingVo.setDeptIds(vo.getDeptIds()); + sysUserDeptService.setting(deptSettingVo); + + SysUserRoleSettingVo roleSettingVo = new SysUserRoleSettingVo(); + roleSettingVo.setUserIds(Collections.singletonList(record.getId())); + roleSettingVo.setRoleIds(vo.getRoleIds()); + sysUserRoleService.setting(roleSettingVo); + + OpLogUtil.setVariable("id", record.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + + return record.getId(); + } + + @OpLog(type = DefaultOpLogType.SYSTEM, name = "修改用户,ID:{}, 编号:{}", params = {"#id", "#code"}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(UpdateSysUserVo vo) { + + SysUser data = this.findById(vo.getId()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("用户不存在!"); + } + + if (!StringUtil.isBlank(vo.getPassword())) { + if (!RegUtil.isMatch(PatternPool.PATTERN_PASSWORD, vo.getPassword())) { + throw new DefaultClientException("密码长度必须为5-16位,只允许包含大写字母、小写字母、数字、下划线!"); + } + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + if (!RegUtil.isMatch(PatternPool.PATTERN_CN_TEL, vo.getTelephone())) { + throw new DefaultClientException("联系电话格式不正确!"); + } + } + + this.doUpdate(vo); + + SysUserPositionSettingVo positionSettingVo = new SysUserPositionSettingVo(); + positionSettingVo.setUserId(vo.getId()); + positionSettingVo.setPositionIds(vo.getPositionIds()); + + sysUserPositionService.setting(positionSettingVo); + + SysUserDeptSettingVo deptSettingVo = new SysUserDeptSettingVo(); + deptSettingVo.setUserId(vo.getId()); + deptSettingVo.setDeptIds(vo.getDeptIds()); + sysUserDeptService.setting(deptSettingVo); + + SysUserRoleSettingVo roleSettingVo = new SysUserRoleSettingVo(); + roleSettingVo.setUserIds(Collections.singletonList(vo.getId())); + roleSettingVo.setRoleIds(vo.getRoleIds()); + sysUserRoleService.setting(roleSettingVo); + + OpLogUtil.setVariable("id", data.getId()); + OpLogUtil.setVariable("code", vo.getCode()); + OpLogUtil.setExtra(vo); + } + + @Override + public PageResult selector(Integer pageIndex, Integer pageSize, + SysUserSelectorVo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + + List datas = this.doSelector(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void regist(RegistUserVo vo) { + + this.doRegist(vo); + } + + protected List doQuery(QuerySysUserVo vo) { + + return getBaseMapper().query(vo); + } + + protected SysUser doGetById(String id) { + + return getBaseMapper().findById(id); + } + + protected void doBatchEnable(List ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysUser.class) + .set(SysUser::getAvailable, Boolean.TRUE).in(SysUser::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected void doBatchUnable(List ids) { + + Wrapper updateWrapper = Wrappers.lambdaUpdate(SysUser.class) + .set(SysUser::getAvailable, Boolean.FALSE).in(SysUser::getId, ids); + getBaseMapper().update(updateWrapper); + } + + protected SysUser doCreate(CreateSysUserVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(SysUser.class) + .eq(SysUser::getCode, vo.getCode()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkUsernameWrapper = Wrappers.lambdaQuery(SysUser.class) + .eq(SysUser::getUsername, vo.getUsername()); + if (getBaseMapper().selectCount(checkUsernameWrapper) > 0) { + throw new DefaultClientException("用户名重复,请重新输入!"); + } + + SysUser record = new SysUser(); + record.setId(IdUtil.getId()); + record.setCode(vo.getCode()); + record.setName(vo.getName()); + record.setUsername(vo.getUsername()); + record.setPassword(encoderWrapper.getEncoder().encode(vo.getPassword())); + if (!StringUtil.isBlank(vo.getEmail())) { + record.setEmail(vo.getEmail()); + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + record.setTelephone(vo.getTelephone()); + } + + record.setGender(EnumUtil.getByCode(Gender.class, vo.getGender())); + record.setAvailable(Boolean.TRUE); + record.setDescription( + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + getBaseMapper().insert(record); + + return record; + } + + protected void doUpdate(UpdateSysUserVo vo) { + + Wrapper checkCodeWrapper = Wrappers.lambdaQuery(SysUser.class) + .eq(SysUser::getCode, vo.getCode()).ne(SysUser::getId, vo.getId()); + if (getBaseMapper().selectCount(checkCodeWrapper) > 0) { + throw new DefaultClientException("编号重复,请重新输入!"); + } + + Wrapper checkUsernameWrapper = Wrappers.lambdaQuery(SysUser.class) + .eq(SysUser::getUsername, vo.getUsername()).ne(SysUser::getId, vo.getId()); + if (getBaseMapper().selectCount(checkUsernameWrapper) > 0) { + throw new DefaultClientException("用户名重复,请重新输入!"); + } + + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(SysUser.class) + .eq(SysUser::getId, vo.getId()).set(SysUser::getCode, vo.getCode()) + .set(SysUser::getUsername, vo.getUsername()) + .set(SysUser::getName, vo.getName()) + .set(SysUser::getEmail, null).set(SysUser::getTelephone, null) + .set(SysUser::getGender, EnumUtil.getByCode(Gender.class, vo.getGender())) + .set(SysUser::getAvailable, vo.getAvailable()).set(SysUser::getDescription, + StringUtil.isBlank(vo.getDescription()) ? StringPool.EMPTY_STR : vo.getDescription()); + + if (!StringUtil.isBlank(vo.getPassword())) { + updateWrapper.set(SysUser::getPassword, + encoderWrapper.getEncoder().encode(vo.getPassword())); + } + + if (!StringUtil.isBlank(vo.getEmail())) { + updateWrapper.set(SysUser::getEmail, vo.getEmail()); + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + updateWrapper.set(SysUser::getTelephone, vo.getTelephone()); + } + + getBaseMapper().update(updateWrapper); + } + + protected List doSelector(SysUserSelectorVo vo) { + + return getBaseMapper().selector(vo); + } + + protected void doRegist(RegistUserVo vo) { + + Wrapper queryWrapper = Wrappers.lambdaQuery(SysUser.class) + .eq(SysUser::getUsername, vo.getUsername()); + if (getBaseMapper().selectCount(queryWrapper) > 0) { + throw new DefaultClientException("用户名重复,请重新输入!"); + } + + SysUser record = new SysUser(); + record.setId(IdUtil.getId()); + record.setCode(generateCodeService.generate(new UserCodeType())); + record.setName(vo.getName()); + record.setUsername(vo.getUsername()); + record.setPassword(encoderWrapper.getEncoder().encode(vo.getPassword())); + if (!StringUtil.isBlank(vo.getEmail())) { + record.setEmail(vo.getEmail()); + } + + if (!StringUtil.isBlank(vo.getTelephone())) { + record.setTelephone(vo.getTelephone()); + } + + record.setGender(Gender.UNKNOWN); + record.setAvailable(Boolean.TRUE); + record.setDescription(StringPool.EMPTY_STR); + + getBaseMapper().insert(record); + } + + @Cacheable(value = UserInfoDto.CACHE_NAME, key = "@cacheVariables.tenantId() + #userId", unless = "#result == null") + @Override + public UserInfoDto getInfo(@NonNull String userId) { + + return this.doGetInfo(userId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updatePassword(@NonNull String userId, @NonNull String password) { + + this.doUpdatePassword(userId, this.encodePassword(password)); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateEmail(@NonNull String userId, @NonNull String email) { + + this.doUpdateEmail(userId, email); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void updateTelephone(@NonNull String userId, @NonNull String telephone) { + + this.doUpdateTelephone(userId, telephone); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void lockById(String id) { + + getBaseMapper().lockById(id); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void unlockById(String id) { + + getBaseMapper().unlockById(id); + } + + protected UserInfoDto doGetInfo(@NonNull String userId) { + + return getBaseMapper().getInfo(userId); + } + + protected void doUpdatePassword(@NonNull String userId, @NonNull String password) { + + getBaseMapper().updatePassword(userId, password); + } + + protected void doUpdateEmail(@NonNull String userId, @NonNull String email) { + + getBaseMapper().updateEmail(userId, email); + } + + protected void doUpdateTelephone(@NonNull String userId, @NonNull String telephone) { + + getBaseMapper().updateTelephone(userId, telephone); + } + + protected String encodePassword(String password) { + + return encoderWrapper.getEncoder().encode(password); + } + + @CacheEvict(value = {UserInfoDto.CACHE_NAME, + SysUser.CACHE_NAME}, key = "@cacheVariables.tenantId() + #key") + @Override + public void cleanCacheByKey(Serializable key) { + + userService.cleanCacheByKey(key); + } + + @Override + public void onApplicationEvent(UpdateUserEvent event) { + + SysUserService thisService = getThis(this.getClass()); + thisService.cleanCacheByKey(event.getId()); + } + + public static class UserCodeType implements GenerateCodeType { + + } + + @Component + public static class UserCodeGenerator extends AbstractFlowGenerator { + + @Override + public GenerateCodeType getType() { + + return new UserCodeType(); + } + + @Override + protected int getCodeLength() { + + return 5; + } + + @Override + protected String getPreffix() { + + return "R"; + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserTelephoneServiceImpl.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserTelephoneServiceImpl.java new file mode 100644 index 0000000..17156ef --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/impl/system/SysUserTelephoneServiceImpl.java @@ -0,0 +1,14 @@ +package com.lframework.xingyun.template.inner.impl.system; + +import com.lframework.starter.web.impl.BaseMpServiceImpl; +import com.lframework.xingyun.template.inner.mappers.system.SysUserTelephoneMapper; +import com.lframework.xingyun.template.inner.entity.SysUserTelephone; +import com.lframework.xingyun.template.inner.service.system.SysUserTelephoneService; +import org.springframework.stereotype.Service; + +@Service +public class SysUserTelephoneServiceImpl extends + BaseMpServiceImpl implements + SysUserTelephoneService { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/listeners/LoginListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/listeners/LoginListener.java new file mode 100644 index 0000000..ab436dd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/listeners/LoginListener.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.inner.listeners; + +import com.lframework.starter.web.common.security.AbstractUserDetails; +import com.lframework.starter.web.common.security.SecurityUtil; +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.core.vo.CreateOpLogsVo; +import com.lframework.xingyun.template.inner.events.LoginEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class LoginListener implements ApplicationListener { + + @Override + public void onApplicationEvent(LoginEvent loginEvent) { + + AbstractUserDetails currentUser = SecurityUtil.getCurrentUser(); + CreateOpLogsVo vo = new CreateOpLogsVo(); + vo.setName("用户登录"); + vo.setLogType(DefaultOpLogType.AUTH); + vo.setCreateBy(currentUser.getName()); + vo.setCreateById(currentUser.getId()); + vo.setIp(currentUser.getIp()); + + OpLogUtil.addLog(vo); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/listeners/LogoutListener.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/listeners/LogoutListener.java new file mode 100644 index 0000000..91f6065 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/listeners/LogoutListener.java @@ -0,0 +1,25 @@ +package com.lframework.xingyun.template.inner.listeners; + +import com.lframework.xingyun.template.core.enums.DefaultOpLogType; +import com.lframework.xingyun.template.core.utils.OpLogUtil; +import com.lframework.xingyun.template.core.vo.CreateOpLogsVo; +import com.lframework.xingyun.template.inner.events.LogoutEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component +public class LogoutListener implements ApplicationListener { + + @Override + public void onApplicationEvent(LogoutEvent event) { + + CreateOpLogsVo vo = new CreateOpLogsVo(); + vo.setName("退出登录"); + vo.setLogType(DefaultOpLogType.AUTH); + vo.setCreateBy(event.getUser().getName()); + vo.setCreateById(event.getUser().getId()); + vo.setIp(event.getUser().getIp()); + + OpLogUtil.addLog(vo); + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/QrtzMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/QrtzMapper.java new file mode 100644 index 0000000..020f1c1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/QrtzMapper.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.template.inner.mappers; + +import com.lframework.xingyun.template.inner.dto.qrtz.QrtzDto; +import com.lframework.xingyun.template.inner.vo.qrtz.QueryQrtzVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + * @author zmj + * @since 2022/8/20 + */ +public interface QrtzMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QueryQrtzVo vo); + + /** + * 根据ID查询 + * + * @param name + * @param group + * @return + */ + QrtzDto findById(@Param("name") String name, @Param("group") String group); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/SysModuleMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/SysModuleMapper.java new file mode 100644 index 0000000..9262e57 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/SysModuleMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.template.inner.mappers; + +import com.lframework.xingyun.template.inner.entity.SysModule; +import com.lframework.starter.web.mapper.BaseMapper; + +public interface SysModuleMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/SysModuleTenantMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/SysModuleTenantMapper.java new file mode 100644 index 0000000..5a19efe --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/SysModuleTenantMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.template.inner.mappers; + +import com.lframework.xingyun.template.inner.entity.SysModuleTenant; +import com.lframework.starter.web.mapper.BaseMapper; + +public interface SysModuleTenantMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/TenantMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/TenantMapper.java new file mode 100644 index 0000000..6260397 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/TenantMapper.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.inner.mappers; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.tenant.QueryTenantVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.TenantSelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface TenantMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "id", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QueryTenantVo vo); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") TenantSelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/UserDetailsMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/UserDetailsMapper.java new file mode 100644 index 0000000..91f3fa7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/UserDetailsMapper.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.inner.mappers; + +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.starter.web.common.security.DefaultUserDetails; + +/** + * 用于登录的用户信息查询Mapper + * + * @author zmj + */ +public interface UserDetailsMapper extends BaseMapper { + + /** + * 根据登录名查询 + * + * @param username + * @return + */ + DefaultUserDetails findByUsername(String username); + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + String codeByUserId(String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicCategoryMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicCategoryMapper.java new file mode 100644 index 0000000..4bcba41 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicCategoryMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.dic.category.SysDataDicCategorySelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据字典分类 Mapper 接口 + *

+ * + * @author zmj + */ +public interface SysDataDicCategoryMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + List query(); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SysDataDicCategorySelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicItemMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicItemMapper.java new file mode 100644 index 0000000..8104ebd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicItemMapper.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.dic.item.QuerySysDataDicItemVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据字典值 Mapper 接口 + *

+ * + * @author zmj + */ +public interface SysDataDicItemMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QuerySysDataDicItemVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicMapper.java new file mode 100644 index 0000000..e83e7aa --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataDicMapper.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.dic.QuerySysDataDicVo; +import com.lframework.xingyun.template.inner.vo.system.dic.SysDataDicSelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 数据字典 Mapper 接口 + *

+ * + * @author zmj + */ +public interface SysDataDicMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "tb", autoParse = true), + @Sort(value = "name", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QuerySysDataDicVo vo); + + /** + * 选择器 + * + * @return + */ + List selector(@Param("vo") SysDataDicSelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataPermissionDataMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataPermissionDataMapper.java new file mode 100644 index 0000000..aae7a6e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDataPermissionDataMapper.java @@ -0,0 +1,9 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.entity.SysDataPermissionData; +import com.lframework.starter.web.mapper.BaseMapper; + +public interface SysDataPermissionDataMapper extends + BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDeptMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDeptMapper.java new file mode 100644 index 0000000..a1648b4 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysDeptMapper.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; + +/** + *

+ * 部门 Mapper 接口 + *

+ * + * @author zmj + * @since 2021-06-26 + */ +public interface SysDeptMapper extends BaseMapper { + + /** + * 选择器 + * + * @return + */ + List selector(); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysDept findById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysMenuMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysMenuMapper.java new file mode 100644 index 0000000..522e09e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysMenuMapper.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.dto.MenuDto; +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.menu.SysMenuSelectorVo; +import java.util.List; +import java.util.Set; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 系统菜单 Mapper 接口 + *

+ * + * @author zmj + * @since 2021-05-10 + */ +public interface SysMenuMapper extends BaseMapper { + + /** + * 系统菜单列表 + * + * @return + */ + List query(@Param("moduleIds") List moduleIds); + + /** + * 根据角色ID查询已授权的菜单 + * + * @param roleId + * @return + */ + List getByRoleId(@Param("roleId") String roleId, + @Param("moduleIds") List moduleIds); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysMenu findById(String id); + + /** + * 系统菜单选择器数据 + * + * @return + */ + List selector(@Param("vo") SysMenuSelectorVo vo, @Param("moduleIds") List moduleIds); + + /** + * 根据ID查询子节点 + * + * @param id + * @return + */ + List getChildrenById(String id); + + /** + * 根据用户ID查询菜单 + * + * @param userId + * @param isAdmin 是否为管理员 + * @return + */ + List getMenuByUserId(@Param("userId") String userId, @Param("isAdmin") boolean isAdmin, + @Param("moduleIds") List moduleIds); + + /** + * 根据用户ID查询收藏的菜单 + * + * @param userId + * @return + */ + List getCollectMenuIds(@Param("userId") String userId); + + /** + * 根据用户ID查询权限 + * + * @param userId + * @return + */ + Set getPermissionsByUserId(@Param("userId") String userId, + @Param("isAdmin") boolean isAdmin, + @Param("moduleIds") List moduleIds); + + /** + * 根据用户ID查询角色权限 + * + * @param userId + * @return + */ + Set getRolePermissionByUserId(@Param("userId") String userId); + + /** + * 收藏菜单 + * + * @param id + * @param userId + * @param menuId + */ + void collectMenu(@Param("id") String id, @Param("userId") String userId, + @Param("menuId") String menuId); + + /** + * 取消收藏菜单 + * + * @param userId + * @param menuId + */ + void cancelCollectMenu(@Param("userId") String userId, @Param("menuId") String menuId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysNoticeLogMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysNoticeLogMapper.java new file mode 100644 index 0000000..5c3ac7a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysNoticeLogMapper.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysNoticeLog; +import com.lframework.starter.web.mapper.BaseMapper; + +/** + *

+ * 系统通知记录 Mapper 接口 + *

+ * + * @author zmj + */ +public interface SysNoticeLogMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysNoticeMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysNoticeMapper.java new file mode 100644 index 0000000..ea30410 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysNoticeMapper.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysNotice; +import com.lframework.xingyun.template.inner.dto.system.notice.QuerySysNoticeByUserDto; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeByUserVo; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 系统通知 Mapper 接口 + *

+ * + * @author zmj + */ +public interface SysNoticeMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(@Param("vo") QuerySysNoticeVo vo); + + /** + * 设置已读 + * + * @param id + */ + void setReaded(String id); + + /** + * 根据用户查询 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + List queryByUser(@Param("vo") QuerySysNoticeByUserVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysOpenDomainMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysOpenDomainMapper.java new file mode 100644 index 0000000..0db5ea8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysOpenDomainMapper.java @@ -0,0 +1,40 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.open.QuerySysOpenDomainVo; +import com.lframework.xingyun.template.inner.vo.system.open.SysOpenDomainSelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-02 + */ +public interface SysOpenDomainMapper extends BaseMapper { + + /** + * 查询列表 + * + * @return + */ + @Sorts({ + @Sort(value = "id", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "tenantId", autoParse = true), + }) + List query(@Param("vo") QuerySysOpenDomainVo vo); + + /** + * 选择器 + * + * @return + */ + List selector(@Param("vo") SysOpenDomainSelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysParameterMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysParameterMapper.java new file mode 100644 index 0000000..46a2b94 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysParameterMapper.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.entity.SysParameter; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.parameter.QuerySysParameterVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 系统参数 Mapper 接口 + *

+ * + * @author zmj + */ +public interface SysParameterMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "pmKey", alias = "tb", autoParse = true), + @Sort(value = "createTime", alias = "tb", autoParse = true), + }) + List query(@Param("vo") QuerySysParameterVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysPositionMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysPositionMapper.java new file mode 100644 index 0000000..1459e5a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysPositionMapper.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.position.QuerySysPositionVo; +import com.lframework.xingyun.template.inner.vo.system.position.SysPositionSelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 系统岗位 Mapper 接口 + *

+ * + * @author zmj + * @since 2021-06-30 + */ +public interface SysPositionMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QuerySysPositionVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysPosition findById(String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SysPositionSelectorVo vo); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysRoleMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysRoleMapper.java new file mode 100644 index 0000000..844a623 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysRoleMapper.java @@ -0,0 +1,59 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.role.QuerySysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.role.SysRoleSelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-02 + */ +public interface SysRoleMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", autoParse = true), + @Sort(value = "name", autoParse = true), + @Sort(value = "createTime", autoParse = true), + @Sort(value = "updateTime", autoParse = true), + }) + List query(@Param("vo") QuerySysRoleVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysRole findById(String id); + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SysRoleSelectorVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysRoleMenuMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysRoleMenuMapper.java new file mode 100644 index 0000000..e2311c7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysRoleMenuMapper.java @@ -0,0 +1,16 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysRoleMenu; +import com.lframework.starter.web.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-04 + */ +public interface SysRoleMenuMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserDeptMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserDeptMapper.java new file mode 100644 index 0000000..cbe0081 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserDeptMapper.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysUserDept; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-04 + */ +public interface SysUserDeptMapper extends BaseMapper { + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); + + /** + * 根据部门ID查询是否存在 + * + * @param deptId + * @return + */ + SysUserDept hasByDeptId(String deptId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserMapper.java new file mode 100644 index 0000000..05c1ea1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserMapper.java @@ -0,0 +1,99 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.core.annotations.sort.Sort; +import com.lframework.xingyun.template.core.annotations.sort.Sorts; +import com.lframework.xingyun.template.inner.dto.UserInfoDto; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.starter.web.mapper.BaseMapper; +import com.lframework.xingyun.template.inner.vo.system.user.QuerySysUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserSelectorVo; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-04 + */ +public interface SysUserMapper extends BaseMapper { + + /** + * 查询列表 + * + * @param vo + * @return + */ + @Sorts({ + @Sort(value = "code", alias = "u", autoParse = true), + @Sort(value = "username", alias = "u", autoParse = true), + @Sort(value = "name", alias = "u", autoParse = true), + @Sort(value = "createTime", alias = "u", autoParse = true), + @Sort(value = "updateTime", alias = "u", autoParse = true), + }) + List query(@Param("vo") QuerySysUserVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysUser findById(String id); + + /** + * 选择器 + * + * @param vo + * @return + */ + List selector(@Param("vo") SysUserSelectorVo vo); + + /** + * 获取用户信息 + * + * @param userId 用户ID + * @return + */ + UserInfoDto getInfo(String userId); + + /** + * 修改用户密码 + * + * @param userId 用户ID + * @param password 新密码(密文) + */ + void updatePassword(@Param("userId") String userId, @Param("password") String password); + + /** + * 修改邮箱 + * + * @param userId 用户ID + * @param email 邮箱 + */ + void updateEmail(@Param("userId") String userId, @Param("email") String email); + + /** + * 修改联系电话 + * + * @param userId 用户ID + * @param telephone 联系电话 + */ + void updateTelephone(@Param("userId") String userId, @Param("telephone") String telephone); + + /** + * 根据ID锁定 + * + * @param id + */ + void lockById(String id); + + /** + * 根据ID解锁 + * + * @param id + */ + void unlockById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserPositionMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserPositionMapper.java new file mode 100644 index 0000000..0431f3a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserPositionMapper.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysUserPosition; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-04 + */ +public interface SysUserPositionMapper extends BaseMapper { + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserRoleMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserRoleMapper.java new file mode 100644 index 0000000..c4fafa7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserRoleMapper.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysUserRole; +import com.lframework.starter.web.mapper.BaseMapper; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zmj + * @since 2021-07-04 + */ +public interface SysUserRoleMapper extends BaseMapper { + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserTelephoneMapper.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserTelephoneMapper.java new file mode 100644 index 0000000..95144fd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/mappers/system/SysUserTelephoneMapper.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.template.inner.mappers.system; + +import com.lframework.xingyun.template.inner.entity.SysUserTelephone; +import com.lframework.starter.web.mapper.BaseMapper; + +public interface SysUserTelephoneMapper extends BaseMapper { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/QrtzService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/QrtzService.java new file mode 100644 index 0000000..4c015e6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/QrtzService.java @@ -0,0 +1,80 @@ +package com.lframework.xingyun.template.inner.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.xingyun.template.inner.vo.qrtz.CreateQrtzVo; +import com.lframework.xingyun.template.inner.vo.qrtz.UpdateQrtzVo; +import com.lframework.xingyun.template.inner.vo.qrtz.QueryQrtzVo; +import com.lframework.starter.web.service.BaseService; +import com.lframework.xingyun.template.inner.dto.qrtz.QrtzDto; + +/** + * @author zmj + * @since 2022/8/20 + */ +public interface QrtzService extends BaseService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryQrtzVo vo); + + /** + * 根据ID查询 + * + * @param name + * @param group + * @return + */ + QrtzDto findById(String name, String group); + + /** + * 创建 + * + * @param vo + */ + void create(CreateQrtzVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateQrtzVo vo); + + /** + * 恢复 + * + * @param name + * @param group + */ + void resume(String name, String group); + + /** + * 暂停 + * + * @param name + * @param group + */ + void pause(String name, String group); + + /** + * 触发 + * + * @param name + * @param group + */ + void trigger(String name, String group); + + /** + * 删除 + * + * @param name + * @param group + */ + void delete(String name, String group); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/SysModuleService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/SysModuleService.java new file mode 100644 index 0000000..d5a006f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/SysModuleService.java @@ -0,0 +1,7 @@ +package com.lframework.xingyun.template.inner.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.entity.SysModule; + +public interface SysModuleService extends BaseMpService { +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/SysModuleTenantService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/SysModuleTenantService.java new file mode 100644 index 0000000..42c4378 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/SysModuleTenantService.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.template.inner.service; + +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.entity.SysModuleTenant; +import com.lframework.xingyun.template.inner.vo.system.module.SysModuleTenantVo; +import java.util.List; + +public interface SysModuleTenantService extends BaseMpService { + + /** + * 根据租户ID查询可用模块ID + * + * @param tenantId + * @return + */ + List getAvailableModuleIdsByTenantId(Integer tenantId); + + /** + * 根据租户ID查询 + * @param tenantId + * @return + */ + List getByTenantId(Integer tenantId); + + /** + * 设置模块 + * @param vo + */ + void setting(SysModuleTenantVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/TenantService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/TenantService.java new file mode 100644 index 0000000..75f73ae --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/TenantService.java @@ -0,0 +1,60 @@ +package com.lframework.xingyun.template.inner.service; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.entity.Tenant; +import com.lframework.xingyun.template.inner.vo.system.tenant.CreateTenantVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.QueryTenantVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.TenantSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.tenant.UpdateTenantVo; + +/** + * 租户Service + * + * @author zmj + */ +public interface TenantService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QueryTenantVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, TenantSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + Tenant findById(Integer id); + + /** + * 新增 + * + * @param data + * @return + */ + Integer create(CreateTenantVo data); + + /** + * 修改 + * + * @param data + */ + void update(UpdateTenantVo data); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicCategoryService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicCategoryService.java new file mode 100644 index 0000000..9cccf9f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicCategoryService.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysDataDicCategory; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.dic.category.CreateSysDataDicCategoryVo; +import com.lframework.xingyun.template.inner.vo.system.dic.category.SysDataDicCategorySelectorVo; +import com.lframework.xingyun.template.inner.vo.system.dic.category.UpdateSysDataDicCategoryVo; +import java.util.List; + +/** + * 数据字典分类 Service + * + * @author zmj + */ +public interface SysDataDicCategoryService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + List queryList(); + + /** + * 选择器 + * + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + SysDataDicCategorySelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysDataDicCategory findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysDataDicCategoryVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysDataDicCategoryVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicItemService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicItemService.java new file mode 100644 index 0000000..0a1ef70 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicItemService.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysDataDicItem; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.dic.item.CreateSysDataDicItemVo; +import com.lframework.xingyun.template.inner.vo.system.dic.item.QuerySysDataDicItemVo; +import com.lframework.xingyun.template.inner.vo.system.dic.item.UpdateSysDataDicItemVo; +import java.util.List; + +/** + * 数据字典值 Service + * + * @author zmj + */ +public interface SysDataDicItemService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySysDataDicItemVo vo); + + /** + * 查询列表 + * + * @return + */ + List query(QuerySysDataDicItemVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysDataDicItem findById(String id); + + /** + * 根据字典Code、字典值Code查询 + * + * @param dicCode + * @param code + * @return + */ + SysDataDicItem findByCode(String dicCode, String code); + + /** + * 根据字典编号查询 + * + * @param dicCode + * @return + */ + List findByDicCode(String dicCode); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysDataDicItemVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysDataDicItemVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicService.java new file mode 100644 index 0000000..441d59e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataDicService.java @@ -0,0 +1,75 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysDataDic; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.dic.CreateSysDataDicVo; +import com.lframework.xingyun.template.inner.vo.system.dic.QuerySysDataDicVo; +import com.lframework.xingyun.template.inner.vo.system.dic.SysDataDicSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.dic.UpdateSysDataDicVo; +import java.util.List; + +/** + * 数据字典 Service + * + * @author zmj + */ +public interface SysDataDicService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySysDataDicVo vo); + + /** + * 查询列表 + * + * @return + */ + List query(QuerySysDataDicVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SysDataDicSelectorVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysDataDic findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysDataDicVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysDataDicVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataPermissionDataService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataPermissionDataService.java new file mode 100644 index 0000000..a3ce753 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDataPermissionDataService.java @@ -0,0 +1,26 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.core.entity.SysDataPermissionData; +import com.lframework.starter.web.service.BaseMpService; +import java.util.List; + +public interface SysDataPermissionDataService extends + BaseMpService { + + /** + * 根据业务ID查询 + * + * @param bizId + * @return + */ + List getByBizId(String bizId); + + /** + * 根据业务ID查询 + * + * @param bizId + * @param bizType + * @return + */ + SysDataPermissionData getByBizId(String bizId, Integer bizType, Integer permissionType); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDeptService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDeptService.java new file mode 100644 index 0000000..24ed8c2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysDeptService.java @@ -0,0 +1,55 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysDept; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.dept.CreateSysDeptVo; +import com.lframework.xingyun.template.inner.vo.system.dept.UpdateSysDeptVo; +import java.util.Collection; +import java.util.List; + +public interface SysDeptService extends BaseMpService { + + /** + * 选择器 + * + * @return + */ + List selector(); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysDept findById(String id); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysDeptVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysDeptVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysMenuService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysMenuService.java new file mode 100644 index 0000000..92b44f5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysMenuService.java @@ -0,0 +1,136 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.dto.MenuDto; +import com.lframework.xingyun.template.inner.entity.SysMenu; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.menu.CreateSysMenuVo; +import com.lframework.xingyun.template.inner.vo.system.menu.SysMenuSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.menu.UpdateSysMenuVo; +import java.util.List; +import java.util.Set; + +/** + *

+ * 系统菜单 服务类 + *

+ * + * @author zmj + * @since 2021-05-10 + */ +public interface SysMenuService extends BaseMpService { + + /** + * 系统菜单列表 + * + * @return + */ + List queryList(List moduleIds); + + /** + * 根据角色ID查询已授权的菜单 + * + * @param roleId + * @return + */ + List getByRoleId(String roleId, List moduleIds); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysMenu findById(String id); + + /** + * 创建系统菜单 + * + * @param vo + */ + String create(CreateSysMenuVo vo); + + /** + * 修改系统菜单 + * + * @param vo + */ + void update(UpdateSysMenuVo vo); + + /** + * 根据ID删除 + * + * @param id + */ + void deleteById(String id); + + /** + * 系统菜单选择器数据 + * + * @return + */ + List selector(SysMenuSelectorVo vo, List moduleIds); + + /** + * 批量启用 + * + * @param ids + * @param userId + */ + void batchEnable(List ids, String userId); + + /** + * 批量停用 + * + * @param ids + * @param userId + */ + void batchUnable(List ids, String userId); + + /** + * 是否存在权限 + * + * @param permission + * @return + */ + Boolean existPermission(String permission); + + /** + * 根据用户ID查询菜单 + * + * @param userId + * @param isAdmin 是否为管理员 + * @return + */ + List getMenuByUserId(String userId, boolean isAdmin, List moduleIds); + + /** + * 根据用户ID查询权限 + * + * @param userId + * @return + */ + Set getPermissionsByUserId(String userId, boolean isAdmin, List moduleIds); + + /** + * 根据用户ID查询角色权限 + * @param userId + * @return + */ + Set getRolePermissionByUserId(String userId); + + /** + * 收藏菜单 + * + * @param userId + * @param menuId + */ + void collect(String userId, String menuId); + + /** + * 取消收藏菜单 + * + * @param userId + * @param menuId + */ + void cancelCollect(String userId, String menuId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysNoticeLogService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysNoticeLogService.java new file mode 100644 index 0000000..acd1d5a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysNoticeLogService.java @@ -0,0 +1,20 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysNoticeLog; +import com.lframework.starter.web.service.BaseMpService; + +/** + * 系统通知记录 Service + * + * @author zmj + */ +public interface SysNoticeLogService extends BaseMpService { + + /** + * 设置已读 + * + * @param noticeId + * @param userId + */ + boolean setReaded(String noticeId, String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysNoticeService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysNoticeService.java new file mode 100644 index 0000000..550d752 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysNoticeService.java @@ -0,0 +1,108 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.dto.system.notice.QuerySysNoticeByUserDto; +import com.lframework.xingyun.template.inner.dto.system.notice.SysNoticeDto; +import com.lframework.xingyun.template.inner.entity.SysNotice; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.notice.CreateSysNoticeVo; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeByUserVo; +import com.lframework.xingyun.template.inner.vo.system.notice.QuerySysNoticeVo; +import com.lframework.xingyun.template.inner.vo.system.notice.UpdateSysNoticeVo; +import java.util.List; + +/** + * 系统通知 Service + * + * @author zmj + */ +public interface SysNoticeService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySysNoticeVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySysNoticeVo vo); + + /** + * 根据用户查询 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult queryByUser(Integer pageIndex, Integer pageSize, + QuerySysNoticeByUserVo vo); + + /** + * 根据ID查询内容 + * + * @param id + * @return + */ + SysNoticeDto getContent(String id); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysNotice findById(String id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysNoticeVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysNoticeVo vo); + + /** + * 发布 + * + * @param id + */ + void publish(String id); + + /** + * 设置已读 + * + * @param id + * @param userId + */ + void setReaded(String id, String userId); + + /** + * 发送通知 + */ + void noticeForWs(); + + /** + * 发送通知 + */ + void noticeForWs(String userId); + + /** + * 发送通知 + */ + void noticeForWsWithSessionId(String sessionId); + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysOpenDomainService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysOpenDomainService.java new file mode 100644 index 0000000..7843c42 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysOpenDomainService.java @@ -0,0 +1,58 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.xingyun.template.inner.vo.system.open.QuerySysOpenDomainVo; +import com.lframework.xingyun.template.inner.vo.system.open.CreateSysOpenDomainVo; +import com.lframework.xingyun.template.inner.vo.system.open.SysOpenDomainSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.open.UpdateSysOpenDomainSecretVo; +import com.lframework.xingyun.template.inner.vo.system.open.UpdateSysOpenDomainVo; + +public interface SysOpenDomainService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(QuerySysOpenDomainVo vo); + + /** + * 选择器 + * + * @return + */ + PageResult selector(SysOpenDomainSelectorVo vo); + + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysOpenDomain findById(Integer id); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysOpenDomainVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysOpenDomainVo vo); + + /** + * 修改Api密钥 + * + * @param vo + */ + void updateApiSecret(UpdateSysOpenDomainSecretVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysParameterService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysParameterService.java new file mode 100644 index 0000000..ae2b239 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysParameterService.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.entity.SysParameter; +import com.lframework.xingyun.template.inner.vo.system.parameter.CreateSysParameterVo; +import com.lframework.xingyun.template.inner.vo.system.parameter.QuerySysParameterVo; +import com.lframework.xingyun.template.inner.vo.system.parameter.UpdateSysParameterVo; +import java.util.List; + +/** + * 系统参数 Service + * + * @author zmj + */ +public interface SysParameterService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySysParameterVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySysParameterVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysParameter findById(Long id); + + /** + * 创建 + * + * @param vo + * @return + */ + Long create(CreateSysParameterVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysParameterVo vo); + + /** + * 根据ID删除 + * + * @param id + * @return + */ + void deleteById(Long id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysPositionService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysPositionService.java new file mode 100644 index 0000000..20bfb6a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysPositionService.java @@ -0,0 +1,66 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysPosition; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.position.CreateSysPositionVo; +import com.lframework.xingyun.template.inner.vo.system.position.QuerySysPositionVo; +import com.lframework.xingyun.template.inner.vo.system.position.SysPositionSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.position.UpdateSysPositionVo; +import java.util.Collection; + +public interface SysPositionService extends BaseMpService { + + /** + * 查询全部岗位信息 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, + QuerySysPositionVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysPosition findById(String id); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, + SysPositionSelectorVo vo); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysPositionVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysPositionVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysRoleMenuService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysRoleMenuService.java new file mode 100644 index 0000000..8b3d104 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysRoleMenuService.java @@ -0,0 +1,15 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysRoleMenu; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.role.SysRoleMenuSettingVo; + +public interface SysRoleMenuService extends BaseMpService { + + /** + * 授权角色菜单 + * + * @param vo + */ + void setting(SysRoleMenuSettingVo vo); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysRoleService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysRoleService.java new file mode 100644 index 0000000..03c5467 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysRoleService.java @@ -0,0 +1,81 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysRole; +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.role.CreateSysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.role.QuerySysRoleVo; +import com.lframework.xingyun.template.inner.vo.system.role.SysRoleSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.role.UpdateSysRoleVo; +import java.util.Collection; +import java.util.List; + +public interface SysRoleService extends BaseMpService { + + /** + * 查询列表 + * + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySysRoleVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySysRoleVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysRole findById(String id); + + /** + * 选择器 + * + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SysRoleSelectorVo vo); + + /** + * 根据ID停用 + * + * @param ids + */ + void batchUnable(Collection ids); + + /** + * 根据ID启用 + * + * @param ids + */ + void batchEnable(Collection ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysRoleVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysRoleVo vo); + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserDeptService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserDeptService.java new file mode 100644 index 0000000..da1ad32 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserDeptService.java @@ -0,0 +1,32 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysUserDept; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.dept.SysUserDeptSettingVo; +import java.util.List; + +public interface SysUserDeptService extends BaseMpService { + + /** + * 设置部门 + * + * @param vo + */ + void setting(SysUserDeptSettingVo vo); + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); + + /** + * 根据部门ID查询是否存在 + * + * @param deptId + * @return + */ + Boolean hasByDeptId(String deptId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserPositionService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserPositionService.java new file mode 100644 index 0000000..c3d3cc1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserPositionService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysUserPosition; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.position.SysUserPositionSettingVo; +import java.util.List; + +public interface SysUserPositionService extends BaseMpService { + + /** + * 设置岗位 + * + * @param vo + */ + void setting(SysUserPositionSettingVo vo); + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserRoleService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserRoleService.java new file mode 100644 index 0000000..c40e19a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserRoleService.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysUserRole; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserRoleSettingVo; +import java.util.List; + +public interface SysUserRoleService extends BaseMpService { + + /** + * 用户授权 + * + * @param vo + */ + void setting(SysUserRoleSettingVo vo); + + /** + * 根据用户ID查询 + * + * @param userId + * @return + */ + List getByUserId(String userId); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserService.java new file mode 100644 index 0000000..b414057 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserService.java @@ -0,0 +1,133 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.starter.web.resp.PageResult; +import com.lframework.starter.web.service.BaseMpService; +import com.lframework.xingyun.template.inner.dto.UserInfoDto; +import com.lframework.xingyun.template.core.entity.SysUser; +import com.lframework.xingyun.template.inner.vo.system.user.CreateSysUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.QuerySysUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.RegistUserVo; +import com.lframework.xingyun.template.inner.vo.system.user.SysUserSelectorVo; +import com.lframework.xingyun.template.inner.vo.system.user.UpdateSysUserVo; +import java.util.List; + +public interface SysUserService extends BaseMpService { + + /** + * 查询列表 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult query(Integer pageIndex, Integer pageSize, QuerySysUserVo vo); + + /** + * 查询列表 + * + * @param vo + * @return + */ + List query(QuerySysUserVo vo); + + /** + * 根据ID查询 + * + * @param id + * @return + */ + SysUser findById(String id); + + /** + * 批量启用 + * + * @param ids + */ + void batchEnable(List ids); + + /** + * 批量停用 + * + * @param ids + */ + void batchUnable(List ids); + + /** + * 创建 + * + * @param vo + * @return + */ + String create(CreateSysUserVo vo); + + /** + * 修改 + * + * @param vo + */ + void update(UpdateSysUserVo vo); + + /** + * 选择器 + * + * @param pageIndex + * @param pageSize + * @param vo + * @return + */ + PageResult selector(Integer pageIndex, Integer pageSize, SysUserSelectorVo vo); + + /** + * 注册 + * + * @param vo + */ + void regist(RegistUserVo vo); + + /** + * 获取用户信息 + * + * @param userId 用户ID + * @return + */ + UserInfoDto getInfo(String userId); + + /** + * 修改用户密码 + * + * @param userId 用户ID + * @param password 新密码(明文) + */ + void updatePassword(String userId, String password); + + /** + * 修改邮箱 + * + * @param userId 用户ID + * @param email 邮箱 + */ + void updateEmail(String userId, String email); + + /** + * 修改联系电话 + * + * @param userId 用户ID + * @param telephone 联系电话 + */ + void updateTelephone(String userId, String telephone); + + /** + * 根据ID锁定 + * + * @param id + */ + void lockById(String id); + + /** + * 根据ID解锁 + * + * @param id + */ + void unlockById(String id); +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserTelephoneService.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserTelephoneService.java new file mode 100644 index 0000000..a07657d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/service/system/SysUserTelephoneService.java @@ -0,0 +1,8 @@ +package com.lframework.xingyun.template.inner.service.system; + +import com.lframework.xingyun.template.inner.entity.SysUserTelephone; +import com.lframework.starter.web.service.BaseMpService; + +public interface SysUserTelephoneService extends BaseMpService { + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/sign/handler/DefaultCheckSignHandler.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/sign/handler/DefaultCheckSignHandler.java new file mode 100644 index 0000000..c2c7417 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/sign/handler/DefaultCheckSignHandler.java @@ -0,0 +1,69 @@ +package com.lframework.xingyun.template.inner.sign.handler; + +import com.lframework.starter.common.exceptions.impl.DefaultSysException; +import com.lframework.starter.common.utils.StringUtil; +import com.lframework.xingyun.template.inner.sign.util.SignUtil; +import com.lframework.xingyun.template.inner.entity.SysOpenDomain; +import com.lframework.xingyun.template.inner.service.system.SysOpenDomainService; +import com.lframework.starter.web.common.tenant.TenantContextHolder; +import com.lframework.starter.web.sign.CheckSignHandler; +import com.lframework.starter.web.utils.TenantUtil; +import com.lframework.starter.web.vo.OpenApiReqVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class DefaultCheckSignHandler implements CheckSignHandler { + + @Autowired + private SysOpenDomainService sysOpenDomainService; + + @Override + public boolean check(OpenApiReqVo req) { + Integer clientId = req.getClientId(); + if (clientId == null) { + return false; + } + + String timestamp = req.getTimestamp(); + if (StringUtil.isBlank(timestamp)) { + return false; + } + + String nonceStr = req.getNonceStr(); + if (StringUtil.isBlank(nonceStr)) { + return false; + } + + String params = req.getParams(); + if (StringUtil.isBlank(params)) { + return false; + } + + String sign = req.getSign(); + if (StringUtil.isBlank(params)) { + return false; + } + + SysOpenDomain domain = sysOpenDomainService.findById(clientId); + if (domain == null || !domain.getAvailable()) { + return false; + } + + return SignUtil + .validate(clientId.toString(), domain.getApiSecret(), timestamp, nonceStr, params, sign); + } + + @Override + public void setTenantId(OpenApiReqVo req) { + if (TenantUtil.enableTenant()) { + SysOpenDomain domain = sysOpenDomainService.findById(req.getClientId()); + Integer tenantId = domain.getTenantId(); + if (tenantId == null) { + throw new DefaultSysException("开放域没有设置租户ID"); + } else { + TenantContextHolder.setTenantId(domain.getTenantId()); + } + } + } +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/sign/util/SignUtil.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/sign/util/SignUtil.java new file mode 100644 index 0000000..88ad064 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/sign/util/SignUtil.java @@ -0,0 +1,97 @@ +package com.lframework.xingyun.template.inner.sign.util; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Api加签、验签工具类 + */ +public class SignUtil { + + private static final Logger log = LoggerFactory.getLogger(SignUtil.class); + + /** + * 加签 + * + * @param clientId 客户端ID + * @param apiSecret Api密钥 + * @param timestamp 时间戳 + * @param nonceStr 随机字符串 + * @param json 请求参数 + * @return + */ + public static String sign(String clientId, String apiSecret, String timestamp, String nonceStr, + String json) { + String str = new StringBuilder().append("clientId=").append(clientId).append("&") + .append("apiSecret=").append(apiSecret) + .append("&").append("timestamp=").append(timestamp).append("&").append("nonceStr=") + .append(nonceStr).append("&").append("params=") + .append(json).toString(); + MessageDigest digest = null; + try { + digest = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e); + } + byte[] bs = digest.digest(str.getBytes(StandardCharsets.UTF_8)); + StringBuilder builder = new StringBuilder(); + for (byte b : bs) { + int x = b & 255; + String s = Integer.toHexString(x); + if (x > 0 && x < 16) { + builder.append("0"); + builder.append(s); + } else { + builder.append(s); + } + } + + return builder.toString(); + } + + /** + * 验签 + * + * @param clientId 客户端ID + * @param apiSecret Api密钥 + * @param timestamp 时间戳 + * @param nonceStr 随机字符串 + * @param json 请求参数 + * @param oriSign 原始签值 + * @return + */ + public static boolean validate(String clientId, String apiSecret, String timestamp, + String nonceStr, String json, + String oriSign) { + return sign(clientId, apiSecret, timestamp, nonceStr, json).equals(oriSign); + } + + // 以下为示例 + /* + public static void main(String[] args) { + String clientId = ""; + String apiSecret = ""; + String ts = String.valueOf(System.currentTimeMillis()); + + //此处为示例的获取字符串算法,此处可以自行替换算法 + String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + Random random = new Random(); + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < 20; i++) { + int number = random.nextInt(62); + builder.append(str.charAt(number)); + } + + String nonceStr = builder.toString(); + + String json = "{\"key1\":\"value1\", \"key2\":\"value2\"}"; + String sign = SignUtil.sign(clientId, apiSecret, ts, nonceStr, json); // 这里是加签 + + boolean isValidate = SignUtil.validate(clientId, apiSecret, ts, nonceStr, json, sign); // 这里是验签 + } + */ +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/CreateQrtzVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/CreateQrtzVo.java new file mode 100644 index 0000000..44b6c15 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/CreateQrtzVo.java @@ -0,0 +1,91 @@ +package com.lframework.xingyun.template.inner.vo.qrtz; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.template.inner.enums.QrtzJobType; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author zmj + * @since 2022/8/20 + */ +@Data +public class CreateQrtzVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 分组 + */ + @ApiModelProperty(value = "分组", required = true) + @NotBlank(message = "分组不能为空!") + private String group; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private Integer tenantId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 执行类名 + */ + @ApiModelProperty("执行类名") + private String targetClassName; + + /** + * 执行方法名 + */ + @ApiModelProperty("执行方法名") + private String targetMethodName; + + /** + * 执行参数类型 + */ + @ApiModelProperty("执行参数类型") + private List targetParamTypes; + + /** + * 执行参数 + */ + @ApiModelProperty("执行参数") + private List targetParams; + + /** + * Cron表达式 + */ + @ApiModelProperty("Cron表达式") + @NotBlank(message = "Cron表达式不能为空!") + private String cron; + + /** + * 任务类型 + */ + @NotNull(message = "任务类型不能为空!") + @IsEnum(message = "任务类型不能为空!", enumClass = QrtzJobType.class) + private Integer jobType; + + /** + * 脚本 + */ + @ApiModelProperty("脚本") + private String script; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/QueryQrtzVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/QueryQrtzVo.java new file mode 100644 index 0000000..7f63702 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/QueryQrtzVo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.template.inner.vo.qrtz; + +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.xingyun.template.inner.enums.TriggerState; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.Data; + +/** + * @author zmj + * @since 2022/8/20 + */ +@Data +public class QueryQrtzVo extends PageVo { + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 组 + */ + @ApiModelProperty("组") + private String group; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @IsEnum(message = "状态格式错误!", enumClass = TriggerState.class) + private String state; + + /** + * 任务类 + */ + @ApiModelProperty(hidden = true) + private List jobClasses; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/UpdateQrtzVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/UpdateQrtzVo.java new file mode 100644 index 0000000..26846be --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/qrtz/UpdateQrtzVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.qrtz; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +/** + * @author zmj + * @since 2022/8/20 + */ +@Data +public class UpdateQrtzVo extends CreateQrtzVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 原始任务名称 + */ + @ApiModelProperty(value = "原始任务名称", required = true) + @NotBlank(message = "原始任务名称不能为空!") + private String oriName; + + /** + * 原始任务分组 + */ + @ApiModelProperty(value = "原始任务分组", required = true) + @NotBlank(message = "原始任务分组不能为空!") + private String oriGroup; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/config/UpdateSysConfigVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/config/UpdateSysConfigVo.java new file mode 100644 index 0000000..a66c087 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/config/UpdateSysConfigVo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.template.inner.vo.system.config; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysConfigVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 是否允许注册 + */ + @ApiModelProperty(value = "是否允许注册", required = true) + @NotNull(message = "请选择是否允许注册!") + @TypeMismatch(message = "是否允许注册格式错误!") + private Boolean allowRegist; + + /** + * 是否允许手机号登录 + */ + @ApiModelProperty(value = "是否允许手机号登录", required = true) + @NotNull(message = "请选择是否允许手机号登录!") + @TypeMismatch(message = "是否允许手机号登录格式错误!") + private Boolean allowTelephoneLogin; + + /** + * 手机号登录时的signName + */ + private String telephoneLoginSignName; + + /** + * 手机号登录时的templateCode + */ + private String telephoneLoginTemplateCode; + + /** + * 是否允许锁定用户 + */ + @ApiModelProperty(value = "是否允许锁定用户", required = true) + @NotNull(message = "请选择是否允许锁定用户!") + @TypeMismatch(message = "是否允许锁定用户格式错误!") + private Boolean allowLock; + + /** + * 登录失败次数 + */ + @ApiModelProperty(value = "登录失败次数") + private Integer failNum; + + /** + * 是否允许验证码 + */ + @ApiModelProperty(value = "是否允许验证码", required = true) + @NotNull(message = "请选择是否允许验证码!") + @TypeMismatch(message = "是否允许验证码格式错误!") + private Boolean allowCaptcha; + + /** + * 是否开启忘记密码 + */ + @ApiModelProperty(value = "是否开启忘记密码", required = true) + @NotNull(message = "请选择是否开启忘记密码!") + @TypeMismatch(message = "是否开启忘记密码格式错误!") + private Boolean allowForgetPsw; + + /** + * 忘记密码是否使用邮箱 + */ + @ApiModelProperty(value = "忘记密码是否使用邮箱,allowForgetPsw == true时必填") + @TypeMismatch(message = "忘记密码是否使用邮箱格式错误!") + private Boolean forgetPswRequireMail; + + /** + * 忘记密码是否使用短信 + */ + @ApiModelProperty(value = "忘记密码是否使用短信,allowForgetPsw == true时必填") + @TypeMismatch(message = "忘记密码是否使用短信格式错误!") + private Boolean forgetPswRequireSms; + + /** + * signName + */ + @ApiModelProperty(value = "signName,forgetPswRequireSms == true时必填") + private String signName; + + /** + * templateCode + */ + @ApiModelProperty(value = "templateCode,forgetPswRequireSms == true时必填") + private String templateCode; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/CreateSysDeptVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/CreateSysDeptVo.java new file mode 100644 index 0000000..7b5b0ed --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/CreateSysDeptVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.template.inner.vo.system.dept; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSysDeptVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "编号不能为空!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 简称 + */ + @ApiModelProperty(value = "简称", required = true) + @NotBlank(message = "简称不能为空!") + private String shortName; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/SysUserDeptSettingVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/SysUserDeptSettingVo.java new file mode 100644 index 0000000..b210969 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/SysUserDeptSettingVo.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.inner.vo.system.dept; + +import com.lframework.starter.web.vo.BaseVo; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class SysUserDeptSettingVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + @NotBlank(message = "用户ID不能为空!") + private String userId; + + /** + * 部门ID + */ + private List deptIds; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/UpdateSysDeptVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/UpdateSysDeptVo.java new file mode 100644 index 0000000..23208a3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dept/UpdateSysDeptVo.java @@ -0,0 +1,63 @@ +package com.lframework.xingyun.template.inner.vo.system.dept; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysDeptVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "编号不能为空!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 简称 + */ + @ApiModelProperty(value = "简称", required = true) + @NotBlank(message = "简称不能为空!") + private String shortName; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/CreateSysDataDicVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/CreateSysDataDicVo.java new file mode 100644 index 0000000..fa7cad5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/CreateSysDataDicVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.inner.vo.system.dic; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSysDataDicVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/QuerySysDataDicVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/QuerySysDataDicVo.java new file mode 100644 index 0000000..98bec53 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/QuerySysDataDicVo.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.template.inner.vo.system.dic; + +import com.lframework.starter.web.vo.PageVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class QuerySysDataDicVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/SysDataDicSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/SysDataDicSelectorVo.java new file mode 100644 index 0000000..b452075 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/SysDataDicSelectorVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.inner.vo.system.dic; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDataDicSelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/UpdateSysDataDicVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/UpdateSysDataDicVo.java new file mode 100644 index 0000000..a4148dc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/UpdateSysDataDicVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.inner.vo.system.dic; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysDataDicVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 分类ID + */ + @ApiModelProperty("分类ID") + private String categoryId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/CreateSysDataDicCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/CreateSysDataDicCategoryVo.java new file mode 100644 index 0000000..fad425d --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/CreateSysDataDicCategoryVo.java @@ -0,0 +1,29 @@ +package com.lframework.xingyun.template.inner.vo.system.dic.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSysDataDicCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/SysDataDicCategorySelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/SysDataDicCategorySelectorVo.java new file mode 100644 index 0000000..badfdd7 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/SysDataDicCategorySelectorVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.inner.vo.system.dic.category; + +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SysDataDicCategorySelectorVo extends PageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/UpdateSysDataDicCategoryVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/UpdateSysDataDicCategoryVo.java new file mode 100644 index 0000000..48214f8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/category/UpdateSysDataDicCategoryVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.inner.vo.system.dic.category; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysDataDicCategoryVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/CreateSysDataDicItemVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/CreateSysDataDicItemVo.java new file mode 100644 index 0000000..df32917 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/CreateSysDataDicItemVo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.template.inner.vo.system.dic.item; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSysDataDicItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 字典ID + */ + @ApiModelProperty("字典ID") + @NotBlank(message = "字典ID不能为空!") + private String dicId; + + /** + * 排序 + */ + @ApiModelProperty("排序") + @NotNull(message = "请输入排序!") + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/QuerySysDataDicItemVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/QuerySysDataDicItemVo.java new file mode 100644 index 0000000..d1e11f9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/QuerySysDataDicItemVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.dic.item; + +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class QuerySysDataDicItemVo extends SortPageVo { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 字典ID + */ + @ApiModelProperty("字典ID") + @NotBlank(message = "字典ID不能为空!") + private String dicId; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/UpdateSysDataDicItemVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/UpdateSysDataDicItemVo.java new file mode 100644 index 0000000..04b2751 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/dic/item/UpdateSysDataDicItemVo.java @@ -0,0 +1,44 @@ +package com.lframework.xingyun.template.inner.vo.system.dic.item; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysDataDicItemVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @NotBlank(message = "请输入编号!") + @IsCode + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 排序 + */ + @ApiModelProperty("排序") + @NotNull(message = "请输入排序!") + private Integer orderNo; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/CreateSysMenuVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/CreateSysMenuVo.java new file mode 100644 index 0000000..0472795 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/CreateSysMenuVo.java @@ -0,0 +1,113 @@ +package com.lframework.xingyun.template.inner.vo.system.menu; + +import com.lframework.xingyun.template.inner.enums.system.SysMenuComponentType; +import com.lframework.xingyun.template.inner.enums.system.SysMenuDisplay; +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +/** + * 创建菜单Vo + */ +@Data +public class CreateSysMenuVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题", required = true) + @NotBlank(message = "请输入标题!") + private String title; + + /** + * 图标 + */ + @ApiModelProperty("图标") + private String icon; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型", required = true) + @NotNull(message = "请选择类型!") + @IsEnum(message = "请选择类型!", enumClass = SysMenuDisplay.class) + private Integer display; + + /** + * 父级ID + */ + @ApiModelProperty("父级ID") + private String parentId; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + // 以下均为前端配置项 + + /** + * 路由名称 + */ + @ApiModelProperty("路由名称") + private String name; + + /** + * 组件类型 + */ + @ApiModelProperty("组件类型") + @IsEnum(message = "组件类型格式错误!", enumClass = SysMenuComponentType.class) + private Integer componentType; + + /** + * 组件 + */ + @ApiModelProperty("组件") + private String component; + + /** + * 自定义请求参数 + */ + @ApiModelProperty("自定义请求参数") + private String requestParam; + + /** + * 路径 + */ + @ApiModelProperty("路径") + private String path; + + /** + * 是否隐藏 + */ + @ApiModelProperty("是否隐藏") + private Boolean hidden; + + /** + * 是否不缓存 + */ + @ApiModelProperty("是否不缓存") + private Boolean noCache; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/SysMenuSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/SysMenuSelectorVo.java new file mode 100644 index 0000000..8f536f3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/SysMenuSelectorVo.java @@ -0,0 +1,21 @@ +package com.lframework.xingyun.template.inner.vo.system.menu; + +import com.lframework.xingyun.template.inner.enums.system.SysMenuDisplay; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SysMenuSelectorVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("类型") + @IsEnum(message = "类型格式不正确!", enumClass = SysMenuDisplay.class) + private Integer display; + + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/UpdateSysMenuVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/UpdateSysMenuVo.java new file mode 100644 index 0000000..ce6fe31 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/menu/UpdateSysMenuVo.java @@ -0,0 +1,30 @@ +package com.lframework.xingyun.template.inner.vo.system.menu; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysMenuVo extends CreateSysMenuVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + @TypeMismatch(message = "状态格式有误!") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/module/SysModuleTenantVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/module/SysModuleTenantVo.java new file mode 100644 index 0000000..0ac2063 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/module/SysModuleTenantVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.template.inner.vo.system.module; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class SysModuleTenantVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + @Data + public static class SysModuleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 模块ID + */ + @ApiModelProperty(value = "模块ID", required = true) + @NotNull(message = "模块ID不能为空!") + private Integer moduleId; + + /** + * 过期时间 + */ + @ApiModelProperty(value = "过期时间", required = true) + @NotNull(message = "过期时间不能为空!") + private LocalDateTime expireTime; + } + + /** + * 租户ID + */ + @ApiModelProperty(value = "租户ID", required = true) + @NotNull(message = "租户ID不能为空!") + private Integer tenantId; + + /** + * 模块 + */ + @ApiModelProperty("模块") + @Valid + private List modules; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/CreateSysNoticeVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/CreateSysNoticeVo.java new file mode 100644 index 0000000..ee58cdc --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/CreateSysNoticeVo.java @@ -0,0 +1,38 @@ +package com.lframework.xingyun.template.inner.vo.system.notice; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSysNoticeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题", required = true) + @NotBlank(message = "请输入标题!") + private String title; + + /** + * 内容 + */ + @ApiModelProperty(value = "内容", required = true) + @NotBlank(message = "请输入内容!") + private String content; + + /** + * 是否发布 + */ + @ApiModelProperty(value = "是否发布", required = true) + @TypeMismatch(message = "是否发布格式有误!") + @NotNull(message = "请选择是否发布!") + private Boolean published; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/QuerySysNoticeByUserVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/QuerySysNoticeByUserVo.java new file mode 100644 index 0000000..f77bafd --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/QuerySysNoticeByUserVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.template.inner.vo.system.notice; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySysNoticeByUserVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 创建时间 起始时间 + */ + @ApiModelProperty("创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @ApiModelProperty("创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + + /** + * 用户ID + */ + @ApiModelProperty(hidden = true) + private String userId; + + /** + * 是否已读 + */ + @ApiModelProperty("是否已读") + private Boolean readed; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/QuerySysNoticeVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/QuerySysNoticeVo.java new file mode 100644 index 0000000..c0c4922 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/QuerySysNoticeVo.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.template.inner.vo.system.notice; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySysNoticeVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 标题 + */ + @ApiModelProperty("标题") + private String title; + + /** + * 创建时间 起始时间 + */ + @ApiModelProperty("创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @ApiModelProperty("创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/UpdateSysNoticeVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/UpdateSysNoticeVo.java new file mode 100644 index 0000000..aa6eca0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/notice/UpdateSysNoticeVo.java @@ -0,0 +1,52 @@ +package com.lframework.xingyun.template.inner.vo.system.notice; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysNoticeVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "id不能为空!") + private String id; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题", required = true) + @NotBlank(message = "请输入标题!") + private String title; + + /** + * 内容 + */ + @ApiModelProperty(value = "内容", required = true) + @NotBlank(message = "请输入内容!") + private String content; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @TypeMismatch(message = "状态格式有误!") + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 是否发布 + */ + @ApiModelProperty(value = "是否发布", required = true) + @TypeMismatch(message = "是否发布格式有误!") + @NotNull(message = "请选择是否发布!") + private Boolean published; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/CreateSysOpenDomainVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/CreateSysOpenDomainVo.java new file mode 100644 index 0000000..050083f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/CreateSysOpenDomainVo.java @@ -0,0 +1,39 @@ +package com.lframework.xingyun.template.inner.vo.system.open; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSysOpenDomainVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * API密钥 + */ + @ApiModelProperty(value = "API密钥", required = true) + @NotBlank(message = "API密钥不能为空!") + private String apiSecret; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private Integer tenantId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/QuerySysOpenDomainVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/QuerySysOpenDomainVo.java new file mode 100644 index 0000000..01b85ac --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/QuerySysOpenDomainVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.open; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySysOpenDomainVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/SysOpenDomainSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/SysOpenDomainSelectorVo.java new file mode 100644 index 0000000..6c01146 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/SysOpenDomainSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.open; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SysOpenDomainSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + private String id; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/UpdateSysOpenDomainSecretVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/UpdateSysOpenDomainSecretVo.java new file mode 100644 index 0000000..98383de --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/UpdateSysOpenDomainSecretVo.java @@ -0,0 +1,28 @@ +package com.lframework.xingyun.template.inner.vo.system.open; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysOpenDomainSecretVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private Long id; + + /** + * Api密钥 + */ + @ApiModelProperty(value = "Api密钥", required = true) + @NotBlank(message = "Api密钥不能为空!") + private String apiSecret; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/UpdateSysOpenDomainVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/UpdateSysOpenDomainVo.java new file mode 100644 index 0000000..c3ed19f --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/open/UpdateSysOpenDomainVo.java @@ -0,0 +1,48 @@ +package com.lframework.xingyun.template.inner.vo.system.open; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysOpenDomainVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "名称不能为空!") + private String name; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private Integer tenantId; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/CreateSysParameterVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/CreateSysParameterVo.java new file mode 100644 index 0000000..78dd0cb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/CreateSysParameterVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.inner.vo.system.parameter; + +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSysParameterVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 键 + */ + @ApiModelProperty(value = "键", required = true) + @NotBlank(message = "请输入键!") + @Pattern(regexp = "^[A-Za-z0-9\\.\\-_]+$", message = "键只能由大写字母、小写字母、数字或._-组成") + private String pmKey; + + /** + * 值 + */ + @ApiModelProperty("值") + private String pmValue; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/QuerySysParameterVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/QuerySysParameterVo.java new file mode 100644 index 0000000..0924ee3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/QuerySysParameterVo.java @@ -0,0 +1,36 @@ +package com.lframework.xingyun.template.inner.vo.system.parameter; + +import com.lframework.starter.web.components.validation.TypeMismatch; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +@Data +public class QuerySysParameterVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 键 + */ + @ApiModelProperty("键") + private String pmKey; + + /** + * 创建时间 起始时间 + */ + @ApiModelProperty("创建时间 起始时间") + @TypeMismatch(message = "创建时间起始时间格式有误!") + private LocalDateTime createTimeStart; + + /** + * 创建时间 截止时间 + */ + @ApiModelProperty("创建时间 截止时间") + @TypeMismatch(message = "创建时间截止时间格式有误!") + private LocalDateTime createTimeEnd; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/UpdateSysParameterVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/UpdateSysParameterVo.java new file mode 100644 index 0000000..27d7e80 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/parameter/UpdateSysParameterVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.inner.vo.system.parameter; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysParameterVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "id不能为空!") + private Long id; + + /** + * 值 + */ + @ApiModelProperty("值") + private String pmValue; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; + +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/CreateSysPositionVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/CreateSysPositionVo.java new file mode 100644 index 0000000..c7972ce --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/CreateSysPositionVo.java @@ -0,0 +1,35 @@ +package com.lframework.xingyun.template.inner.vo.system.position; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSysPositionVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 岗位编号 + */ + @ApiModelProperty(value = "岗位编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty(value = "岗位名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/QuerySysPositionVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/QuerySysPositionVo.java new file mode 100644 index 0000000..733a0e2 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/QuerySysPositionVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.position; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySysPositionVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/SysPositionSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/SysPositionSelectorVo.java new file mode 100644 index 0000000..c783745 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/SysPositionSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.position; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SysPositionSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/SysUserPositionSettingVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/SysUserPositionSettingVo.java new file mode 100644 index 0000000..49fc9c0 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/SysUserPositionSettingVo.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.inner.vo.system.position; + +import com.lframework.starter.web.vo.BaseVo; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class SysUserPositionSettingVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + @NotBlank(message = "用户ID不能为空!") + private String userId; + + /** + * 岗位ID + */ + private List positionIds; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/UpdateSysPositionVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/UpdateSysPositionVo.java new file mode 100644 index 0000000..b384619 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/position/UpdateSysPositionVo.java @@ -0,0 +1,50 @@ +package com.lframework.xingyun.template.inner.vo.system.position; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysPositionVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("ID") + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 岗位编号 + */ + @ApiModelProperty("岗位编号") + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 岗位名称 + */ + @ApiModelProperty("岗位名称") + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/CreateSysRoleVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/CreateSysRoleVo.java new file mode 100644 index 0000000..3aa141e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/CreateSysRoleVo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.template.inner.vo.system.role; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateSysRoleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/QuerySysRoleVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/QuerySysRoleVo.java new file mode 100644 index 0000000..86948ee --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/QuerySysRoleVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.role; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySysRoleVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/SysRoleMenuSettingVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/SysRoleMenuSettingVo.java new file mode 100644 index 0000000..8639e0e --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/SysRoleMenuSettingVo.java @@ -0,0 +1,24 @@ +package com.lframework.xingyun.template.inner.vo.system.role; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class SysRoleMenuSettingVo implements BaseVo { + + /** + * 角色ID + */ + @ApiModelProperty(value = "角色ID", required = true) + @NotEmpty(message = "角色ID不能为空!") + private List roleIds; + + /** + * 菜单ID + */ + @ApiModelProperty("菜单ID") + private List menuIds; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/SysRoleSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/SysRoleSelectorVo.java new file mode 100644 index 0000000..5b01fc3 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/SysRoleSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.role; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SysRoleSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/UpdateSysRoleVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/UpdateSysRoleVo.java new file mode 100644 index 0000000..9d66124 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/role/UpdateSysRoleVo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.template.inner.vo.system.role; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysRoleVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * 权限 + */ + @ApiModelProperty("权限") + private String permission; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "状态不能为空!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/CreateTenantVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/CreateTenantVo.java new file mode 100644 index 0000000..c3cfbe1 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/CreateTenantVo.java @@ -0,0 +1,41 @@ +package com.lframework.xingyun.template.inner.vo.system.tenant; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class CreateTenantVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * JdbcUrl + */ + @ApiModelProperty(value = "JdbcUrl", required = true) + @NotBlank(message = "请输入JdbcUrl!") + private String jdbcUrl; + + /** + * Jdbc用户名 + */ + @ApiModelProperty(value = "Jdbc用户名", required = true) + @NotBlank(message = "请输入Jdbc用户名!") + private String jdbcUsername; + + /** + * Jdbc密码 + */ + @ApiModelProperty(value = "Jdbc密码", required = true) + @NotBlank(message = "请输入Jdbc密码!") + private String jdbcPassword; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/QueryTenantVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/QueryTenantVo.java new file mode 100644 index 0000000..00f5f7a --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/QueryTenantVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.tenant; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QueryTenantVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private String tenantId; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/TenantSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/TenantSelectorVo.java new file mode 100644 index 0000000..78eb6fb --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/TenantSelectorVo.java @@ -0,0 +1,31 @@ +package com.lframework.xingyun.template.inner.vo.system.tenant; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class TenantSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 租户ID + */ + @ApiModelProperty("租户ID") + private String tenantId; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/UpdateTenantVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/UpdateTenantVo.java new file mode 100644 index 0000000..6ffbf12 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/tenant/UpdateTenantVo.java @@ -0,0 +1,53 @@ +package com.lframework.xingyun.template.inner.vo.system.tenant; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateTenantVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotNull(message = "ID不能为空!") + private Integer id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称", required = true) + @NotBlank(message = "请输入名称!") + private String name; + + /** + * JdbcUrl + */ + @ApiModelProperty("JdbcUrl") + private String jdbcUrl; + + /** + * Jdbc用户名 + */ + @ApiModelProperty("Jdbc用户名") + private String jdbcUsername; + + /** + * Jdbc密码 + */ + @ApiModelProperty("Jdbc密码") + private String jdbcPassword; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "请选择状态!") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/CreateSysUserVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/CreateSysUserVo.java new file mode 100644 index 0000000..d2d1934 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/CreateSysUserVo.java @@ -0,0 +1,96 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.template.core.enums.Gender; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class CreateSysUserVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @IsCode + @NotBlank(message = "请输入编号!") + @ApiModelProperty(value = "编号", required = true) + private String code; + + /** + * 姓名 + */ + @NotBlank(message = "请输入姓名!") + @ApiModelProperty(value = "姓名", required = true) + private String name; + + /** + * 用户名 + */ + @NotBlank(message = "请输入用户名!") + @ApiModelProperty(value = "用户名", required = true) + private String username; + + /** + * 密码 + */ + @Pattern(regexp = PatternPool.PATTERN_STR_PASSWORD, message = "密码长度必须为5-16位,只允许包含大写字母、小写字母、数字、下划线") + @NotBlank(message = "请输入密码!") + @ApiModelProperty(value = "密码", required = true) + private String password; + + /** + * 邮箱 + */ + @Pattern(regexp = PatternPool.PATTERN_STR_EMAIL, message = "邮箱地址格式不正确!") + @ApiModelProperty("邮箱") + private String email; + + /** + * 联系电话 + */ + @Pattern(regexp = PatternPool.PATTERN_STR_CN_TEL, message = "联系电话格式不正确!") + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 性别 0-未知 1-男 2-女 + */ + @NotNull(message = "请选择性别!") + @IsEnum(message = "请选择性别!", enumClass = Gender.class) + @ApiModelProperty("性别") + private Integer gender; + + /** + * 部门ID + */ + @ApiModelProperty("部门ID") + private List deptIds; + + /** + * 角色ID + */ + @ApiModelProperty("角色ID") + private List roleIds; + + /** + * 岗位ID + */ + @ApiModelProperty("岗位ID") + private List positionIds; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/GetTelephoneLoginCaptchaVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/GetTelephoneLoginCaptchaVo.java new file mode 100644 index 0000000..c93cfb6 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/GetTelephoneLoginCaptchaVo.java @@ -0,0 +1,23 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class GetTelephoneLoginCaptchaVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号", required = true) + @Pattern(regexp = PatternPool.PATTERN_STR_CN_TEL, message = "手机号格式不正确!") + @NotBlank(message = "手机号不能为空!") + private String telephone; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/LoginVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/LoginVo.java new file mode 100644 index 0000000..f39fea8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/LoginVo.java @@ -0,0 +1,42 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +/** + * 用户登录请求参数 + */ +@Data +public class LoginVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名", required = true) + @NotBlank(message = "用户名不能为空!") + private String username; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码", required = true) + @NotBlank(message = "密码不能为空!") + private String password; + + /** + * sn + */ + @ApiModelProperty(value = "sn,验证码流水号", required = true) + private String sn; + + /** + * 验证码 + */ + @ApiModelProperty(value = "验证码", required = true) + private String captcha; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/QuerySysUserVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/QuerySysUserVo.java new file mode 100644 index 0000000..d99ade9 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/QuerySysUserVo.java @@ -0,0 +1,56 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import com.lframework.starter.web.vo.SortPageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class QuerySysUserVo extends SortPageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 用户名 + */ + @ApiModelProperty("用户名") + private String username; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 岗位ID + */ + @ApiModelProperty("岗位ID") + private String positionId; + + /** + * 部门ID + */ + @ApiModelProperty("部门ID") + private String deptId; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; + + /** + * 是否锁定 + */ + @ApiModelProperty("是否锁定") + private Boolean lockStatus; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/RegistUserVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/RegistUserVo.java new file mode 100644 index 0000000..6b4f0f5 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/RegistUserVo.java @@ -0,0 +1,51 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class RegistUserVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名", required = true) + @NotBlank(message = "用户名不能为空!") + private String username; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码", required = true) + @Pattern(regexp = PatternPool.PATTERN_STR_PASSWORD, message = "密码长度必须为5-16位,只允许包含大写字母、小写字母、数字、下划线") + @NotBlank(message = "密码不能为空!") + private String password; + + /** + * 姓名 + */ + @ApiModelProperty(value = "姓名", required = true) + @NotBlank(message = "姓名不能为空!") + private String name; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱") + @Pattern(regexp = PatternPool.PATTERN_STR_EMAIL, message = "邮箱地址格式不正确!") + private String email; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + @Pattern(regexp = PatternPool.PATTERN_STR_CN_TEL, message = "联系电话格式不正确!") + private String telephone; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/SysUserRoleSettingVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/SysUserRoleSettingVo.java new file mode 100644 index 0000000..64ecd58 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/SysUserRoleSettingVo.java @@ -0,0 +1,27 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotEmpty; +import lombok.Data; + +@Data +public class SysUserRoleSettingVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID", required = true) + @NotEmpty(message = "用户ID不能为空!") + private List userIds; + + /** + * 角色ID + */ + @ApiModelProperty("角色ID") + private List roleIds; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/SysUserSelectorVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/SysUserSelectorVo.java new file mode 100644 index 0000000..76e910b --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/SysUserSelectorVo.java @@ -0,0 +1,37 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.starter.web.vo.PageVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import lombok.Data; + +@Data +public class SysUserSelectorVo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String code; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 用户名 + */ + @ApiModelProperty("用户名") + private String username; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private Boolean available; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/TelephoneBindUserVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/TelephoneBindUserVo.java new file mode 100644 index 0000000..9855646 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/TelephoneBindUserVo.java @@ -0,0 +1,43 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +/** + * 手机号绑定用户 + * + * @author zmj + * @since 2022/4/25 + */ +@Data +public class TelephoneBindUserVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号", required = true) + @Pattern(regexp = PatternPool.PATTERN_STR_CN_TEL, message = "手机号格式不正确!") + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名", required = true) + @NotBlank(message = "用户名不能为空!") + private String username; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码", required = true) + @NotBlank(message = "密码不能为空!") + private String password; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/TelephoneLoginVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/TelephoneLoginVo.java new file mode 100644 index 0000000..4d0f4b8 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/TelephoneLoginVo.java @@ -0,0 +1,33 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.common.constants.PatternPool; +import com.lframework.starter.web.components.validation.Pattern; +import com.lframework.starter.web.vo.BaseVo; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +/** + * 手机号登录请求参数 + */ +@Data +public class TelephoneLoginVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号", required = true) + @Pattern(regexp = PatternPool.PATTERN_STR_CN_TEL, message = "手机号格式不正确!") + @NotBlank(message = "手机号不能为空!") + private String telephone; + + /** + * 验证码 + */ + @ApiModelProperty(value = "验证码", required = true) + @NotBlank(message = "验证码不能为空!") + private String captcha; +} diff --git a/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/UpdateSysUserVo.java b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/UpdateSysUserVo.java new file mode 100644 index 0000000..7a56a47 --- /dev/null +++ b/xingyun-template/src/main/java/com/lframework/xingyun/template/inner/vo/system/user/UpdateSysUserVo.java @@ -0,0 +1,104 @@ +package com.lframework.xingyun.template.inner.vo.system.user; + +import com.lframework.starter.web.components.validation.IsCode; +import com.lframework.starter.web.components.validation.IsEnum; +import com.lframework.starter.web.vo.BaseVo; +import com.lframework.xingyun.template.core.enums.Gender; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +public class UpdateSysUserVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID", required = true) + @NotBlank(message = "ID不能为空!") + private String id; + + /** + * 编号 + */ + @ApiModelProperty(value = "编号", required = true) + @IsCode + @NotBlank(message = "请输入编号!") + private String code; + + /** + * 姓名 + */ + @ApiModelProperty(value = "姓名", required = true) + @NotBlank(message = "请输入姓名!") + private String name; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名", required = true) + @NotBlank(message = "请输入用户名!") + private String username; + + /** + * 密码 如果不为空则为修改密码 + */ + @ApiModelProperty("密码 如果不为空则为修改密码") + private String password; + + /** + * 邮箱 + */ + @ApiModelProperty("邮箱") + private String email; + + /** + * 联系电话 + */ + @ApiModelProperty("联系电话") + private String telephone; + + /** + * 性别 + */ + @ApiModelProperty(value = "性别", required = true) + @NotNull(message = "请选择性别!") + @IsEnum(message = "请选择性别!", enumClass = Gender.class) + private Integer gender; + + /** + * 岗位ID + */ + @ApiModelProperty("岗位ID") + private List positionIds; + + /** + * 角色ID + */ + @ApiModelProperty("角色ID") + private List roleIds; + + /** + * 部门ID + */ + @ApiModelProperty("部门ID") + private List deptIds; + + /** + * 状态 + */ + @ApiModelProperty(value = "状态", required = true) + @NotNull(message = "请选择状态!") + private Boolean available; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String description; +} diff --git a/xingyun-template/src/main/java/lombok.config b/xingyun-template/src/main/java/lombok.config new file mode 100644 index 0000000..8e37527 --- /dev/null +++ b/xingyun-template/src/main/java/lombok.config @@ -0,0 +1,2 @@ +config.stopBubbling=true +lombok.equalsAndHashCode.callSuper=call \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/QrtzMapper.xml b/xingyun-template/src/main/resources/mappers/QrtzMapper.xml new file mode 100644 index 0000000..916db3a --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/QrtzMapper.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + SELECT + job.JOB_NAME AS `name`, + job.JOB_GROUP AS `group`, + job.DESCRIPTION AS description, + cron.CRON_EXPRESSION AS cron, + tri.TRIGGER_STATE AS state + FROM qrtz_job_details AS job + LEFT JOIN qrtz_triggers AS tri ON job.JOB_NAME = tri.JOB_NAME AND job.JOB_GROUP = tri.JOB_GROUP + LEFT JOIN qrtz_cron_triggers AS cron ON cron.TRIGGER_NAME = tri.TRIGGER_NAME AND cron.TRIGGER_GROUP= tri.JOB_GROUP + + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/SysParameterMapper.xml b/xingyun-template/src/main/resources/mappers/SysParameterMapper.xml new file mode 100644 index 0000000..9e0ec73 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/SysParameterMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.pm_key, + tb.pm_value, + tb.description, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM sys_parameter AS tb + + diff --git a/xingyun-template/src/main/resources/mappers/TenantMapper.xml b/xingyun-template/src/main/resources/mappers/TenantMapper.xml new file mode 100644 index 0000000..49480c0 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/TenantMapper.xml @@ -0,0 +1,43 @@ + + + + + SELECT + tb.* + FROM tenant AS tb + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/UserDetailsMapper.xml b/xingyun-template/src/main/resources/mappers/UserDetailsMapper.xml new file mode 100644 index 0000000..afeb2f4 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/UserDetailsMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/DBMapper.xml b/xingyun-template/src/main/resources/mappers/gen/DBMapper.xml new file mode 100644 index 0000000..932e35e --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/DBMapper.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCreateColumnConfigMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCreateColumnConfigMapper.xml new file mode 100644 index 0000000..956ddbc --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCreateColumnConfigMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + SELECT + g.id, + g.required, + g.order_no + FROM gen_create_column_config AS g + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomListCategoryMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomListCategoryMapper.xml new file mode 100644 index 0000000..c5dda71 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomListCategoryMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM gen_custom_list_category AS tb + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomListHandleColumnMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomListHandleColumnMapper.xml new file mode 100644 index 0000000..11f584b --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomListHandleColumnMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + SELECT o.id, + o.custom_list_id, + o.name, + o.view_type, + o.btn_type, + o.btn_config, + o.icon, + o.request_param, + o.width, + o.order_no + FROM gen_custom_list_handle_column AS o + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomListMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomListMapper.xml new file mode 100644 index 0000000..daa9567 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomListMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + SELECT o.id, + o.name, + o.category_id, + o.data_obj_id, + o.list_type, + o.available, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time + FROM gen_custom_list AS o + + + + + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomListToolbarMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomListToolbarMapper.xml new file mode 100644 index 0000000..c941551 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomListToolbarMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + SELECT o.id, + o.custom_list_id, + o.name, + o.view_type, + o.btn_type, + o.btn_config, + o.icon, + o.request_param, + o.order_no + FROM gen_custom_list_toolbar AS o + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomPageCategoryMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomPageCategoryMapper.xml new file mode 100644 index 0000000..f670010 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomPageCategoryMapper.xml @@ -0,0 +1,15 @@ + + + + + + SELECT + tb.* + FROM gen_custom_page_category AS tb + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomPageMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomPageMapper.xml new file mode 100644 index 0000000..9f48ace --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomPageMapper.xml @@ -0,0 +1,46 @@ + + + + + + SELECT + o.* + FROM gen_custom_page AS o + + + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomSelectorCategoryMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomSelectorCategoryMapper.xml new file mode 100644 index 0000000..debf121 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomSelectorCategoryMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM gen_custom_selector_category AS tb + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenCustomSelectorMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenCustomSelectorMapper.xml new file mode 100644 index 0000000..51fb811 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenCustomSelectorMapper.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + SELECT o.id, + o.name, + o.category_id, + o.custom_list_id, + o.available, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time + FROM gen_custom_selector AS o + + + + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenDataEntityCategoryMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenDataEntityCategoryMapper.xml new file mode 100644 index 0000000..cecb0df --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenDataEntityCategoryMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM gen_data_entity_category AS tb + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenDataEntityMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenDataEntityMapper.xml new file mode 100644 index 0000000..e3c5a9b --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenDataEntityMapper.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + SELECT o.id, + o.name, + o.category_id, + o.available, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time, + o.gen_status + FROM gen_data_entity AS o + + + + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenDataObjDetailMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenDataObjDetailMapper.xml new file mode 100644 index 0000000..3cf68af --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenDataObjDetailMapper.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenDataObjMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenDataObjMapper.xml new file mode 100644 index 0000000..cebbbab --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenDataObjMapper.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + SELECT o.id, + o.name, + o.category_id, + o.main_table_id, + o.main_table_alias, + o.available, + o.description, + o.create_by, + o.create_time, + o.update_by, + o.update_time + FROM gen_data_obj AS o + + + + + + + + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/mappers/gen/GenDetailColumnConfigMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenDetailColumnConfigMapper.xml new file mode 100644 index 0000000..d7ced56 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenDetailColumnConfigMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + SELECT + g.id, + g.span, + g.order_no + FROM gen_detail_column_config AS g + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenGenerateInfoMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenGenerateInfoMapper.xml new file mode 100644 index 0000000..ef611ed --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenGenerateInfoMapper.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + i.id, + i.template_type, + i.package_name, + i.module_name, + i.biz_name, + i.class_name, + i.class_description, + i.parent_menu_id, + i.key_type, + i.author, + i.menu_code, + i.menu_name, + i.detail_span, + i.is_cache, + i.has_delete + FROM gen_generate_info AS i + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenMapper.xml new file mode 100644 index 0000000..8eb2a28 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenMapper.xml @@ -0,0 +1,33 @@ + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenQueryColumnConfigMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenQueryColumnConfigMapper.xml new file mode 100644 index 0000000..3f2cad7 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenQueryColumnConfigMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + SELECT + g.id, + g.width_type, + g.width, + g.sortable, + g.order_no + FROM gen_query_column_config AS g + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenQueryParamsColumnConfigMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenQueryParamsColumnConfigMapper.xml new file mode 100644 index 0000000..e724705 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenQueryParamsColumnConfigMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + SELECT + g.id, + g.query_type, + g.order_no + FROM gen_query_params_column_config AS g + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenSimpleTableColumnMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenSimpleTableColumnMapper.xml new file mode 100644 index 0000000..879ab24 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenSimpleTableColumnMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenSimpleTableMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenSimpleTableMapper.xml new file mode 100644 index 0000000..9dcf3fc --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenSimpleTableMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + SELECT + id, + table_name, + engine, + table_collation, + table_comment, + convert_type + FROM gen_simple_table + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenUpdateColumnConfigMapper.xml b/xingyun-template/src/main/resources/mappers/gen/GenUpdateColumnConfigMapper.xml new file mode 100644 index 0000000..fc2515d --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenUpdateColumnConfigMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + SELECT + g.id, + g.required, + g.order_no + FROM gen_update_column_config AS g + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/GenUpdateColumnConfigService.xml b/xingyun-template/src/main/resources/mappers/gen/GenUpdateColumnConfigService.xml new file mode 100644 index 0000000..85db163 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/GenUpdateColumnConfigService.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM gen_data_obj_category AS tb + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/gen/SimpleDBMapper.xml b/xingyun-template/src/main/resources/mappers/gen/SimpleDBMapper.xml new file mode 100644 index 0000000..a87f8cf --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/gen/SimpleDBMapper.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysDataDicCategoryMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysDataDicCategoryMapper.xml new file mode 100644 index 0000000..f7f1813 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysDataDicCategoryMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM sys_data_dic_category AS tb + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysDataDicItemMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysDataDicItemMapper.xml new file mode 100644 index 0000000..7682100 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysDataDicItemMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.dic_id, + tb.order_no, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM sys_data_dic_item AS tb + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysDataDicMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysDataDicMapper.xml new file mode 100644 index 0000000..556bc82 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysDataDicMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.code, + tb.name, + tb.category_id, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time + FROM sys_data_dic AS tb + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysDeptMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysDeptMapper.xml new file mode 100644 index 0000000..308a9e3 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysDeptMapper.xml @@ -0,0 +1,19 @@ + + + + + + SELECT + * + FROM sys_dept + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysMenuMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysMenuMapper.xml new file mode 100644 index 0000000..8eec8a4 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysMenuMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + SELECT id, + name, + path, + icon, + hidden, + display, + component_type, + component, + request_param, + parent_id, + title, + no_cache + FROM sys_menu + + + + SELECT + * + FROM sys_menu + + + + + + + + + + INSERT INTO sys_menu_collect (id, user_id, menu_id) VALUES (#{id}, #{userId}, #{menuId}) + + + DELETE FROM sys_menu_collect WHERE user_id = #{userId} AND menu_id = #{menuId} + + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysNoticeLogMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysNoticeLogMapper.xml new file mode 100644 index 0000000..67cd07a --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysNoticeLogMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + SELECT + tb.id, + tb.notice_id, + tb.user_id, + tb.readed, + tb.read_time + FROM sys_notice_log AS tb + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysNoticeMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysNoticeMapper.xml new file mode 100644 index 0000000..ba0a1b5 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysNoticeMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + tb.id, + tb.title, + tb.content, + tb.available, + tb.published, + tb.publish_time, + tb.create_by, + tb.create_time, + tb.update_by, + tb.update_time, + tb.readed_num, + tb.un_read_num + FROM sys_notice AS tb + + + + SELECT + tb.id, + tb.title, + tb.publish_time, + l.readed + FROM sys_notice_log AS l + INNER JOIN sys_notice AS tb ON tb.id = l.notice_id + + + + + UPDATE sys_notice SET readed_num = readed_num + 1, un_read_num = un_read_num - 1 WHERE id = #{id} + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysOpenDomainMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysOpenDomainMapper.xml new file mode 100644 index 0000000..9f670d5 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysOpenDomainMapper.xml @@ -0,0 +1,43 @@ + + + + + + SELECT + * + FROM sys_open_domain + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysPositionMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysPositionMapper.xml new file mode 100644 index 0000000..9b2ec66 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysPositionMapper.xml @@ -0,0 +1,48 @@ + + + + + + SELECT + * + FROM sys_position + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysRoleMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysRoleMapper.xml new file mode 100644 index 0000000..fde24b4 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysRoleMapper.xml @@ -0,0 +1,59 @@ + + + + + + SELECT + * + FROM sys_role + + + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysUserDeptMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysUserDeptMapper.xml new file mode 100644 index 0000000..7e6fd0e --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysUserDeptMapper.xml @@ -0,0 +1,22 @@ + + + + + + SELECT + ud.* + FROM sys_user_dept AS ud + INNER JOIN sys_dept AS d ON d.id = ud.dept_id + + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysUserMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysUserMapper.xml new file mode 100644 index 0000000..db63591 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysUserMapper.xml @@ -0,0 +1,99 @@ + + + + + + SELECT + u.* + FROM sys_user AS u + + + + + + + + UPDATE sys_user + SET password = #{password} + WHERE id = #{userId} + + + + UPDATE sys_user + SET email = #{email} + WHERE id = #{userId} + + + + UPDATE sys_user + SET telephone = #{telephone} + WHERE id = #{userId} + + + UPDATE sys_user + SET lock_status = TRUE + WHERE id = #{id} + + + UPDATE sys_user + SET lock_status = FALSE + WHERE id = #{id} + + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysUserPositionMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysUserPositionMapper.xml new file mode 100644 index 0000000..1d130fe --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysUserPositionMapper.xml @@ -0,0 +1,16 @@ + + + + + SELECT + up.* + FROM sys_user_position AS up + INNER JOIN sys_position AS p ON p.id = up.position_id + + + diff --git a/xingyun-template/src/main/resources/mappers/system/SysUserRoleMapper.xml b/xingyun-template/src/main/resources/mappers/system/SysUserRoleMapper.xml new file mode 100644 index 0000000..95b4ea7 --- /dev/null +++ b/xingyun-template/src/main/resources/mappers/system/SysUserRoleMapper.xml @@ -0,0 +1,15 @@ + + + + + SELECT + ur.* + FROM sys_user_role AS ur + INNER JOIN sys_role AS r ON r.id = ur.role_id + + + diff --git a/xingyun-template/src/main/resources/templates/add.vue.ftl b/xingyun-template/src/main/resources/templates/add.vue.ftl new file mode 100644 index 0000000..4fe8267 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/add.vue.ftl @@ -0,0 +1,111 @@ + + diff --git a/xingyun-template/src/main/resources/templates/api.ts.ftl b/xingyun-template/src/main/resources/templates/api.ts.ftl new file mode 100644 index 0000000..417c881 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/api.ts.ftl @@ -0,0 +1,113 @@ +import { defHttp } from '/@/utils/http/axios'; +import { PageResult } from '@/api/model/pageResult'; +import { ContentTypeEnum } from '@/enums/httpEnum'; +<#if query??>import { Query${className}Vo } from '@/api/${moduleName}/${bizName}/model/query${className}Vo'; +<#if query??>import { Query${className}Bo } from '@/api/${moduleName}/${bizName}/model/query${className}Bo'; +<#if detail??>import { ${r"Get"}${className}${r"Bo"} } from '@/api/${moduleName}/${bizName}/model/${r"get"}${className}${r"Bo"}'; +<#if create??>import { Create${className}Vo } from '@/api/${moduleName}/${bizName}/model/create${className}Vo'; +<#if update??>import { Update${className}Vo } from '@/api/${moduleName}/${bizName}/model/update${className}Vo'; + +const baseUrl = '/${moduleName}/${bizName}'; +const region = 'cloud-api'; + +<#if query??> +/** + * 查询列表 + * @param params + * @returns {Promise} + */ +export function query(params: Query${className}Vo): ${r"Promise>"} { + return defHttp.get<${r"PageResult<"}Query${className}${r"Bo>"}>( + { + url: baseUrl + '/query', + params: params, + }, + { + region, + }, + ); +} + + +<#if detail??> +/** + * 根据ID查询 + * @param ${keys[0].name} + * @returns {Promise} + */ +export function get(${keys[0].name}: ${keys[0].dataType}): ${r"Promise"} { + return defHttp.get<${r"Get"}${className}${r"Bo"}>( + { + url: baseUrl, + params: { + ${keys[0].name}, + } + }, + { + region, + }, + ); +} + + +<#if create??> +/** + * 新增 + * @param params + * @returns {Promise} + */ +export function create(params: Create${className}Vo): ${r"Promise"} { + return defHttp.post( + { + url: baseUrl, + data: params, + }, + { + contentType: ContentTypeEnum.FORM_URLENCODED, + region, + }, + ); +} + + +<#if update??> +/** + * 修改 + * @param params + * @returns {Promise} + */ +export function update(params: Update${className}Vo): ${r"Promise"} { + return defHttp.put( + { + url: baseUrl, + data: params, + }, + { + contentType: ContentTypeEnum.FORM_URLENCODED, + region, + }, + ); +} + + +<#if hasDelete> +/** + * 删除 + * @param params + * @returns {Promise} + */ +export function deleteById(${keys[0].name}: ${keys[0].dataType}): ${r"Promise"} { + return defHttp.delete( + { + url: baseUrl, + data: { + ${keys[0].name}, + }, + }, + { + region, + contentType: ContentTypeEnum.FORM_URLENCODED, + }, + ); +} + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/templates/controller.java.ftl b/xingyun-template/src/main/resources/templates/controller.java.ftl new file mode 100644 index 0000000..9be2e8c --- /dev/null +++ b/xingyun-template/src/main/resources/templates/controller.java.ftl @@ -0,0 +1,149 @@ +package ${packageName}.controller.${moduleName}; + +<#if detail??> +import ${packageName}.bo.${moduleName}.${bizName}.Get${className}Bo; + +<#if query??> +import ${packageName}.bo.${moduleName}.${bizName}.Query${className}Bo; + +<#if queryParams??> +import ${packageName}.vo.${moduleName}.${bizName}.Query${className}Vo; + +import ${packageName}.service.${moduleName}.${className}Service; +<#if create??> +import ${packageName}.vo.${moduleName}.${bizName}.Create${className}Vo; + +<#if update??> +import ${packageName}.vo.${moduleName}.${bizName}.Update${className}Vo; + +import ${packageName}.entity.${className}; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +import com.lframework.starter.web.controller.DefaultBaseController; +import org.springframework.beans.factory.annotation.Autowired; +import com.lframework.starter.web.annotations.security.HasPermission; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; +import java.util.stream.Collectors; + +/** + * ${classDescription} Controller + * +<#if author??> + * @author ${author} + + */ +@Api(tags = "${classDescription}") +@Validated +@RestController +@RequestMapping("/${moduleName}/${bizName}") +public class ${className}Controller extends DefaultBaseController { + + @Autowired + private ${className}Service ${classNameProperty}Service; + <#if query?? && queryParams??> + + /** + * 查询列表 + */ + @ApiOperation("查询列表") + @HasPermission({"${moduleName}:${bizName}:query"}) + @GetMapping("/query") + public ${r"InvokeResult>"} query(@Valid Query${className}Vo vo) { + + PageResult${r"<"}${className}${r">"} pageResult = ${classNameProperty}Service.query(getPageIndex(vo), getPageSize(vo), vo); + + List${r"<"}${className}${r">"} datas = pageResult.getDatas(); + List${r"<"}Query${className}Bo${r">"} results = null; + + if (!CollectionUtil.isEmpty(datas)) { + results = datas.stream().map(Query${className}Bo::new).collect(Collectors.toList()); + } + + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); + } + + <#if detail??> + + /** + * 根据ID查询 + */ + @ApiOperation("根据ID查询") + @ApiImplicitParam(value = "${keys[0].name}", name = "${keys[0].name}", paramType = "query", required = true) + @HasPermission({"${moduleName}:${bizName}:query"}) + @GetMapping + public ${r"InvokeResult"} get(<#if keys[0].dataType == 'String'>@NotBlank<#else>@NotNull(message = "${keys[0].name}不能为空!") ${keys[0].dataType} ${keys[0].name}) { + + ${className} data = ${classNameProperty}Service.findById(${keys[0].name}); + if (data == null) { + throw new DefaultClientException("${classDescription}不存在!"); + } + + Get${className}Bo result = new Get${className}Bo(data); + + return InvokeResultBuilder.success(result); + } + + <#if create??> + + /** + * 新增 + */ + @ApiOperation("新增") + @HasPermission({"${moduleName}:${bizName}:add"}) + @PostMapping + public ${r"InvokeResult"} create(@Valid Create${className}Vo vo) { + + ${classNameProperty}Service.create(vo); + + return InvokeResultBuilder.success(); + } + + <#if update??> + + /** + * 修改 + */ + @ApiOperation("修改") + @HasPermission({"${moduleName}:${bizName}:modify"}) + @PutMapping + public ${r"InvokeResult"} update(@Valid Update${className}Vo vo) { + + ${classNameProperty}Service.update(vo); + <#if isCache> + + ${classNameProperty}Service.cleanCacheByKey(vo.get${keys[0].nameProperty}()); + + + return InvokeResultBuilder.success(); + } + + <#if hasDelete> + + /** + * 根据ID删除 + */ + @ApiOperation("根据ID删除") + @ApiImplicitParam(value = "${keys[0].name}", name = "${keys[0].name}", paramType = "query", required = true) + @HasPermission({"${moduleName}:${bizName}:delete"}) + @DeleteMapping + public ${r"InvokeResult"} deleteById(<#if keys[0].dataType == 'String'>@NotBlank<#else>@NotNull(message = "${keys[0].name}不能为空!") ${keys[0].dataType} ${keys[0].name}) { + + ${classNameProperty}Service.deleteById(${keys[0].name}); + <#if isCache> + + ${classNameProperty}Service.cleanCacheByKey(${keys[0].name}); + + + return InvokeResultBuilder.success(); + } + +} diff --git a/xingyun-template/src/main/resources/templates/createvo.java.ftl b/xingyun-template/src/main/resources/templates/createvo.java.ftl new file mode 100644 index 0000000..bb4b6f8 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/createvo.java.ftl @@ -0,0 +1,51 @@ +package ${packageName}.vo.${moduleName}.${bizName}; + +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +import java.io.Serializable; +import lombok.Data; + +@Data +public class Create${className}Vo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + <#list columns as column> + /** + * ${column.description} + */ + <#if column.required> + @ApiModelProperty(value = "${column.description}", required = true) + <#else> + @ApiModelProperty("${column.description}") + + <#if column.required> + @${column.validateAnno}(message = "${column.validateMsg}${column.description}!") + <#if column.fixEnum> + @IsEnum(message = "${column.validateMsg}${column.description}!", enumClass = ${column.dataType}.class) + + + <#if column.regularExpression??> + @Pattern(regexp = "${column.regularExpression?replace("\\", "\\\\")}", message = "${column.description}格式有误!") + + <#if column.dataType != 'String'> + @TypeMismatch(message = "${column.description}格式有误!") + + <#if column.isDecimalType> + <#if (column.decimals??) && column.decimals gt 0> + @IsNumberPrecision(message = "${column.description}最多允许${column.decimals}位小数!", value = ${column.decimals}) + + <#else> + <#if column.dataType == 'String' && (column.viewType == 0 || column.viewType == 1)> + <#if (column.len??) && column.len gt 0> + @Length(message = "${column.description}最多允许${column.len}个字符!") + + + + private <#if column.fixEnum>${column.enumCodeType}<#else>${column.dataType} ${column.name}; + + +} diff --git a/xingyun-template/src/main/resources/templates/createvo.ts.ftl b/xingyun-template/src/main/resources/templates/createvo.ts.ftl new file mode 100644 index 0000000..0ce281e --- /dev/null +++ b/xingyun-template/src/main/resources/templates/createvo.ts.ftl @@ -0,0 +1,10 @@ +export interface Create${className}Vo { + + <#list columns as column> + /** + * ${column.description} + */ + ${column.name}<#if !column.required>?: ${column.frontDataType}; + + +} diff --git a/xingyun-template/src/main/resources/templates/detail.vue.ftl b/xingyun-template/src/main/resources/templates/detail.vue.ftl new file mode 100644 index 0000000..2f6dead --- /dev/null +++ b/xingyun-template/src/main/resources/templates/detail.vue.ftl @@ -0,0 +1,91 @@ + + diff --git a/xingyun-template/src/main/resources/templates/entity.java.ftl b/xingyun-template/src/main/resources/templates/entity.java.ftl new file mode 100644 index 0000000..43deaad --- /dev/null +++ b/xingyun-template/src/main/resources/templates/entity.java.ftl @@ -0,0 +1,49 @@ +package ${packageName}.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +import lombok.Data; + +/** + *

+ * ${classDescription} + *

+ * +<#if author??> + * @author ${author} + + */ +@Data +@TableName("${tableName}") +public class ${className} extends BaseEntity implements BaseDto { + + private static final long serialVersionUID = 1L; + + public static final String CACHE_NAME = "${className}"; + + <#list columns as column> + /** + * ${column.description} + */ + <#if !column.defaultConvertType> + <#if !column.isKey> + @TableField(value = "${column.columnName}"<#if column.fill?? && column.fill>, fill = FieldFill.${column.fillStrategy}) + <#else> + @TableId(value = "${column.columnName}"<#if column.autoIncrKey>, type = IdType.AUTO<#if column.fill?? && column.fill>, fill = FieldFill.${column.fillStrategy}<#if column.autoIncrKey>, type = IdType.AUTO) + + <#else> + <#if !column.isKey && column.fill?? && column.fill> + @TableField(fill = FieldFill.${column.fillStrategy}) + + + <#if column.defaultConvertType && column.isKey && column.autoIncrKey> + @TableId(value = "${column.columnName}", type = IdType.AUTO) + + private ${column.dataType} ${column.name}; + + +} diff --git a/xingyun-template/src/main/resources/templates/getbo.java.ftl b/xingyun-template/src/main/resources/templates/getbo.java.ftl new file mode 100644 index 0000000..8a01ec2 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/getbo.java.ftl @@ -0,0 +1,97 @@ +package ${packageName}.bo.${moduleName}.${bizName}; + +import com.fasterxml.jackson.annotation.JsonFormat; +import ${packageName}.entity.${className}; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + + +import lombok.Data; + +/** + *

+ * ${classDescription} GetBo + *

+ * +<#if author??> + * @author ${author} + + */ +@Data +public class Get${className}Bo extends BaseBo${r"<"}${className}${r">"} { + + /** + * ${keys[0].description} + */ + @ApiModelProperty("${keys[0].description}") + private ${keys[0].dataType} ${keys[0].name}; + + <#list columns as column> + /** + * ${column.description} + */ + @ApiModelProperty("${column.description}") + <#if column.dataType == 'LocalDateTime'> + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + + <#if column.dataType == 'LocalDate'> + @JsonFormat(pattern = StringPool.DATE_PATTERN) + + <#if column.dataType == 'LocalTime'> + @JsonFormat(pattern = StringPool.TIME_PATTERN) + + private <#if column.fixEnum>${column.enumCodeType}<#else>${column.dataType} ${column.name}; + + <#if column.dataDicCode??> + /** + * ${column.description}字典值 + */ + @ApiModelProperty("${column.description}字典值") + private String ${column.name}DicValue; + + + + public Get${className}Bo() { + + } + + public Get${className}Bo(${className} dto) { + + super(dto); + } + + @Override + public BaseBo${r"<"}${className}${r">"} convert(${className} dto) { + <#if hasFixEnum> + return super.convert(dto<#list columns as column><#if column.fixEnum>, Get${className}Bo::get${column.nameProperty}); + <#else> + return super.convert(dto); + + } + + @Override + protected void afterInit(${className} dto) { + + <#list columns as column> + <#if column.dataDicCode??> + ISysDataDicItemService sysDataDicItemService = ApplicationUtil.getBean(ISysDataDicItemService.class); + + <#break> + + + <#list columns as column> + <#if column.fixEnum> + this.${column.name} = dto.get${column.nameProperty}().getCode(); + + <#elseif column.dataDicCode??> + if (!StringUtil.isBlank(dto.get${column.nameProperty}())) { + String[] ${column.name}DicArr = dto.get${column.nameProperty}().split(StringPool.DATA_DIC_SPLIT); + this.${column.name}DicValue = sysDataDicItemService.findByCode(${column.name}DicArr[0], ${column.name}DicArr[1]).getName(); + } + + + + } +} diff --git a/xingyun-template/src/main/resources/templates/getbo.ts.ftl b/xingyun-template/src/main/resources/templates/getbo.ts.ftl new file mode 100644 index 0000000..d4908ca --- /dev/null +++ b/xingyun-template/src/main/resources/templates/getbo.ts.ftl @@ -0,0 +1,29 @@ +/** + * ${classDescription} GetBo + * +<#if author??> + * @author ${author} + + */ +export interface Get${className}Bo { + + /** + * ${keys[0].description} + */ + ${keys[0].name}: ${keys[0].frontDataType}; + + <#list columns as column> + /** + * ${column.description} + */ + ${column.name}: ${column.frontDataType}; + + <#if column.dataDicCode??> + /** + * ${column.description}字典值 + */ + ${column.name}DicValue: string; + + + +} diff --git a/xingyun-template/src/main/resources/templates/index.vue.ftl b/xingyun-template/src/main/resources/templates/index.vue.ftl new file mode 100644 index 0000000..d330763 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/index.vue.ftl @@ -0,0 +1,205 @@ + + + + diff --git a/xingyun-template/src/main/resources/templates/input-components.ftl b/xingyun-template/src/main/resources/templates/input-components.ftl new file mode 100644 index 0000000..f0f49c0 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/input-components.ftl @@ -0,0 +1,78 @@ +<#if column.viewType == 0> + max-length="${column.len}" allow-clear /> +<#elseif column.viewType == 1> + max-length="${column.len}" allow-clear /> +<#elseif column.viewType == 2> + +<#elseif column.viewType == 3> + +<#elseif column.viewType == 4> + + +<#elseif column.viewType == 5> +<#if column.fixEnum> + + {{ item.desc }} + +<#else> +<#if column.hasAvailableTag> + + {{ item.desc }} + +<#else> + + + + + + +<#elseif column.viewType == 6> +<#if column.dataType == 'LocalDateTime'> +
+ + + +
+<#else> +
+ + + +
+ +<#elseif column.viewType == 7> + +<#elseif column.viewType == 8> + + diff --git a/xingyun-template/src/main/resources/templates/mapper.java.ftl b/xingyun-template/src/main/resources/templates/mapper.java.ftl new file mode 100644 index 0000000..4a0f8d0 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/mapper.java.ftl @@ -0,0 +1,35 @@ +package ${packageName}.mappers; + +import ${packageName}.entity.${className}; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +<#if queryParams??> +import ${packageName}.vo.${moduleName}.${bizName}.Query${className}Vo; + +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * ${classDescription} Mapper 接口 + *

+ * +<#if author??> + * @author ${author} + + */ +public interface ${className}Mapper extends BaseMapper<${className}> { + + <#if queryParams??> + /** + * 查询列表 + * @param vo + * @return + */ + List${r"<"}${className}${r">"} query(@Param("vo") Query${className}Vo vo); + +} diff --git a/xingyun-template/src/main/resources/templates/mapper.list.xml.ftl b/xingyun-template/src/main/resources/templates/mapper.list.xml.ftl new file mode 100644 index 0000000..f77ad20 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/mapper.list.xml.ftl @@ -0,0 +1,49 @@ + + + + + + <#list entity.columns as column> + <#if column.isKey> + + <#else> + + + + + + + SELECT + <#list entity.columns as column> + tb.${column.columnName}<#if column_index != entity.columns?size - 1>, + + FROM ${entity.tableName} AS tb + + + <#if queryParams??> + + + diff --git a/xingyun-template/src/main/resources/templates/modify.vue.ftl b/xingyun-template/src/main/resources/templates/modify.vue.ftl new file mode 100644 index 0000000..3bf5a73 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/modify.vue.ftl @@ -0,0 +1,128 @@ + + diff --git a/xingyun-template/src/main/resources/templates/query-type-sql.ftl b/xingyun-template/src/main/resources/templates/query-type-sql.ftl new file mode 100644 index 0000000..855edb9 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/query-type-sql.ftl @@ -0,0 +1,27 @@ +<#if column.queryType == 0> +AND tb.${column.columnName} = ${r"#{vo."}${column.name}${r"}"} +<#elseif column.queryType == 1> +AND tb.${column.columnName} > ${r"#{vo."}${column.name}${r"}"} +<#elseif column.queryType == 2> +AND tb.${column.columnName} >= ${r"#{vo."}${column.name}${r"}"} +<#elseif column.queryType == 3> + +<#elseif column.queryType == 4> + +<#elseif column.queryType == 5> +AND tb.${column.columnName} != ${r"#{vo."}${column.name}${r"}"} +<#elseif column.queryType == 6> +AND tb.${column.columnName} IN (${r"#{vo."}${column.name}${r"}"}) +<#elseif column.queryType == 7> +AND tb.${column.columnName} NOT IN (${r"#{vo."}${column.name}${r"}"}) +<#elseif column.queryType == 8> +AND tb.${column.columnName} LIKE CONCAT('%', ${r"#{vo."}${column.name}${r"}"}) +<#elseif column.queryType == 9> +AND tb.${column.columnName} LIKE CONCAT(${r"#{vo."}${column.name}${r"}"}, '%') +<#elseif column.queryType == 10> +AND tb.${column.columnName} LIKE CONCAT('%', ${r"#{vo."}${column.name}${r"}"}, '%') + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/templates/querybo.java.ftl b/xingyun-template/src/main/resources/templates/querybo.java.ftl new file mode 100644 index 0000000..2284bf8 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/querybo.java.ftl @@ -0,0 +1,89 @@ +package ${packageName}.bo.${moduleName}.${bizName}; + +import com.fasterxml.jackson.annotation.JsonFormat; +import ${packageName}.entity.${className}; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + + +import lombok.Data; + +/** + *

+ * ${classDescription} QueryBo + *

+ * +<#if author??> + * @author ${author} + + */ +@Data +public class Query${className}Bo extends BaseBo${r"<"}${className}${r">"} { + + /** + * ${keys[0].description} + */ + @ApiModelProperty("${keys[0].description}") + private ${keys[0].dataType} ${keys[0].name}; + +<#list columns as column> + /** + * ${column.description} + */ + @ApiModelProperty("${column.description}") + <#if column.dataType == 'LocalDateTime'> + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) + + <#if column.dataType == 'LocalDate'> + @JsonFormat(pattern = StringPool.DATE_PATTERN) + + <#if column.dataType == 'LocalTime'> + @JsonFormat(pattern = StringPool.TIME_PATTERN) + + private <#if column.fixEnum>${column.enumCodeType}<#else>${column.dataType} ${column.name}; + + + public Query${className}Bo() { + + } + + public Query${className}Bo(${className} dto) { + + super(dto); + } + + @Override + public BaseBo${r"<"}${className}${r">"} convert(${className} dto) { + <#if hasFixEnum> + return super.convert(dto<#list columns as column><#if column.fixEnum>, Query${className}Bo::get${column.nameProperty}); + <#else> + return super.convert(dto); + + } + + @Override + protected void afterInit(${className} dto) { + + <#list columns as column> + <#if column.dataDicCode??> + ISysDataDicItemService sysDataDicItemService = ApplicationUtil.getBean(ISysDataDicItemService.class); + + <#break> + + + <#list columns as column> + <#if column.fixEnum> + this.${column.name} = dto.get${column.nameProperty}().getCode(); + + <#elseif column.dataDicCode??> + if (!StringUtil.isBlank(dto.get${column.nameProperty}())) { + String[] ${column.name}DicArr = dto.get${column.nameProperty}().split(StringPool.DATA_DIC_SPLIT); + this.${column.name} = sysDataDicItemService.findByCode(${column.name}DicArr[0], ${column.name}DicArr[1]).getName(); + } + + + + } +} diff --git a/xingyun-template/src/main/resources/templates/querybo.ts.ftl b/xingyun-template/src/main/resources/templates/querybo.ts.ftl new file mode 100644 index 0000000..6d2c4f6 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/querybo.ts.ftl @@ -0,0 +1,22 @@ +/** + * ${classDescription} QueryBo + * +<#if author??> + * @author ${author} + + */ +export interface Query${className}Bo { + + /** + * ${keys[0].description} + */ + ${keys[0].name}: ${keys[0].frontDataType}; + +<#list columns as column> + /** + * ${column.description} + */ + ${column.name}: ${column.frontDataType}; + + +} diff --git a/xingyun-template/src/main/resources/templates/queryvo.java.ftl b/xingyun-template/src/main/resources/templates/queryvo.java.ftl new file mode 100644 index 0000000..64374a5 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/queryvo.java.ftl @@ -0,0 +1,57 @@ +package ${packageName}.vo.${moduleName}.${bizName}; + +import lombok.Data; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +import java.io.Serializable; + +@Data +public class Query${className}Vo extends PageVo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + <#list columns as column> + <#if column.viewType != 6> + /** + * ${column.description} + */ + @ApiModelProperty("${column.description}") + + <#if column.fixEnum> + <#if column.dataType != 'String'> + @TypeMismatch(message = "${column.description}格式有误!") + + @IsEnum(message = "${column.description}格式有误!", enumClass = ${column.dataType}.class) + private ${column.enumCodeType} ${column.name}; + <#else> + <#if column.viewType == 6> + /** + * ${column.description} 起始时间 + */ + @ApiModelProperty("${column.description} 起始时间") + <#if column.dataType != 'String'> + @TypeMismatch(message = "${column.description}起始时间格式有误!") + + private ${column.dataType} ${column.name}Start; + + /** + * ${column.description} 截止时间 + */ + @ApiModelProperty("${column.description} 截止时间") + <#if column.dataType != 'String'> + @TypeMismatch(message = "${column.description}截止时间格式有误!") + + private ${column.dataType} ${column.name}End; + <#else> + <#if column.dataType != 'String'> + @TypeMismatch(message = "${column.description}格式有误!") + + private ${column.dataType} ${column.name}; + + + + +} diff --git a/xingyun-template/src/main/resources/templates/queryvo.ts.ftl b/xingyun-template/src/main/resources/templates/queryvo.ts.ftl new file mode 100644 index 0000000..c229363 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/queryvo.ts.ftl @@ -0,0 +1,25 @@ +import { PageVo } from '@/api/model/pageVo'; + +export interface Query${className}Vo extends PageVo { + + <#list columns as column> + <#if column.viewType != 6> + /** + * ${column.description} + */ + ${column.name}: ${column.frontDataType}; + + <#if column.viewType == 6> + /** + * ${column.description} 起始时间 + */ + ${column.name}Start: ${column.frontDataType}; + + /** + * ${column.description} 截止时间 + */ + ${column.name}End: ${column.frontDataType}; + + + +} diff --git a/xingyun-template/src/main/resources/templates/service.java.ftl b/xingyun-template/src/main/resources/templates/service.java.ftl new file mode 100644 index 0000000..6262ed1 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/service.java.ftl @@ -0,0 +1,79 @@ +package ${packageName}.service.${moduleName}; + +<#if create??> +import ${packageName}.vo.${moduleName}.${bizName}.Create${className}Vo; + +<#if queryParams??> +import ${packageName}.vo.${moduleName}.${bizName}.Query${className}Vo; + +<#if update??> +import ${packageName}.vo.${moduleName}.${bizName}.Update${className}Vo; + +import ${packageName}.entity.${className}; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +import java.util.Collection; +import java.util.List; + +/** + * ${classDescription} Service +<#if author??> + * + * @author ${author} + + */ +public interface ${className}Service extends BaseMpService${r"<"}${className}${r">"} { + + <#if queryParams??> + /** + * 查询列表 + * @return + */ + PageResult${r"<"}${className}${r">"} query(Integer pageIndex, Integer pageSize, Query${className}Vo vo); + + + <#if queryParams??> + /** + * 查询列表 + * @param vo + * @return + */ + ${r"List<"}${className}${r">"} query(Query${className}Vo vo); + + + /** + * 根据ID查询 + * @param ${keys[0].name} + * @return + */ + ${className} findById(<#list keys as key>${key.dataType} ${key.name}<#if key_index != keys?size - 1>, ); + + <#if create??> + /** + * 创建 + * @param vo + * @return + */ + ${create.keys[0].dataType} create(Create${className}Vo vo); + + + <#if update??> + /** + * 修改 + * @param vo + */ + void update(Update${className}Vo vo); + + + <#if hasDelete> + /** + * 根据ID删除 + * @param ${keys[0].name} + * @return + */ + void deleteById(<#list keys as key>${key.dataType} ${key.name}<#if key_index != keys?size - 1>, ); + +} diff --git a/xingyun-template/src/main/resources/templates/serviceimpl.java.ftl b/xingyun-template/src/main/resources/templates/serviceimpl.java.ftl new file mode 100644 index 0000000..bd9483c --- /dev/null +++ b/xingyun-template/src/main/resources/templates/serviceimpl.java.ftl @@ -0,0 +1,167 @@ +package ${packageName}.impl.${moduleName}; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageInfo; +import ${packageName}.entity.${className}; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +import ${packageName}.mappers.${className}Mapper; +import ${packageName}.service.${moduleName}.${className}Service; +<#if create??> +import ${packageName}.vo.${moduleName}.${bizName}.Create${className}Vo; + +<#if queryParams??> +import ${packageName}.vo.${moduleName}.${bizName}.Query${className}Vo; + +<#if update??> +import ${packageName}.vo.${moduleName}.${bizName}.Update${className}Vo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collection; +import java.util.List; + +@Service +public class ${className}ServiceImpl extends BaseMpServiceImpl${r"<"}${className}Mapper, ${className}${r">"} implements ${className}Service { +<#if queryParams??> + + @Override + public PageResult${r"<"}${className}${r">"} query(Integer pageIndex, Integer pageSize, Query${className}Vo vo) { + + Assert.greaterThanZero(pageIndex); + Assert.greaterThanZero(pageSize); + + PageHelperUtil.startPage(pageIndex, pageSize); + List${r"<"}${className}${r">"} datas = this.query(vo); + + return PageResultUtil.convert(new PageInfo<>(datas)); + } + +<#if queryParams??> + + @Override + public List${r"<"}${className}${r">"} query(Query${className}Vo vo) { + + return getBaseMapper().query(vo); + } + + +<#if isCache> + @Cacheable(value = ${className}.CACHE_NAME, key = "@cacheVariables.tenantId() + #${keys[0].name}", unless = "#result == null") + + @Override + public ${className} findById(<#list keys as key>${key.dataType} ${key.name}<#if key_index != keys?size - 1>, ) { + + return getBaseMapper().selectById(${keys[0].name}); + } +<#if create??> + + @OpLog(type = 99, name = "新增${classDescription},ID:{}", params = ${r'{"#'}${create.keys[0].name}${r'"}'}) + @Transactional(rollbackFor = Exception.class) + @Override + public ${create.keys[0].dataType} create(Create${className}Vo vo) { + + ${className} data = new ${className}(); + <#if create.appointId> + data.set${create.keys[0].nameProperty}(${create.idCode}); + + <#list create.columns as column> + <#if column.required> + <#if column.fixEnum> + data.set${column.nameProperty}(EnumUtil.getByCode(${column.dataType}.class, vo.get${column.nameProperty}())); + <#else> + data.set${column.nameProperty}(vo.get${column.nameProperty}()); + + <#else> + <#if column.dataType == 'String'> + if (!StringUtil.isBlank(vo.get${column.nameProperty}())) { + data.set${column.nameProperty}(vo.get${column.nameProperty}()); + } + <#else> + if (vo.get${column.nameProperty}() != null) { + <#if column.fixEnum> + data.set${column.nameProperty}(EnumUtil.getByCode(${column.dataType}.class, vo.get${column.nameProperty}())); + <#else> + data.set${column.nameProperty}(vo.get${column.nameProperty}()); + + } + + + + + getBaseMapper().insert(data); + + OpLogUtil.setVariable("${create.keys[0].name}", <#if create.keys[0].dataType == 'String'>data.get${create.keys[0].nameProperty}()<#else>String.valueOf(data.get${create.keys[0].nameProperty}())); + OpLogUtil.setExtra(vo); + + return data.get${create.keys[0].nameProperty}(); + } + +<#if update??> + + @OpLog(type = 99, name = "修改${classDescription},ID:{}", params = ${r'{"#'}${update.keys[0].name}${r'"}'}) + @Transactional(rollbackFor = Exception.class) + @Override + public void update(Update${className}Vo vo) { + + ${className} data = getBaseMapper().selectById(vo.get${update.keys[0].nameProperty}()); + if (ObjectUtil.isNull(data)) { + throw new DefaultClientException("${classDescription}不存在!"); + } + + LambdaUpdateWrapper${r"<"}${className}${r">"} updateWrapper = Wrappers.lambdaUpdate(${className}.class) + <#list update.columns as column> + <#if column.required> + <#if column.fixEnum> + .set(${className}::get${column.nameProperty}, EnumUtil.getByCode(${column.dataType}.class, vo.get${column.nameProperty}())) + <#else> + .set(${className}::get${column.nameProperty}, vo.get${column.nameProperty}()) + + <#else> + <#if column.dataType == 'String'> + .set(${className}::get${column.nameProperty}, StringUtil.isBlank(vo.get${column.nameProperty}()) ? null : vo.get${column.nameProperty}()) + <#else> + <#if column.fixEnum> + .set(${className}::get${column.nameProperty}, vo.get${column.nameProperty}() == null ? null : EnumUtil.getByCode(${column.dataType}.class, vo.get${column.nameProperty}())) + <#else> + .set(${className}::get${column.nameProperty}, vo.get${column.nameProperty}() == null ? null : vo.get${column.nameProperty}()) + + + + + .eq(${className}::get${update.keys[0].nameProperty}, vo.get${update.keys[0].nameProperty}()); + + getBaseMapper().update(updateWrapper); + + OpLogUtil.setVariable("${update.keys[0].name}", <#if update.keys[0].dataType == 'String'>data.get${update.keys[0].nameProperty}()<#else>String.valueOf(data.get${update.keys[0].nameProperty}())); + OpLogUtil.setExtra(vo); + } + + <#if hasDelete> + + @OpLog(type = 99, name = "删除${classDescription},ID:{}", params = ${r'{"#'}${keys[0].name}${r'"}'}) + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteById(<#list keys as key>${key.dataType} ${key.name}<#if key_index != keys?size - 1>, ) { + + getBaseMapper().deleteById(<#list keys as key>${key.name}<#if key_index != keys?size - 1>, ); + } + + + <#if isCache> + @CacheEvict(value = ${className}.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") + + @Override + public void cleanCacheByKey(Serializable key) { + + } +} diff --git a/xingyun-template/src/main/resources/templates/sql.ftl b/xingyun-template/src/main/resources/templates/sql.ftl new file mode 100644 index 0000000..789c320 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/sql.ftl @@ -0,0 +1,9 @@ +-- 功能菜单SQL +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `component`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('${menuId}', '${menuCode}', '${className}', '${menuName}', '/${moduleName}/${bizName}/index', <#if parentMenuId??>'${parentMenuId}'<#else>NULL, '/${moduleName}/${bizName}', 0, 1, 0, '${moduleName}:${bizName}:query', 0, 1, '', '1', NOW(), '1', NOW()); +-- 权限SQL +<#if create??> +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `component`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('${IdUtil.getId()}', '${menuCode}001', '', '新增${classDescription}', '', '${menuId}', '', 0, 2, 0, '${moduleName}:${bizName}:add', 0, 1, '', '1', NOW(), '1', NOW()); + +<#if update??> +INSERT INTO `sys_menu` (`id`, `code`, `name`, `title`, `component`, `parent_id`, `path`, `no_cache`, `display`, `hidden`, `permission`, `is_special`, `available`, `description`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('${IdUtil.getId()}', '${menuCode}002', '', '修改${classDescription}', '', '${menuId}', '', 0, 2, 0, '${moduleName}:${bizName}:modify', 0, 1, '', '1', NOW(), '1', NOW()); + \ No newline at end of file diff --git a/xingyun-template/src/main/resources/templates/updatevo.java.ftl b/xingyun-template/src/main/resources/templates/updatevo.java.ftl new file mode 100644 index 0000000..7e63292 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/updatevo.java.ftl @@ -0,0 +1,62 @@ +package ${packageName}.vo.${moduleName}.${bizName}; + +import lombok.Data; +<#if importPackages??> + <#list importPackages as p> +import ${p}; + + +import java.io.Serializable; + +@Data +public class Update${className}Vo implements BaseVo, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ${keys[0].description} + */ + @ApiModelProperty(value = "${keys[0].description}", required = true) +<#if keys[0].dataType == 'String'> + @NotBlank(message = "${keys[0].name}不能为空!") +<#else> + @NotNull(message = "${keys[0].name}不能为空!") + + private ${keys[0].dataType} ${keys[0].name}; + +<#list columns as column> + /** + * ${column.description} + */ + <#if column.required> + @ApiModelProperty(value = "${column.description}", required = true) + <#else> + @ApiModelProperty("${column.description}") + + <#if column.dataType != 'String'> + @TypeMismatch(message = "${column.description}格式有误!") + + <#if column.required> + @${column.validateAnno}(message = "${column.validateMsg}${column.description}!") + <#if column.fixEnum> + @IsEnum(message = "${column.validateMsg}${column.description}!", enumClass = ${column.dataType}.class) + + + <#if column.regularExpression??> + @Pattern(regexp = "${column.regularExpression?replace("\\", "\\\\")}", message = "${column.description}格式有误!") + + <#if column.isDecimalType> + <#if (column.decimals??) && column.decimals gt 0> + @IsNumberPrecision(message = "${column.description}最多允许${column.decimals}位小数!", value = ${column.decimals}) + + <#else> + <#if column.dataType == 'String' && (column.viewType == 0 || column.viewType == 1)> + <#if (column.len??) && column.len gt 0> + @Length(message = "${column.description}最多允许${column.len}个字符!") + + + + private <#if column.fixEnum>${column.enumCodeType}<#else>${column.dataType} ${column.name}; + + +} diff --git a/xingyun-template/src/main/resources/templates/updatevo.ts.ftl b/xingyun-template/src/main/resources/templates/updatevo.ts.ftl new file mode 100644 index 0000000..747d111 --- /dev/null +++ b/xingyun-template/src/main/resources/templates/updatevo.ts.ftl @@ -0,0 +1,17 @@ + +export interface Update${className}Vo { + + /** + * ${keys[0].description} + */ + ${keys[0].name}: ${keys[0].frontDataType}; + +<#list columns as column> + /** + * ${column.description} + */ + + ${column.name}<#if !column.required>?: ${column.frontDataType}; + + +}